aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusRoute.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/BusRoute.java')
-rw-r--r--src/net/cbaines/suma/BusRoute.java43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/net/cbaines/suma/BusRoute.java b/src/net/cbaines/suma/BusRoute.java
index e38d06a..54f1340 100644
--- a/src/net/cbaines/suma/BusRoute.java
+++ b/src/net/cbaines/suma/BusRoute.java
@@ -65,7 +65,8 @@ public class BusRoute {
String label;
/**
- * The direction the bus is travelling if it is moving through the route and sequence is increasing.
+ * The direction the bus is travelling if it is moving through the route and
+ * sequence is increasing.
* <ul>
* <li>U1 = A</li>
* <li>U2 = B</li>
@@ -76,7 +77,8 @@ public class BusRoute {
String forwardDirection;
/**
- * The direction the bus is travelling if it is moving through the route and sequence is decreasing.
+ * The direction the bus is travelling if it is moving through the route and
+ * sequence is decreasing.
* <ul>
* <li>U1 = C</li>
* <li>U2 = C</li>
@@ -92,7 +94,8 @@ 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;
@@ -132,8 +135,9 @@ public class BusRoute {
}
/**
- * Return the set of bus stops that can be thought of moveAmount away from the busStop. The method returns a set as for some
- * movements, the destination stop is ambiguous.
+ * Return the set of bus stops that can be thought of moveAmount away from
+ * the busStop. The method returns a set as for some movements, the
+ * destination stop is ambiguous.
*
* @param context
* @param busStop
@@ -191,16 +195,27 @@ public class BusRoute {
busStops.add(busStopWanted);
} else {
Log.v(TAG, "stopIndex " + stopIndex);
- int stopWanted = stopIndex + moveAmount; // This will end up as the sequence number of the wanted stop
+ int stopWanted = stopIndex + moveAmount; // This will end up
+ // as the
+ // sequence
+ // number of the
+ // wanted stop
if (stopWanted < 1) {
stopWanted = routeStopsFound.size() - (Math.abs(stopWanted) % routeStopsFound.size());
}
Log.v(TAG, "stopWanted " + stopWanted);
- BusStop wantedBusStop = routeStopsFound.get(stopWanted - 1).busStop; // Need the -1 as sequence starts at 1
+ BusStop wantedBusStop = routeStopsFound.get(stopWanted - 1).busStop; // Need
+ // the
+ // -1
+ // as
+ // sequence
+ // starts
+ // at
+ // 1
busStopDao.refresh(wantedBusStop);
- Log.v(TAG, "Moving backwards " + (-1 * moveAmount) + " stops from " + busStop + " to " + wantedBusStop
- + " in route " + this);
+ Log.v(TAG, "Moving backwards " + (-1 * moveAmount) + " stops from " + busStop + " to "
+ + wantedBusStop + " in route " + this);
busStops.add(wantedBusStop);
}
@@ -379,9 +394,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 > routeStopsFound.size()) {
Log.v(TAG, "Off the end of the route");
@@ -404,8 +418,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;
}