aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/Stop.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/Stop.java')
-rw-r--r--src/net/cbaines/suma/Stop.java46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/net/cbaines/suma/Stop.java b/src/net/cbaines/suma/Stop.java
index 8e2d466..94fc908 100644
--- a/src/net/cbaines/suma/Stop.java
+++ b/src/net/cbaines/suma/Stop.java
@@ -31,16 +31,10 @@ import android.text.format.DateUtils;
*/
public class Stop {
- public static final String ID_FIELD_NAME = "id";
- public static final String BUS_FIELD_NAME = "bus";
- public static final String BUS_STOP_FIELD_NAME = "busStop";
- public static final String ARIVAL_TIME_FIELD_NAME = "arivalTime";
- public static final String FETCH_TIME_FIELD_NAME = "timeOfFetch";
-
- /**
- * A generated id for the bus
- */
- int id;
+ // public static final String BUS_FIELD_NAME = "bus";
+ // public static final String BUS_STOP_FIELD_NAME = "busStop";
+ // public static final String ARIVAL_TIME_FIELD_NAME = "arivalTime";
+ // public static final String FETCH_TIME_FIELD_NAME = "timeOfFetch";
/**
* The Bus stopping at the stop
@@ -63,17 +57,28 @@ public class Stop {
Date timeOfFetch;
/**
+ * Is the time live, or just expected
+ */
+ boolean live;
+
+ /**
+ * Assumed to be the number of seconds since this data was fetched from the ROMANSE system?
+ */
+ int age;
+
+ /**
*
* @param bus
* @param busStop
* @param arivalTime
* @param timeOfFetch
*/
- public Stop(Bus bus, BusStop busStop, Date arivalTime, Date timeOfFetch) {
+ public Stop(Bus bus, BusStop busStop, Date arivalTime, Date timeOfFetch, boolean live) {
this.busStop = busStop;
this.bus = bus;
this.arivalTime = arivalTime;
this.timeOfFetch = timeOfFetch;
+ this.live = live;
}
/**
@@ -84,7 +89,21 @@ public class Stop {
if (arivalTime.getTime() - System.currentTimeMillis() <= 60000) {
return "Due";
} else {
- return (String) DateUtils.getRelativeTimeSpanString(arivalTime.getTime(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS);
+ return (String) DateUtils.getRelativeTimeSpanString(arivalTime.getTime(), System.currentTimeMillis(),
+ DateUtils.MINUTE_IN_MILLIS);
+ }
+ }
+
+ public String getShortTimeToArival() {
+ if (arivalTime.getTime() - System.currentTimeMillis() <= 60000) {
+ return "Due";
+ } else {
+ String time = (String) DateUtils.getRelativeTimeSpanString(arivalTime.getTime(),
+ System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS);
+ time = time.replace("in ", "");
+ time = time.replace(" minutes", "m");
+ time = time.replace(" minute", "m");
+ return time;
}
}
@@ -95,7 +114,6 @@ public class Stop {
result = prime * result + ((arivalTime == null) ? 0 : arivalTime.hashCode());
result = prime * result + ((bus == null) ? 0 : bus.hashCode());
result = prime * result + ((busStop == null) ? 0 : busStop.hashCode());
- result = prime * result + id;
return result;
}
@@ -132,8 +150,6 @@ public class Stop {
return false;
} else if (!busStop.equals(other.busStop))
return false;
- if (id != other.id)
- return false;
return true;
}