diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-03-02 11:24:57 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-03-02 11:24:57 +0000 |
commit | 7874813b4b682c34f709bf7a465baa8407b2a00f (patch) | |
tree | 115ed1b33806e139b87a93cedbc564fa41135206 /src/net/cbaines/suma/Bus.java | |
parent | f58d7d1fc227ed7de50ef5d48a49ff6709f3197b (diff) | |
parent | e3be46bdee08ad5b336e143861790b705defc0bc (diff) | |
download | southamptonuniversitymap-7874813b4b682c34f709bf7a465baa8407b2a00f.tar southamptonuniversitymap-7874813b4b682c34f709bf7a465baa8407b2a00f.tar.gz |
Merge branch 'dev'
Conflicts:
gen/net/cbaines/suma/R.java
src/net/cbaines/suma/BusSpecificStopView.java
src/net/cbaines/suma/BusStopSpecificStopView.java
src/net/cbaines/suma/MapActivity.java
Diffstat (limited to 'src/net/cbaines/suma/Bus.java')
-rw-r--r-- | src/net/cbaines/suma/Bus.java | 194 |
1 files changed, 100 insertions, 94 deletions
diff --git a/src/net/cbaines/suma/Bus.java b/src/net/cbaines/suma/Bus.java index b36dd89..865384f 100644 --- a/src/net/cbaines/suma/Bus.java +++ b/src/net/cbaines/suma/Bus.java @@ -31,100 +31,106 @@ import com.j256.ormlite.table.DatabaseTable; @DatabaseTable(tableName = "buses") public class Bus { - final static String ID_FIELD_NAME = "id"; - final static String ROUTE_FIELD_NAME = "route"; - final static String DIRECTION_FIELD_NAME = "direction"; - - @DatabaseField(generatedId = true) - int gid; - - /** - * The identification number of the bus. - */ - @DatabaseField(canBeNull = true) - String id; - - /** - * The route the bus is travelling. - */ - @DatabaseField(canBeNull = false, foreign = true) - BusRoute route; - - /** - * The direction which the bus is travelling. - */ - @DatabaseField(canBeNull = true) - String direction; - - /** - * The destination the bus is travelling towards. - */ - @DatabaseField(canBeNull = true, foreign = true) - BusStop destination; - - Bus() { - } - - /** - * Create a bus. - * - * @param id - * The identification number of the bus. - * @param route - * The route the bus is travelling. - * @param dir - * The direction which the bus is travelling. - */ - Bus(String id, BusRoute route, String direction) { - this.id = id; - this.route = route; - this.direction = direction; - } - - /** - * Create a bus. - * - * @param id - * The identification number of the bus. - * @param route - * The route the bus is travelling. - */ - Bus(String id, BusRoute route) { - this(id, route, null); - } - - public String toString() { - return String.valueOf(id + " (" + route.code + direction + ")"); - } - - String getName() { - if (direction != null) { - return route.code + direction; - } else { - return route.code; + final static String ID_FIELD_NAME = "id"; + final static String ROUTE_FIELD_NAME = "route"; + final static String DIRECTION_FIELD_NAME = "direction"; + + @DatabaseField(generatedId = true) + int gid; + + /** + * The identification number of the bus. + */ + @DatabaseField(canBeNull = true) + String id; + + /** + * The route the bus is travelling. + */ + @DatabaseField(canBeNull = false, foreign = true) + BusRoute route; + + /** + * The direction which the bus is travelling. + */ + @DatabaseField(canBeNull = true) + String direction; + + /** + * The destination the bus is travelling towards. + */ + @DatabaseField(canBeNull = true, foreign = true) + BusStop destination; + + /** + * The destination the bus is travelling towards. + */ + @DatabaseField(canBeNull = true) + String destinationString; + + Bus() { + } + + /** + * Create a bus. + * + * @param id + * The identification number of the bus. + * @param route + * The route the bus is travelling. + * @param dir + * The direction which the bus is travelling. + */ + Bus(String id, BusRoute route, String direction) { + this.id = id; + this.route = route; + this.direction = direction; + } + + /** + * Create a bus. + * + * @param id + * The identification number of the bus. + * @param route + * The route the bus is travelling. + */ + Bus(String id, BusRoute route) { + this(id, route, null); + } + + public String toString() { + return String.valueOf(id + " (" + route.code + direction + ")"); + } + + String getName() { + if (direction != null) { + return route.code + direction; + } else { + return route.code; + } + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + gid; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Bus other = (Bus) obj; + if (id != other.id) + return false; + return true; } - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + gid; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Bus other = (Bus) obj; - if (id != other.id) - return false; - return true; - } } |