-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStop.java
More file actions
48 lines (35 loc) · 1.13 KB
/
Copy pathStop.java
File metadata and controls
48 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
public class Stop implements Comparable<Stop>{
Time time;
int stopID;
int tripID;
// Should I ignore stopName until end? and search file for the stopID?
public Stop(int stopID, int tripID, String time) {
this.stopID = stopID;
this.tripID = tripID;
String[] time1 = time.split(":");
this.time = new Time(Integer.valueOf(time1[0]), Integer.valueOf(time1[1]), Integer.valueOf(time1[2]));
}
// returns true if this stop's trip ID is larger, false otherwise
public boolean isTripIDLarger(Stop stop) {
if (this.tripID > stop.tripID) {
return true;
}
return false;
}
public boolean isTimeEqual(Stop stop) {
if (this.time.isEqual(stop.time)) {
return true;
}
return false;
}
// returns true if time is valid
public boolean isTimeValid() {
return time.isValid();
}
public void displayStopInfo() {
System.out.println(tripID + ", " + this.time.returnTime() + ", " + stopID);
}
public int compareTo(Stop stop) {
return this.tripID - stop.tripID;
}
}