Skip to content

Commit

Permalink
Don't break rides at every stop
Browse files Browse the repository at this point in the history
HopEdge sequence is never continuous. So, check for board/alight edges
to break a ride.
  • Loading branch information
vesameskanen committed Nov 14, 2018
1 parent 983a2ad commit ad10ab7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ the License, or (at your option) any later version.
import org.opentripplanner.routing.core.FareRuleSet;
import org.opentripplanner.routing.core.State;
import org.opentripplanner.routing.edgetype.HopEdge;
import org.opentripplanner.routing.edgetype.TransitBoardAlight;
import org.opentripplanner.routing.graph.Edge;
import org.opentripplanner.routing.spt.GraphPath;
import org.opentripplanner.routing.impl.DefaultFareServiceImpl;
Expand All @@ -50,10 +51,13 @@ protected List<Ride> createRides(GraphPath path) {
boolean newRide = true;
for (State state : path.states) {
Edge edge = state.getBackEdge();
if (!(edge instanceof HopEdge)) {
if (edge instanceof TransitBoardAlight) {
newRide = true;
continue;
}
if (!(edge instanceof HopEdge)) {
continue;
}
HopEdge hEdge = (HopEdge) edge;
if (newRide == true) {
ride = new Ride();
Expand Down

0 comments on commit ad10ab7

Please sign in to comment.