diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-02-18 20:38:19 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-02-18 20:38:19 +0000 |
commit | b374a50fb6f3bd0866bc1f75f7592abb0a6b8cc1 (patch) | |
tree | b4a95dd2bf151891f9a6129594e531bee3a74d37 /src/net/cbaines/suma/BusRoute.java | |
parent | 6a1277d9a0d69dc34b1c0c1cfb6c502346035434 (diff) | |
download | southamptonuniversitymap-b374a50fb6f3bd0866bc1f75f7592abb0a6b8cc1.tar southamptonuniversitymap-b374a50fb6f3bd0866bc1f75f7592abb0a6b8cc1.tar.gz |
Fixed a bug in the constructor of BusRoute, and rebuild the database acordingly. Also made improvements to the preferences system.
Diffstat (limited to 'src/net/cbaines/suma/BusRoute.java')
-rw-r--r-- | src/net/cbaines/suma/BusRoute.java | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/net/cbaines/suma/BusRoute.java b/src/net/cbaines/suma/BusRoute.java index 244f56e..97309c4 100644 --- a/src/net/cbaines/suma/BusRoute.java +++ b/src/net/cbaines/suma/BusRoute.java @@ -90,12 +90,14 @@ public class BusRoute { BusRoute() { } - public BusRoute(Integer id, String code, String label, String forwardDirection, String reverseDirection, boolean uniLink) { + public BusRoute(Integer id, String code, String label, String forwardDirection, String reverseDirection, + boolean uniLink) { this.id = id.intValue(); this.code = code; this.label = label; this.forwardDirection = forwardDirection; this.reverseDirection = reverseDirection; + this.uniLink = uniLink; } public BusRoute(Integer id, String code, String label, boolean uniLink) { @@ -168,7 +170,8 @@ public class BusRoute { for (int stopIndex : stopIndexs) { if (moveAmount > 0) { - Log.v(TAG, "Moving forward " + moveAmount + " stops from " + busStop + " (" + stopIndex + "/" + routeStopsFound.size() + ")"); + Log.v(TAG, "Moving forward " + moveAmount + " stops from " + busStop + " (" + stopIndex + "/" + + routeStopsFound.size() + ")"); int stopWanted = stopIndex + moveAmount; if ((stopWanted + 1) > routeStopsFound.size()) { Log.v(TAG, "Off the end of the route"); @@ -191,8 +194,9 @@ public class BusRoute { Log.v(TAG, "stopWanted " + stopWanted); busStopDao.refresh(routeStopsFound.get(stopWanted).busStop); - Log.v(TAG, "Moving backwards " + moveAmount + " stops from " + busStop + " to " + routeStopsFound.get(stopWanted).busStop + " in route " - + this); + Log.v(TAG, + "Moving backwards " + moveAmount + " stops from " + busStop + " to " + + routeStopsFound.get(stopWanted).busStop + " in route " + this); busStops.add(routeStopsFound.get(stopWanted).busStop); } @@ -280,13 +284,15 @@ public class BusRoute { } else { stopIndex = 30; } - } else if (busStop.id.equals("SN120527") && id == 329) { // U2 Civic Centre Rd os stop AO Civic Ctr E + } else if (busStop.id.equals("SN120527") && id == 329) { // U2 Civic Centre Rd os stop AO Civic + // Ctr E if (moveAmount > 0) { stopIndex = 0; } else { stopIndex = 42; } - } else if (busStop.id.equals("SNA09298") && id == 329) { // U2 Bassett Green Rd nr Bassett Green Cl SE + } else if (busStop.id.equals("SNA09298") && id == 329) { // U2 Bassett Green Rd nr Bassett Green + // Cl SE if (moveAmount > 0) { stopIndex = 22; } else { @@ -317,8 +323,10 @@ public class BusRoute { stopIndex = 73; } } else { - Log.e(TAG, "Error, unknown bus stop " + busStop.id + " (" + busStop.description + ") that appears mutiple times in " + toString()); - throw new RuntimeException("Error, unknown bus stop " + busStop.id + " that appears mutiple times in " + toString()); + Log.e(TAG, "Error, unknown bus stop " + busStop.id + " (" + busStop.description + + ") that appears mutiple times in " + toString()); + throw new RuntimeException("Error, unknown bus stop " + busStop.id + + " that appears mutiple times in " + toString()); } Log.v(TAG, "Selecting " + stopIndex + " for " + busStop.id + " as direction == " + direction); } @@ -326,7 +334,8 @@ public class BusRoute { } if (moveAmount > 0) { - Log.v(TAG, "Moving forward " + moveAmount + " stops from " + busStop + " (" + stopIndex + "/" + routeStopsFound.size() + ")"); + Log.v(TAG, "Moving forward " + moveAmount + " stops from " + busStop + " (" + stopIndex + "/" + + routeStopsFound.size() + ")"); int stopWanted = stopIndex + moveAmount; if ((stopWanted + 1) > routeStopsFound.size()) { Log.v(TAG, "Off the end of the route"); @@ -349,7 +358,9 @@ public class BusRoute { Log.v(TAG, "stopWanted " + stopWanted); busStopDao.refresh(routeStopsFound.get(stopWanted).busStop); - Log.v(TAG, "Moving backwards " + moveAmount + " stops from " + busStop + " to " + routeStopsFound.get(stopWanted).busStop + " in route " + this); + Log.v(TAG, + "Moving backwards " + moveAmount + " stops from " + busStop + " to " + + routeStopsFound.get(stopWanted).busStop + " in route " + this); return routeStopsFound.get(stopWanted).busStop; } |