Skip to content

Commit

Permalink
Re-use method
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Oct 15, 2024
1 parent 7a9996f commit 09ae95d
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,17 @@ private void removeShortWalkLegs(Itinerary itinerary) {
itinerary.setLegs(transfersRemoved);
}

private boolean isTransferWithinConsolidatedStop(Leg l) {
return isShortWalkLeg(l) &&
service.isPartOfConsolidatedStop(l.getFrom().stop) &&
service.isPartOfConsolidatedStop(l.getTo().stop);
}

private static boolean isShortWalkLeg(Leg leg) {
return leg.isWalkingLeg() &&
leg.getDistanceMeters() < MAX_INTRA_STOP_WALK_DISTANCE_METERS;
}

private boolean isTransferWithinConsolidatedStop(Leg l) {
return (
l.isWalkingLeg() &&
(l.getDistanceMeters() < MAX_INTRA_STOP_WALK_DISTANCE_METERS) &&
service.isPartOfConsolidatedStop(l.getFrom().stop) &&
service.isPartOfConsolidatedStop(l.getTo().stop)
);
}

/**
* Figures out if the from/to stops are part of a consolidated stop group and therefore
* some stops need to be replaced.
Expand Down

0 comments on commit 09ae95d

Please sign in to comment.