Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TripTimeShort to TripTimeOnDate in method and class names #6042

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
import org.opentripplanner.transit.model.network.TripPattern;
import org.opentripplanner.transit.model.timetable.TripTimes;

public class TripTimeShortHelper {
public class TripTimeOnDateHelper {

/** Utility class with private constructor to prevent instantiation. */
private TripTimeShortHelper() {}
private TripTimeOnDateHelper() {}

/**
* Find trip time short for the from place in transit leg, or null.
*/
@Nullable
public static TripTimeOnDate getTripTimeShortForFromPlace(Leg leg) {
public static TripTimeOnDate getTripTimeOnDateForFromPlace(Leg leg) {
if (!leg.isScheduledTransitLeg()) {
return null;
}
Expand Down Expand Up @@ -49,7 +49,7 @@ public static TripTimeOnDate getTripTimeShortForFromPlace(Leg leg) {
* Find trip time short for the to place in transit leg, or null.
*/
@Nullable
public static TripTimeOnDate getTripTimeShortForToPlace(Leg leg) {
public static TripTimeOnDate getTripTimeOnDateForToPlace(Leg leg) {
if (!leg.isScheduledTransitLeg()) {
return null;
}
Expand Down Expand Up @@ -77,7 +77,7 @@ public static TripTimeOnDate getTripTimeShortForToPlace(Leg leg) {
/**
* Find trip time shorts for all stops for the full trip of a leg.
*/
public static List<TripTimeOnDate> getAllTripTimeShortsForLegsTrip(Leg leg) {
public static List<TripTimeOnDate> getAllTripTimeOnDatesForLegsTrip(Leg leg) {
if (!leg.isScheduledTransitLeg()) {
return List.of();
}
Expand All @@ -96,7 +96,7 @@ public static List<TripTimeOnDate> getAllTripTimeShortsForLegsTrip(Leg leg) {
/**
* Find trip time shorts for all intermediate stops for a leg.
*/
public static List<TripTimeOnDate> getIntermediateTripTimeShortsForLeg(Leg leg) {
public static List<TripTimeOnDate> getIntermediateTripTimeOnDatesForLeg(Leg leg) {
if (!leg.isScheduledTransitLeg()) {
return List.of();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public static Stream<TripTimeOnDate> whiteListAuthoritiesAndOrLines(
if (authorityIds.isEmpty() && lineIds.isEmpty()) {
return stream;
}
return stream.filter(it -> isTripTimeShortAcceptable(it, authorityIds, lineIds));
return stream.filter(it -> isTripTimeOnDateAcceptable(it, authorityIds, lineIds));
}

private static boolean isTripTimeShortAcceptable(
private static boolean isTripTimeOnDateAcceptable(
TripTimeOnDate tts,
Collection<FeedScopedId> authorityIds,
Collection<FeedScopedId> lineIds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.stream.Collectors;
import org.opentripplanner.apis.transmodel.model.EnumTypes;
import org.opentripplanner.apis.transmodel.model.TransmodelTransportSubmode;
import org.opentripplanner.apis.transmodel.model.TripTimeShortHelper;
import org.opentripplanner.apis.transmodel.model.TripTimeOnDateHelper;
import org.opentripplanner.apis.transmodel.support.GqlUtil;
import org.opentripplanner.framework.geometry.EncodedPolyline;
import org.opentripplanner.model.plan.Leg;
Expand Down Expand Up @@ -271,7 +271,7 @@ public static GraphQLObjectType create(
.withDirective(gqlUtil.timingData)
.description("EstimatedCall for the quay where the leg originates.")
.type(estimatedCallType)
.dataFetcher(env -> TripTimeShortHelper.getTripTimeShortForFromPlace(env.getSource()))
.dataFetcher(env -> TripTimeOnDateHelper.getTripTimeOnDateForFromPlace(env.getSource()))
.build()
)
.field(
Expand All @@ -281,7 +281,7 @@ public static GraphQLObjectType create(
.withDirective(gqlUtil.timingData)
.description("EstimatedCall for the quay where the leg ends.")
.type(estimatedCallType)
.dataFetcher(env -> TripTimeShortHelper.getTripTimeShortForToPlace(env.getSource()))
.dataFetcher(env -> TripTimeOnDateHelper.getTripTimeOnDateForToPlace(env.getSource()))
.build()
)
.field(
Expand Down Expand Up @@ -358,7 +358,7 @@ public static GraphQLObjectType create(
)
.type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(estimatedCallType))))
.dataFetcher(env ->
TripTimeShortHelper.getIntermediateTripTimeShortsForLeg(env.getSource())
TripTimeOnDateHelper.getIntermediateTripTimeOnDatesForLeg(env.getSource())
)
.build()
)
Expand All @@ -371,7 +371,8 @@ public static GraphQLObjectType create(
"For ride legs, all estimated calls for the service journey. For non-ride legs, empty list."
)
.type(new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(estimatedCallType))))
.dataFetcher(env -> TripTimeShortHelper.getAllTripTimeShortsForLegsTrip(env.getSource()))
.dataFetcher(env -> TripTimeOnDateHelper.getAllTripTimeOnDatesForLegsTrip(env.getSource())
)
.build()
)
// .field(GraphQLFieldDefinition.newFieldDefinition()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static GraphQLObjectType create(
}

/**
* Resolves all AlertPatches that are relevant for the supplied TripTimeShort.
* Resolves all AlertPatches that are relevant for the supplied TripTimeOnDate.
*/
private static Collection<TransitAlert> getAllRelevantAlerts(
TripTimeOnDate tripTimeOnDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.Optional;
import org.opentripplanner.apis.transmodel.model.EnumTypes;
import org.opentripplanner.apis.transmodel.support.GqlUtil;
import org.opentripplanner.routing.TripTimesShortHelper;
import org.opentripplanner.routing.TripTimeOnDateHelper;
import org.opentripplanner.transit.model.network.TripPattern;
import org.opentripplanner.transit.model.site.StopLocation;
import org.opentripplanner.transit.model.timetable.TripOnServiceDate;
Expand Down Expand Up @@ -149,7 +149,7 @@ public static GraphQLObjectType create(
)
.dataFetcher(environment -> {
TripOnServiceDate tripOnServiceDate = tripOnServiceDate(environment);
return TripTimesShortHelper.getTripTimesShort(
return TripTimeOnDateHelper.getTripTimeOnDates(
GqlUtil.getTransitService(environment),
tripOnServiceDate.getTrip(),
tripOnServiceDate.getServiceDate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.opentripplanner.apis.transmodel.support.GqlUtil;
import org.opentripplanner.framework.geometry.EncodedPolyline;
import org.opentripplanner.model.TripTimeOnDate;
import org.opentripplanner.routing.TripTimesShortHelper;
import org.opentripplanner.routing.TripTimeOnDateHelper;
import org.opentripplanner.transit.model.network.TripPattern;
import org.opentripplanner.transit.model.site.StopLocation;
import org.opentripplanner.transit.model.timetable.Trip;
Expand Down Expand Up @@ -273,7 +273,7 @@ public static GraphQLObjectType create(
.ofNullable(environment.getArgument("date"))
.map(LocalDate.class::cast)
.orElse(LocalDate.now(GqlUtil.getTransitService(environment).getTimeZone()));
return TripTimesShortHelper.getTripTimesShort(
return TripTimeOnDateHelper.getTripTimeOnDates(
GqlUtil.getTransitService(environment),
trip(environment),
serviceDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.opentripplanner.transit.model.network.TripPattern;

/**
* Some stopTimes all in the same pattern. TripTimeShort should probably be renamed StopTimeShort
* Some stopTimes all in the same pattern.
*/
public class StopTimesInPattern {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TripTimesShortHelper {
public class TripTimeOnDateHelper {

private static final Logger LOG = LoggerFactory.getLogger(TripTimesShortHelper.class);
private static final Logger LOG = LoggerFactory.getLogger(TripTimeOnDateHelper.class);

public static List<TripTimeOnDate> getTripTimesShort(
public static List<TripTimeOnDate> getTripTimeOnDates(
TransitService transitService,
Trip trip,
LocalDate serviceDate
Expand All @@ -37,7 +37,7 @@ public static List<TripTimeOnDate> getTripTimesShort(
timetable = transitService.getTimetableForTripPattern(pattern, serviceDate);
}

// This check is made here to avoid changing TripTimeShort.fromTripTimes
// This check is made here to avoid changing TripTimeOnDate.fromTripTimes
TripTimes times = timetable.getTripTimes(trip);
if (
!transitService.getServiceCodesRunningForDate(serviceDate).contains(times.getServiceCode())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static List<StopTimesInPattern> stopTimesForStop(
Collection<TripPattern> patterns = transitService.getPatternsForStop(stop, true);

for (TripPattern pattern : patterns) {
Queue<TripTimeOnDate> pq = listTripTimeShortsForPatternAtStop(
Queue<TripTimeOnDate> pq = listTripTimeOnDatesForPatternAtStop(
transitService,
stop,
pattern,
Expand Down Expand Up @@ -154,7 +154,7 @@ public static List<TripTimeOnDate> stopTimesForPatternAtStop(
ArrivalDeparture arrivalDeparture,
boolean includeCancellations
) {
Queue<TripTimeOnDate> pq = listTripTimeShortsForPatternAtStop(
Queue<TripTimeOnDate> pq = listTripTimeOnDatesForPatternAtStop(
transitService,
stop,
pattern,
Expand Down Expand Up @@ -184,7 +184,7 @@ private static List<StopTimesInPattern> getStopTimesInPattern(
return result;
}

private static Queue<TripTimeOnDate> listTripTimeShortsForPatternAtStop(
private static Queue<TripTimeOnDate> listTripTimeOnDatesForPatternAtStop(
TransitService transitService,
StopLocation stop,
TripPattern pattern,
Expand Down
Loading