From 8bd684589d2303f25b4545bb5902ef6f46b17582 Mon Sep 17 00:00:00 2001 From: eibakke Date: Thu, 19 Dec 2024 15:49:43 +0100 Subject: [PATCH] Addresses comments in code review. --- .../FindRegularStopsByBoundingBoxRequest.java | 2 +- .../FindRegularStopsByBoundingBoxRequestBuilder.java | 2 +- .../api/request/TripOnServiceDateRequest.java | 4 ++-- .../api/request/TripOnServiceDateRequestBuilder.java | 4 ++-- .../transit/api/request/TripRequest.java | 2 +- .../transit/api/request/TripRequestBuilder.java | 2 +- .../filter/transit/RegularStopMatcherFactory.java | 6 +++--- .../transit/service/TransitService.java | 12 +++++------- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java index d7494b2807b..476e23d7cd8 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequest.java @@ -19,7 +19,7 @@ public class FindRegularStopsByBoundingBoxRequest { private final boolean filterByInUse; - FindRegularStopsByBoundingBoxRequest( + FindRegularStopsByBoundingBoxRequest( Envelope envelope, @Nullable String feedId, boolean filterByInUse diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java index baf6df67df4..49d31c33db9 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/FindRegularStopsByBoundingBoxRequestBuilder.java @@ -12,7 +12,7 @@ public class FindRegularStopsByBoundingBoxRequestBuilder { private boolean filterByInUse = false; - FindRegularStopsByBoundingBoxRequestBuilder(Envelope envelope) { + FindRegularStopsByBoundingBoxRequestBuilder(Envelope envelope) { this.envelope = envelope; } diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java index c61bb8ad107..54dd1c7aea6 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequest.java @@ -23,7 +23,7 @@ public class TripOnServiceDateRequest { private final FilterValues netexInternalPlanningCodes; private final FilterValues alterations; - protected TripOnServiceDateRequest( + TripOnServiceDateRequest( RequiredFilterValues serviceDates, FilterValues agencies, FilterValues routes, @@ -41,7 +41,7 @@ protected TripOnServiceDateRequest( this.alterations = alterations; } - public static TripOnServiceDateRequestBuilder of(RequiredFilterValues serviceDates) { + public static TripOnServiceDateRequestBuilder of(RequiredFilterValues serviceDates) { return new TripOnServiceDateRequestBuilder(serviceDates); } diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java index 534557c15d8..3181819a400 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripOnServiceDateRequestBuilder.java @@ -30,9 +30,9 @@ public class TripOnServiceDateRequestBuilder { "alterations", List.of() ); - private RequiredFilterValues serviceDates; + private final RequiredFilterValues serviceDates; - protected TripOnServiceDateRequestBuilder(RequiredFilterValues serviceDates) { + TripOnServiceDateRequestBuilder(RequiredFilterValues serviceDates) { this.serviceDates = serviceDates; } diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java index c73e800582b..5e05b472937 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequest.java @@ -17,7 +17,7 @@ public class TripRequest { private final FilterValues netexInternalPlanningCodes; private final FilterValues serviceDates; - protected TripRequest( + TripRequest( FilterValues agencies, FilterValues routes, FilterValues netexInternalPlanningCodes, diff --git a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java index 3a2f80a3e34..32ca31d5cd6 100644 --- a/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/api/request/TripRequestBuilder.java @@ -21,7 +21,7 @@ public class TripRequestBuilder { List.of() ); - protected TripRequestBuilder() {} + TripRequestBuilder() {} public TripRequestBuilder withAgencies(FilterValues agencies) { this.agencies = agencies; diff --git a/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java index a9f0132cc15..261e7057d95 100644 --- a/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java +++ b/application/src/main/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactory.java @@ -18,9 +18,9 @@ public class RegularStopMatcherFactory { /** * Creates a matcher that filters {@link RegularStop} objects with the provided {@code request} - * and {@link inUseProvider}. The {@link inUseProvider} is used to determine if a {@link RegularStop} is - * in use. Typically the inUseProvider is a function that checks if the {@link RegularStop} is in - * a set of used stops. + * and {@code inUseProvider}. The {@code inUseProvider} is used to determine if a {@link RegularStop} is + * in use. The inUseProvider is an injected function, because the check is done by the transit service + * which has access to all stops and routes. A stop is used if it has routes visiting the stop. */ public static Matcher of( FindRegularStopsByBoundingBoxRequest request, diff --git a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java index 052e6c6e91d..c423c18d770 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TransitService.java @@ -283,6 +283,7 @@ List findTripTimeOnDate( * So, if more patterns of mode BUS than RAIL visit the group, the result will be [BUS,RAIL]. */ List findTransitModes(StopLocationsGroup station); + /** * For a {@link StopLocation} return its modes. *

@@ -303,15 +304,12 @@ List findTripTimeOnDate( Map getServiceCodesRunningForDate(); /** - * Returns a list of TripOnServiceDates that match the filtering defined in the request. - * - * @param request - A {@link TripOnServiceDateRequest} object with filtering defined. - * @return - A list of {@link TripOnServiceDate}s + * Returns a list of {@link TripOnServiceDate}s that match the filtering defined in the request. */ List findTripsOnServiceDate(TripOnServiceDateRequest request); /** - * Returns a list of Trips that match the filtering defined in the request. + * Returns a list of {@link Trip}s that match the filtering defined in the request. * */ List getTrips(TripRequest request); @@ -325,8 +323,8 @@ List findTripTimeOnDate( boolean containsTrip(FeedScopedId id); /** - * Returns a list of RegularStops that lay within a bounding box and match the other criteria in - * the request object. + * Returns a list of {@link RegularStop}s that lay within a bounding box and match the other criteria + * in the request object. */ Collection findRegularStopsByBoundingBox( FindRegularStopsByBoundingBoxRequest request