Skip to content

Commit

Permalink
rename parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
miklcct committed Nov 13, 2024
1 parent 64d3978 commit d437d66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public DataFetcher<Iterable<Leg>> nextLegs() {
return alternativeLegs(NavigationDirection.NEXT);
}

private DataFetcher<Iterable<Leg>> alternativeLegs(NavigationDirection timeLine) {
private DataFetcher<Iterable<Leg>> alternativeLegs(NavigationDirection direction) {
return environment -> {
if (environment.getSource() instanceof ScheduledTransitLeg originalLeg) {
var args = new GraphQLTypes.GraphQLLegNextLegsArgs(environment.getArguments());
Expand Down Expand Up @@ -321,7 +321,7 @@ private DataFetcher<Iterable<Leg>> alternativeLegs(NavigationDirection timeLine)
environment.getSource(),
numberOfLegs,
environment.<GraphQLRequestContext>getContext().transitService(),
timeLine,
direction,
AlternativeLegsFilter.NO_FILTER,
limitToExactOriginStop,
limitToExactDestinationStop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public static List<ScheduledTransitLeg> getAlternativeLegs(
Leg leg,
Integer numberLegs,
TransitService transitService,
NavigationDirection timeLine,
NavigationDirection direction,
AlternativeLegsFilter filter
) {
return getAlternativeLegs(leg, numberLegs, transitService, timeLine, filter, false, false);
return getAlternativeLegs(leg, numberLegs, transitService, direction, filter, false, false);
}

/**
Expand All @@ -58,7 +58,7 @@ public static List<ScheduledTransitLeg> getAlternativeLegs(
* @param numberLegs The number of alternative legs requested. If fewer legs are found,
* only the found legs are returned.
* @param transitService The transit service used for the search
* @param timeLine Indicating whether the alternative legs should depart before or
* @param direction Indicating whether the alternative legs should depart before or
* after than the original.
* @param filter AlternativeLegsFilter indicating which properties of the original
* leg should not change in the alternative legs
Expand All @@ -73,7 +73,7 @@ public static List<ScheduledTransitLeg> getAlternativeLegs(
Leg leg,
Integer numberLegs,
TransitService transitService,
NavigationDirection timeLine,
NavigationDirection direction,
AlternativeLegsFilter filter,
boolean exactOriginStop,
boolean exactDestinationStop
Expand All @@ -96,7 +96,7 @@ public static List<ScheduledTransitLeg> getAlternativeLegs(
ScheduledTransitLeg::getStartTime
);

if (timeLine == NavigationDirection.PREVIOUS) {
if (direction == NavigationDirection.PREVIOUS) {
legComparator = legComparator.reversed();
}

Expand All @@ -110,7 +110,7 @@ public static List<ScheduledTransitLeg> getAlternativeLegs(
.distinct()
.flatMap(tripPattern -> withBoardingAlightingPositions(origins, destinations, tripPattern))
.flatMap(t ->
generateLegs(transitService, t, leg.getStartTime(), leg.getServiceDate(), timeLine)
generateLegs(transitService, t, leg.getStartTime(), leg.getServiceDate(), direction)
)
.filter(Predicate.not(leg::isPartiallySameTransitLeg))
.sorted(legComparator)
Expand All @@ -127,7 +127,7 @@ private static Stream<ScheduledTransitLeg> generateLegs(
TripPatternBetweenStops tripPatternBetweenStops,
ZonedDateTime departureTime,
LocalDate originalDate,
NavigationDirection timeLine
NavigationDirection direction
) {
TripPattern pattern = tripPatternBetweenStops.tripPattern;
int boardingPosition = tripPatternBetweenStops.positions.boardingPosition;
Expand All @@ -140,7 +140,7 @@ private static Stream<ScheduledTransitLeg> generateLegs(
tts.getServiceDayMidnight() + tts.getRealtimeDeparture()
);

if (timeLine == NavigationDirection.PREVIOUS) {
if (direction == NavigationDirection.PREVIOUS) {
comparator = comparator.reversed();
}

Expand Down Expand Up @@ -170,7 +170,7 @@ private static Stream<ScheduledTransitLeg> generateLegs(
continue;
}

boolean departureTimeInRange = timeLine == NavigationDirection.PREVIOUS
boolean departureTimeInRange = direction == NavigationDirection.PREVIOUS
? tripTimes.getDepartureTime(boardingPosition) <= secondsSinceMidnight
: tripTimes.getDepartureTime(boardingPosition) >= secondsSinceMidnight;

Expand Down

0 comments on commit d437d66

Please sign in to comment.