Skip to content

Commit b5a15d9

Browse files
committed
Issue #1. Added special node classes for arrival and departure.
1 parent fe8cc66 commit b5a15d9

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

core/src/main/java/org/hisrc/gtfs/graph/builder/jgrapht/GtfsDirectedGraphBuilder.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.HashSet;
44
import java.util.Set;
55

6+
import org.hisrc.gtfs.graph.model.TemporalStopArrivalNode;
7+
import org.hisrc.gtfs.graph.model.TemporalStopDepartureNode;
68
import org.hisrc.gtfs.graph.model.TemporalStopNode;
79
import org.hisrc.gtfs.graph.model.TransitionEdge;
810
import org.hisrc.gtfs.graph.model.TransitionType;
@@ -100,10 +102,10 @@ public void addStopTime(StopTime stopTime) {
100102
final int arrivalTime = stopTime.getArrivalTime();
101103
final int departureTime = stopTime.getDepartureTime();
102104

103-
final TemporalStopNode arrivalNode = new TemporalStopNode(stop,
104-
arrivalTime, false);
105-
final TemporalStopNode departureNode = new TemporalStopNode(stop,
106-
departureTime, true);
105+
final TemporalStopNode arrivalNode = new TemporalStopArrivalNode(stop,
106+
arrivalTime);
107+
final TemporalStopNode departureNode = new TemporalStopDepartureNode(
108+
stop, departureTime);
107109
graph.addVertex(arrivalNode);
108110
graph.addVertex(departureNode);
109111

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.hisrc.gtfs.graph.model;
2+
3+
import org.onebusaway.gtfs.model.Stop;
4+
5+
public class TemporalStopArrivalNode extends TemporalStopNode {
6+
7+
public TemporalStopArrivalNode(Stop stop, int time) {
8+
super(stop, time);
9+
}
10+
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.hisrc.gtfs.graph.model;
2+
3+
import org.onebusaway.gtfs.model.Stop;
4+
5+
public class TemporalStopDepartureNode extends TemporalStopNode {
6+
7+
public TemporalStopDepartureNode(Stop stop, int time) {
8+
super(stop, time);
9+
}
10+
11+
}

core/src/main/java/org/hisrc/gtfs/graph/model/TemporalStopNode.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22

33
import org.onebusaway.gtfs.model.Stop;
44

5-
public class TemporalStopNode {
5+
public abstract class TemporalStopNode {
66

77
// Reference to the stop
88
private final Stop stop;
99
// Time point
1010
private final int time;
11-
// Whether this is a starting point for the routing
12-
private final boolean departure;
1311

14-
public TemporalStopNode(Stop stop, int time, boolean departure) {
12+
public TemporalStopNode(Stop stop, int time) {
1513
super();
1614
this.stop = stop;
1715
this.time = time;
18-
this.departure = departure;
1916
}
2017

2118
public Stop getStop() {
@@ -28,6 +25,6 @@ public int getTime() {
2825

2926
@Override
3027
public String toString() {
31-
return stop + "@" + time;
28+
return "(Arrival" + stop + "@" + time + ")";
3229
}
3330
}

0 commit comments

Comments
 (0)