aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/Timetable.java
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-01-23 22:58:04 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-01-23 22:58:04 +0000
commit591bb6b492edbfcb868ef690c8fc622a5ca2f58e (patch)
treeb6a17353aa84e96e89e743770ba3824099f884d4 /src/net/cbaines/suma/Timetable.java
parent63e1cb8f84d9530066caa4b2bf98a4b691ff830c (diff)
downloadsouthamptonuniversitymap-591bb6b492edbfcb868ef690c8fc622a5ca2f58e.tar
southamptonuniversitymap-591bb6b492edbfcb868ef690c8fc622a5ca2f58e.tar.gz
Refactored BusTimeActivity to BusStopActivity, Fixed issue with Timetables, and Activity rotation. Also added some basic effects to the stop list.
Diffstat (limited to 'src/net/cbaines/suma/Timetable.java')
-rw-r--r--src/net/cbaines/suma/Timetable.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/net/cbaines/suma/Timetable.java b/src/net/cbaines/suma/Timetable.java
index 466bdfe..758c95f 100644
--- a/src/net/cbaines/suma/Timetable.java
+++ b/src/net/cbaines/suma/Timetable.java
@@ -28,4 +28,31 @@ public class Timetable extends ArrayList<Stop> {
*/
private static final long serialVersionUID = -9021303378059511643L;
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (Stop stop : this) {
+ sb.append(stop + "\n");
+ }
+ return sb.toString();
+ }
+
+ public boolean contains(Stop otherStop, boolean toTheMinute) {
+ if (toTheMinute) {
+ for (Stop stop : this) {
+ if (otherStop.bus != null && stop.bus != null && otherStop.bus.equals(stop.bus)) {
+ if (Math.abs(otherStop.arivalTime.getTime() - stop.arivalTime.getTime()) < 60000) {
+ return true;
+ }
+ } else if (otherStop.busStop.equals(stop.busStop)) {
+ if (Math.abs(otherStop.arivalTime.getTime() - stop.arivalTime.getTime()) < 60000) {
+ return true;
+ }
+ }
+ }
+ return false;
+ } else {
+ return this.contains(otherStop);
+ }
+ }
+
}