Skip to content

Commit

Permalink
Remove walk leg in a stay seated transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
optionsome committed May 23, 2023
1 parent 910ef84 commit d9d7ca0
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public Itinerary createItinerary(RaptorPath<T> path) {
legs.add(transitLeg);
}
// Map transfer leg
else if (pathLeg.isTransferLeg()) {
else if (pathLeg.isTransferLeg() && !staySeatedInTransferFrom(transitLeg)) {
legs.addAll(
mapTransferLeg(
pathLeg.asTransferLeg(),
Expand Down Expand Up @@ -321,4 +321,12 @@ private Place mapPlace(GenericLocation location) {
private ZonedDateTime createZonedDateTime(int timeInSeconds) {
return transitSearchTimeZero.plusSeconds(timeInSeconds);
}

private boolean staySeatedInTransferFrom(Leg transitLeg) {
return (
transitLeg != null &&
transitLeg.getTransferToNextLeg() != null &&
transitLeg.getTransferToNextLeg().getTransferConstraint().isStaySeated()
);
}
}

0 comments on commit d9d7ca0

Please sign in to comment.