findTransitModes(StopLocationsGroup station);
+
/**
* For a {@link StopLocation} return its modes.
*
@@ -307,18 +309,13 @@ List findTripTimeOnDate(
Map getServiceCodesRunningForDate();
/**
- * Returns a list of TripOnServiceDates that match the filtering defined in the request.
- *
- * @param request - A TripOnServiceDateRequest object with filtering defined.
- * @return - A list of TripOnServiceDates
+ * 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.
*
- * @param request - A TripRequest object with filtering defined.
- * @return - A list of Trips
*/
List getTrips(TripRequest request);
@@ -329,4 +326,12 @@ List findTripTimeOnDate(
* @return true if the trip exists, false otherwise
*/
boolean containsTrip(FeedScopedId id);
+
+ /**
+ * 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
+ );
}
diff --git a/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
index b76f28649a4..6834d375bf1 100644
--- a/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
+++ b/application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
@@ -702,7 +702,7 @@ type QueryType {
quays(ids: [String], name: String): [Quay]! @timingData
"Get all quays within the specified bounding box"
quaysByBbox(
- authority: String,
+ authority: String @deprecated(reason : "This is the Transmodel namespace or the GTFS feedID - avoid using this. Request a new field if necessary."),
"If true only quays with at least one visiting line are included."
filterByInUse: Boolean = false,
maximumLatitude: Float!,
diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java
index 43dd10dbdce..17193ad02c1 100644
--- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java
+++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java
@@ -65,7 +65,7 @@ class LegacyRouteRequestMapperTest implements PlanTestConstants {
new DefaultVehicleRentalService(),
new DefaultVehicleParkingService(new DefaultVehicleParkingRepository()),
new DefaultRealtimeVehicleService(transitService),
- GraphFinder.getInstance(graph, transitService::findRegularStops),
+ GraphFinder.getInstance(graph, transitService::findRegularStopsByBoundingBox),
new RouteRequest()
);
}
diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java
index 34cb865c81a..925e5009e77 100644
--- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java
+++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/RouteRequestMapperTest.java
@@ -75,7 +75,7 @@ class RouteRequestMapperTest {
new DefaultVehicleRentalService(),
new DefaultVehicleParkingService(new DefaultVehicleParkingRepository()),
new DefaultRealtimeVehicleService(transitService),
- GraphFinder.getInstance(graph, transitService::findRegularStops),
+ GraphFinder.getInstance(graph, transitService::findRegularStopsByBoundingBox),
new RouteRequest()
);
}
diff --git a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java
index ab897e3410b..48363a98c88 100644
--- a/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java
+++ b/application/src/test/java/org/opentripplanner/routing/graph/DefaultRoutingServiceTest.java
@@ -115,7 +115,7 @@ public void testSpatialIndex() {
SphericalDistanceLibrary.metersToLonDegrees(100, stopJ.getLat()),
SphericalDistanceLibrary.metersToDegrees(100)
);
- Collection stops = transitService.findRegularStops(env);
+ Collection stops = transitService.findRegularStopsByBoundingBox(env);
assertTrue(stops.contains(stopJ));
assertTrue(stops.contains(stopL));
assertTrue(stops.contains(stopM));
diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java
new file mode 100644
index 00000000000..ef93df53dbd
--- /dev/null
+++ b/application/src/test/java/org/opentripplanner/transit/model/filter/expr/GenericUnaryMatcherTest.java
@@ -0,0 +1,15 @@
+package org.opentripplanner.transit.model.filter.expr;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import org.junit.jupiter.api.Test;
+
+class GenericUnaryMatcherTest {
+
+ @Test
+ void testMatches() {
+ var matcher = new GenericUnaryMatcher<>("int", i -> i.equals(42));
+ assertTrue(matcher.match(42));
+ assertFalse(matcher.match(43));
+ }
+}
diff --git a/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java
new file mode 100644
index 00000000000..5cfeaf2780f
--- /dev/null
+++ b/application/src/test/java/org/opentripplanner/transit/model/filter/transit/RegularStopMatcherFactoryTest.java
@@ -0,0 +1,44 @@
+package org.opentripplanner.transit.model.filter.transit;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.opentripplanner.transit.model.framework.FeedScopedId;
+import org.opentripplanner.transit.model.site.RegularStop;
+
+class RegularStopMatcherFactoryTest {
+
+ private static RegularStop stop1;
+ private static RegularStop stop2;
+
+ @BeforeAll
+ static void setup() {
+ stop1 =
+ RegularStop
+ .of(new FeedScopedId("agency", "stopId"), new AtomicInteger()::getAndIncrement)
+ .build();
+
+ stop2 =
+ RegularStop
+ .of(new FeedScopedId("otherAgency", "otherStopId"), new AtomicInteger()::getAndIncrement)
+ .build();
+ }
+
+ @Test
+ void testFeedIds() {
+ var matcher = RegularStopMatcherFactory.feedId("agency");
+ assertTrue(matcher.match(stop1));
+ assertFalse(matcher.match(stop2));
+ }
+
+ @Test
+ void testInUseMatcher() {
+ var matcher = RegularStopMatcherFactory.inUseMatcher(stop ->
+ stop.getId().getFeedId().equals("agency")
+ );
+ assertTrue(matcher.match(stop1));
+ assertFalse(matcher.match(stop2));
+ }
+}
From 1ebb855a9f3c0ed6c3eb68cc2ff418050b051389 Mon Sep 17 00:00:00 2001
From: OTP Changelog Bot
Date: Tue, 7 Jan 2025 14:00:06 +0000
Subject: [PATCH 4/5] Add changelog entry for #6234 [ci skip]
---
doc/user/Changelog.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/user/Changelog.md b/doc/user/Changelog.md
index 3dc3f018f9a..b859f87f19a 100644
--- a/doc/user/Changelog.md
+++ b/doc/user/Changelog.md
@@ -69,6 +69,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Make flex linking work together with boarding locations [#6311](https://github.com/opentripplanner/OpenTripPlanner/pull/6311)
- Add fallback name for corridors [#6303](https://github.com/opentripplanner/OpenTripPlanner/pull/6303)
- Implement SIRI Lite [#6284](https://github.com/opentripplanner/OpenTripPlanner/pull/6284)
+- Add a matcher API for filters in the transit service used for regularStop lookup [#6234](https://github.com/opentripplanner/OpenTripPlanner/pull/6234)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)
## 2.6.0 (2024-09-18)
From f8b51d954dae8f06369e5133484b531736150089 Mon Sep 17 00:00:00 2001
From: Leonard Ehrenfried
Date: Wed, 8 Jan 2025 12:11:08 +0100
Subject: [PATCH 5/5] Fix spelling of SIRI [ci skip]
---
mkdocs.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkdocs.yml b/mkdocs.yml
index 51245f6c3b8..0ebcb7ddd4d 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -91,7 +91,7 @@ nav:
- "Stop Area Relations": 'StopAreas.md'
- "Street Graph Pruning": 'IslandPruning.md'
- Accessibility: 'Accessibility.md'
- - NeTex and Siri compatibility: 'features-explained/Netex-Siri-Compatibility.md'
+ - NeTEx and SIRI compatibility: 'features-explained/Netex-Siri-Compatibility.md'
- "Travel Time Analysis": 'Analysis.md'
- "Logging": "Logging.md"
- Development: