diff --git a/application/pom.xml b/application/pom.xml index 73738e772d8..3fc0193d0af 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -23,6 +23,11 @@ otp-utils ${project.version} + + ${project.groupId} + otp-raptor + ${project.version} + diff --git a/application/src/ext/java/org/opentripplanner/ext/sorlandsbanen/CoachCostCalculator.java b/application/src/ext/java/org/opentripplanner/ext/sorlandsbanen/CoachCostCalculator.java index 89a3071f975..ba4830f29cf 100644 --- a/application/src/ext/java/org/opentripplanner/ext/sorlandsbanen/CoachCostCalculator.java +++ b/application/src/ext/java/org/opentripplanner/ext/sorlandsbanen/CoachCostCalculator.java @@ -1,10 +1,10 @@ package org.opentripplanner.ext.sorlandsbanen; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.transit.model.basic.TransitMode; diff --git a/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java b/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java index f707b97c131..5ff936f3118 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java +++ b/application/src/main/java/org/opentripplanner/model/plan/Itinerary.java @@ -17,8 +17,8 @@ import org.opentripplanner.model.SystemNotice; import org.opentripplanner.model.fare.ItineraryFares; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.path.PathStringBuilder; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.preference.ItineraryFilterPreferences; import org.opentripplanner.utils.lang.DoubleUtils; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java index a81dd4e7083..3819500e605 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapper.java @@ -1,6 +1,6 @@ package org.opentripplanner.routing.algorithm.mapping; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toOtpDomainCost; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toOtpDomainCost; import java.time.ZonedDateTime; import java.util.ArrayList; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java index 3f68d91321e..584e690d3ee 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/DefaultAccessEgress.java @@ -3,7 +3,7 @@ import java.util.Objects; import org.opentripplanner.framework.model.TimeAndCost; import org.opentripplanner.raptor.api.model.RaptorConstants; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.street.search.state.State; /** diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java index 175c782ab22..7a6e6568bb4 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/Transfer.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.Optional; import org.locationtech.jts.geom.Coordinate; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransfer; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.api.request.preference.WalkPreferences; import org.opentripplanner.street.model.edge.Edge; import org.opentripplanner.street.search.request.StreetSearchRequest; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java index 43faa3f0c40..1d4827a4ef6 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculator.java @@ -3,6 +3,7 @@ import javax.annotation.Nullable; import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java index 152f199248c..9fac19cd940 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/IndexBasedFactorStrategy.java @@ -1,6 +1,7 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; import java.util.Arrays; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; /** * This class keep a facto for each index and the minimum factor for fast retrieval during Raptor diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java index b636b26bebe..f231acf9270 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunction.java @@ -2,6 +2,7 @@ import java.util.Objects; import org.opentripplanner.framework.model.Cost; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.routing.api.request.framework.LinearFunctionSerialization; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java index 59cf04eb2db..3e5b868afdb 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/SingleValueFactorStrategy.java @@ -1,5 +1,7 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; + /** * This {@link FactorStrategy} keep a single value and use it every time the factor is needed. The * {@link #minFactor()} return the same value. diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java index d68d2230a5c..693cac45031 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculator.java @@ -1,6 +1,7 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; import org.opentripplanner.routing.api.request.preference.AccessibilityPreferences; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java index 1074724a90c..ff0855f0128 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapper.java @@ -12,6 +12,7 @@ import org.opentripplanner.raptor.api.model.GeneralizedCostRelaxFunction; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RelaxFunction; import org.opentripplanner.raptor.api.request.DebugRequestBuilder; @@ -22,7 +23,6 @@ import org.opentripplanner.raptor.api.request.RaptorViaLocation; import org.opentripplanner.raptor.rangeraptor.SystemErrDebugLogger; import org.opentripplanner.routing.algorithm.raptoradapter.router.performance.PerformanceTimersForRaptor; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.api.request.DebugEventType; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java index b0d2b009a0f..a056efe87df 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapper.java @@ -13,13 +13,13 @@ import java.util.Set; import javax.annotation.Nullable; import org.opentripplanner.framework.application.OTPFeature; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate; import org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.ConstrainedTransfersForPatterns; import org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.TransferIndexGenerator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.RaptorRequestTransferCache; import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopTransferPriority; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java index a5336999b09..ee33f1d86c3 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TransferWaitTimeCostCalculator.java @@ -1,6 +1,6 @@ package org.opentripplanner.routing.algorithm.transferoptimization.model; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; /** * This calculator uses the {@code minSafeTransferTime}(t0) and an inverse log function to calculate diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java deleted file mode 100644 index 970ae42a3ef..00000000000 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/D02_TransitModeReluctanceTest.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.opentripplanner.raptor.moduletests; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor._data.api.PathUtils.pathsToString; -import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; - -import java.util.stream.Stream; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor.RaptorService; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; -import org.opentripplanner.raptor.api.request.RaptorProfile; -import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; -import org.opentripplanner.raptor.configure.RaptorConfig; -import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; -import org.opentripplanner.raptor.moduletests.support.RaptorModuleTestConfig; - -/** - * FEATURE UNDER TEST - *

- * Raptor should return transit option with the lowest cost when to rides are equal, but have - * different transit-reluctance. - */ -public class D02_TransitModeReluctanceTest implements RaptorTestConstants { - - public static final double[] PREFER_R1 = { 0.99, 1.0 }; - public static final double[] PREFER_R2 = { 0.9, 0.89 }; - private final TestTransitData data = new TestTransitData(); - private final RaptorRequestBuilder requestBuilder = new RaptorRequestBuilder<>(); - private final RaptorService raptorService = new RaptorService<>( - RaptorConfig.defaultConfigForTest() - ); - - @BeforeEach - public void setup() { - // Given 2 identical routes R1 and R2 - data.withRoute( - route(pattern("R1", STOP_A, STOP_B)) - .withTimetable(schedule("00:01, 00:02:40").transitReluctanceIndex(0)) - ); - data.withRoute( - route(pattern("R2", STOP_A, STOP_B)) - .withTimetable(schedule("00:01, 00:02:40").transitReluctanceIndex(1)) - ); - - requestBuilder - .searchParams() - .addAccessPaths(TestAccessEgress.walk(STOP_A, D30s)) - .addEgressPaths(TestAccessEgress.walk(STOP_B, D20s)) - .earliestDepartureTime(T00_00) - .latestArrivalTime(T00_10) - .timetable(true); - - requestBuilder.profile(RaptorProfile.MULTI_CRITERIA); - - ModuleTestDebugLogging.setupDebugLogging(data, requestBuilder); - } - - static Stream testCases() { - return RaptorModuleTestConfig - .multiCriteria() - .build() - .stream() - .flatMap(config -> - Stream.of( - Arguments.of( - PREFER_R1, - config, - "Walk 30s ~ A ~ BUS R1 0:01 0:02:40 ~ B ~ Walk 20s " + "[0:00:30 0:03 2m30s Tₓ0 C₁799]" - ), - Arguments.of( - PREFER_R2, - config, - "Walk 30s ~ A ~ BUS R2 0:01 0:02:40 ~ B ~ Walk 20s " + "[0:00:30 0:03 2m30s Tₓ0 C₁789]" - ) - ) - ); - } - - @ParameterizedTest(name = "Transit reluctance [R1, R2]: {0}, profile: {1}") - @MethodSource("testCases") - void testTransitReluctance( - double[] transitReluctance, - RaptorModuleTestConfig testConfig, - String expected - ) { - data.mcCostParamsBuilder().transitReluctanceFactors(transitReluctance); - var request = testConfig.apply(requestBuilder).build(); - var response = raptorService.route(request, data); - assertEquals(expected, pathsToString(response)); - } -} diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java b/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java deleted file mode 100644 index 4a7aac19e01..00000000000 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/D03_UnpreferredRouteTest.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.opentripplanner.raptor.moduletests; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor._data.api.PathUtils.pathsToString; -import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; - -import java.util.BitSet; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor.RaptorService; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; -import org.opentripplanner.raptor.api.request.RaptorProfile; -import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; -import org.opentripplanner.raptor.configure.RaptorConfig; -import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; -import org.opentripplanner.routing.api.request.framework.CostLinearFunction; -import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; -import org.opentripplanner.transit.model.framework.FeedScopedId; - -/** - * FEATURE UNDER TEST - *

- * On transit options with identical cost, raptor should drop the unpreferred one which is modeled - * by route penalty. - */ -public class D03_UnpreferredRouteTest implements RaptorTestConstants { - - private static final String EXPECTED = - "Walk 30s ~ A ~ BUS %s 0:01 0:02:40 ~ B ~ Walk 20s " + "[0:00:30 0:03 2m30s Tₓ0 C₁%d]"; - private static final FeedScopedId ROUTE_ID_1 = TimetableRepositoryForTest.id("1"); - private static final FeedScopedId ROUTE_ID_2 = TimetableRepositoryForTest.id("2"); - private static final CostLinearFunction UNPREFERRED_C1 = CostLinearFunction.of("5m + 1t"); - private final TestTransitData data = new TestTransitData(); - private final RaptorRequestBuilder requestBuilder = new RaptorRequestBuilder<>(); - private final RaptorService raptorService = new RaptorService<>( - RaptorConfig.defaultConfigForTest() - ); - - @BeforeEach - public void setup() { - // Given 2 identical routes R1 and R2 - data.withRoute( - route( - pattern("R1", STOP_A, STOP_B) - .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_1).build()) - ) - .withTimetable(schedule("00:01, 00:02:40")) - ); - data.withRoute( - route( - pattern("R2", STOP_A, STOP_B) - .withRoute(TimetableRepositoryForTest.route(ROUTE_ID_2).build()) - ) - .withTimetable(schedule("00:01, 00:02:40")) - ); - - requestBuilder - .searchParams() - .addAccessPaths(TestAccessEgress.walk(STOP_A, D30s)) - .addEgressPaths(TestAccessEgress.walk(STOP_B, D20s)) - .earliestDepartureTime(T00_00) - .latestArrivalTime(T00_10) - .timetable(true); - - requestBuilder.profile(RaptorProfile.MULTI_CRITERIA); - - ModuleTestDebugLogging.setupDebugLogging(data, requestBuilder); - } - - @Test - public void unpreferR1() { - unpreferRoute(ROUTE_ID_1); - - var request = requestBuilder.build(); - var response = raptorService.route(request, data); - - // Verify R1 is preferred and the cost is correct - assertEquals(expected("R2", 800), pathsToString(response)); - } - - @Test - public void unpreferR2() { - unpreferRoute(ROUTE_ID_2); - - var request = requestBuilder.build(); - var response = raptorService.route(request, data); - - assertEquals(expected("R1", 800), pathsToString(response)); - } - - private void unpreferRoute(FeedScopedId routeId) { - final BitSet patterns = new BitSet(); - for (var pattern : data.getPatterns()) { - if (pattern.route().getId().equals(routeId)) { - patterns.set(pattern.patternIndex()); - } - } - data.mcCostParamsBuilder().unpreferredPatterns(patterns); - data.mcCostParamsBuilder().unpreferredCost(UNPREFERRED_C1); - } - - private static String expected(String route, int cost) { - return String.format(EXPECTED, route, cost); - } -} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/RaptorTestConstants.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/RaptorTestConstants.java new file mode 100644 index 00000000000..88a6b97bb75 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/RaptorTestConstants.java @@ -0,0 +1,92 @@ +package org.opentripplanner.raptorlegacy._data; + +import static org.opentripplanner.utils.time.DurationUtils.durationInSeconds; +import static org.opentripplanner.utils.time.TimeUtils.hm2time; + +import org.opentripplanner.raptor.spi.DefaultSlackProvider; +import org.opentripplanner.raptor.spi.RaptorSlackProvider; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public interface RaptorTestConstants { + // Time duration(D) constants, all values are in seconds + int D0s = 0; + int D1s = 1; + int D10s = 10; + int D11s = 11; + int D20s = 20; + int D30s = 30; + int D40s = 40; + int D1m = durationInSeconds("1m"); + int D2m = durationInSeconds("2m"); + int D3m = durationInSeconds("3m"); + int D4m = durationInSeconds("4m"); + int D5m = durationInSeconds("5m"); + int D7m = durationInSeconds("7m"); + int D8m = durationInSeconds("8m"); + int D10m = durationInSeconds("10m"); + int D11m = durationInSeconds("11m"); + int D20m = durationInSeconds("20m"); + int D24h = durationInSeconds("24h"); + + /** + * There are 86400 seconds in a "normal" day(24 * 60 * 60). + */ + int SECONDS_IN_A_DAY = (int) D24h; + + // Time constants, all values are in seconds + int T00_00 = hm2time(0, 0); + int T00_02 = hm2time(0, 2); + int T00_10 = hm2time(0, 10); + int T00_30 = hm2time(0, 30); + int T00_40 = hm2time(0, 40); + int T01_00 = hm2time(1, 0); + + int TX_0 = 0; + int TX_1 = 1; + int TX_2 = 2; + + // Stop indexes - Note! There is no stop defined for index 0(zero)! You must + // account for that in the test if you use the stop index. + int STOP_A = 1; + int STOP_B = 2; + int STOP_C = 3; + int STOP_D = 4; + int STOP_E = 5; + int STOP_F = 6; + int STOP_G = 7; + int STOP_H = 8; + int STOP_I = 9; + int STOP_J = 10; + int STOP_K = 11; + int STOP_L = 12; + int STOP_M = 13; + + int NUM_STOPS = 14; + + // Stop position in pattern + int STOP_POS_0 = 0; + int STOP_POS_1 = 1; + + // Slack + int BOARD_SLACK = 45; + int ALIGHT_SLACK = 15; + int TRANSFER_SLACK = 60; + + RaptorSlackProvider SLACK_PROVIDER = new DefaultSlackProvider( + TRANSFER_SLACK, + BOARD_SLACK, + ALIGHT_SLACK + ); + + // FLEX + int ONE_RIDE = 1; + int TWO_RIDES = 2; + + default String stopIndexToName(int index) { + return Character.toString('A' + index - 1); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/PathUtils.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/PathUtils.java new file mode 100644 index 00000000000..15e16217fa2 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/PathUtils.java @@ -0,0 +1,61 @@ +package org.opentripplanner.raptorlegacy._data.api; + +import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.opentripplanner.raptor.api.path.RaptorPath; +import org.opentripplanner.raptor.api.response.RaptorResponse; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; + +/** + * This utility help converting a Raptor path to a string which is used in several unit tests for + * easy comparison. The Stop index(1..n) is translated to stop names(A..N) using {@link + * RaptorTestConstants#stopIndexToName(int)}. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class PathUtils { + + private static final RaptorTestConstants TRANSLATOR = new RaptorTestConstants() {}; + + /** Util class, private constructor */ + private PathUtils() {} + + public static String pathsToString(RaptorResponse response) { + return pathsToString(response.paths()); + } + + public static String pathsToString(Collection> paths) { + return pathsToString(paths, p -> p.toString(TRANSLATOR::stopIndexToName)); + } + + public static String pathsToStringDetailed(RaptorResponse response) { + return pathsToStringDetailed(response.paths()); + } + + public static String pathsToStringDetailed(Collection> paths) { + return pathsToString(paths, p -> p.toStringDetailed(TRANSLATOR::stopIndexToName)); + } + + public static String join(String... paths) { + return String.join("\n", paths); + } + + public static String withoutCost(String path) { + return path.replaceAll(" C₁[\\d_]+", ""); + } + + public static String[] withoutCost(String... paths) { + return Stream.of(paths).map(path -> withoutCost(path)).toList().toArray(new String[0]); + } + + public static String pathsToString( + Collection> paths, + Function, String> mapToStr + ) { + return paths.stream().sorted().map(mapToStr).collect(Collectors.joining("\n")); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilder.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilder.java new file mode 100644 index 00000000000..a7fe2f9f3c8 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilder.java @@ -0,0 +1,157 @@ +package org.opentripplanner.raptorlegacy._data.api; + +import static org.opentripplanner.raptor.rangeraptor.transit.TripTimesSearch.findTripTimes; + +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; +import org.opentripplanner.raptor.api.path.RaptorPath; +import org.opentripplanner.raptor.path.PathBuilder; +import org.opentripplanner.raptor.spi.DefaultSlackProvider; +import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptor.spi.RaptorSlackProvider; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; + +/** + * Utility to help build paths for testing. The path builder is "reusable", every time the {@code + * access(...)} methods are called the builder reset it self. + *

+ * If the {@code costCalculator} is null, paths will not include cost. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class TestPathBuilder implements RaptorTestConstants { + + private static final int BOARD_ALIGHT_OFFSET = 30; + + @Nullable + private final RaptorCostCalculator costCalculator; + + private final RaptorSlackProvider slackProvider; + private PathBuilder builder; + private int startTime; + private int c2 = RaptorConstants.NOT_SET; + + public TestPathBuilder( + RaptorSlackProvider slackProvider, + @Nullable RaptorCostCalculator costCalculator + ) { + this.slackProvider = slackProvider; + this.costCalculator = costCalculator; + } + + /** + * Uses the slacks in {@link RaptorTestConstants}. + */ + public TestPathBuilder(@Nullable RaptorCostCalculator costCalculator) { + this(new DefaultSlackProvider(TRANSFER_SLACK, BOARD_SLACK, ALIGHT_SLACK), costCalculator); + } + + /** Assign c2 value for path. TODO: Add c2 value for each leg. */ + public TestPathBuilder c2(int c2) { + this.c2 = c2; + return this; + } + + /** + * Create access starting at the fixed given {@code starting}. Opening hours is used to enforce + * the access start time and prevent time-shifting it. + */ + public TestPathBuilder access(int startTime, int toStop, int duration) { + return access(startTime, TestAccessEgress.walk(toStop, duration)); + } + + /** Same as {@link #access(int, int, int)} , but with a free access - duration is 0s. */ + public TestPathBuilder access(int startTime, int toStop) { + return access(startTime, TestAccessEgress.free(toStop)); + } + + /** + * Create access with the given {@code startTime}, but allow the access to be time-shifted + * according to the opening hours of the given {@code transfer}. + */ + private TestPathBuilder access(int startTime, TestAccessEgress transfer) { + reset(startTime); + builder.access(transfer); + return this; + } + + public TestPathBuilder walk(int duration, int toStop) { + return walk(TestTransfer.transfer(toStop, duration)); + } + + public TestPathBuilder walk(int duration, int toStop, int cost) { + return walk(TestTransfer.transfer(toStop, duration, cost)); + } + + public TestPathBuilder walk(TestTransfer transfer) { + builder.transfer(transfer, transfer.stop()); + return this; + } + + public TestPathBuilder bus(TestTripSchedule trip, int alightStop) { + int boardStop = currentStop(); + // We use the startTime as earliest-board-time, this may cause problems for + // testing routes visiting the same stop more than once. Create a new factory + // method if this happens. + var baTime = findTripTimes(trip, boardStop, alightStop, startTime); + builder.transit(trip, baTime); + return this; + } + + public TestPathBuilder bus(String patternName, int fromTime, int duration, int toStop) { + int toTime = fromTime + duration; + int fromStop = currentStop(); + + TestTripSchedule trip = TestTripSchedule + .schedule(TestTripPattern.pattern(patternName, fromStop, toStop)) + .arrDepOffset(BOARD_ALIGHT_OFFSET) + .departures(fromTime, toTime + BOARD_ALIGHT_OFFSET) + .build(); + + return bus(trip, toStop); + } + + public RaptorPath egress(int duration) { + return egress( + duration == 0 + ? TestAccessEgress.free(currentStop()) + : TestAccessEgress.walk(currentStop(), duration) + ); + } + + public PathBuilder access(TestAccessEgress access) { + builder.access(access); + return builder; + } + + public RaptorPath egress(TestAccessEgress egress) { + builder.egress(egress); + builder.c2(c2); + return builder.build(); + } + + /* private methods */ + + int currentStop() { + return builder.tail().toStop(); + } + + private void reset(int startTime) { + this.startTime = startTime; + this.builder = + PathBuilder.tailPathBuilder( + slackProvider, + startTime, + costCalculator, + RaptorStopNameResolver.nullSafe(null), + null + ); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilderTestRaptor.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilderTestRaptor.java new file mode 100644 index 00000000000..e68bf7ad7cf --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/api/TestPathBuilderTestRaptor.java @@ -0,0 +1,99 @@ +package org.opentripplanner.raptorlegacy._data.api; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.model.transfer.TransferConstraint.REGULAR_TRANSFER; +import static org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; +import static org.opentripplanner.utils.time.DurationUtils.durationInSeconds; +import static org.opentripplanner.utils.time.TimeUtils.time; + +import org.junit.jupiter.api.Test; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; + +/** + * Test the PathBuilder to be sure that it works properly before using it in other tests. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class TestPathBuilderTestRaptor implements RaptorTestConstants { + + private final TestPathBuilder subject = new TestPathBuilder(C1_CALCULATOR); + + @Test + public void testSimplePathWithOneTransit() { + int transitDuration = durationInSeconds("5m"); + + var path = subject + .access(time("10:00:15"), STOP_A, D1m) + .bus("L1", time("10:02"), transitDuration, STOP_B) + .egress(D2m); + + var transitLeg = path.accessLeg().nextLeg().asTransitLeg(); + int boardCost = C1_CALCULATOR.boardingCost( + true, + path.accessLeg().toTime(), + STOP_A, + transitLeg.fromTime(), + transitLeg.trip(), + REGULAR_TRANSFER + ); + + int transitCost = C1_CALCULATOR.transitArrivalCost( + boardCost, + ALIGHT_SLACK, + transitDuration, + BasicPathTestCase.TRIP_1, + STOP_B + ); + + int accessEgressCost = C1_CALCULATOR.costEgress(TestAccessEgress.walk(STOP_B, D2m + D1m)); + + assertEquals(accessEgressCost + transitCost, path.c1()); + assertEquals( + "Walk 1m 10:00:15 10:01:15 C₁120 ~ A 45s " + + "~ BUS L1 10:02 10:07 5m C₁438 ~ B 15s " + + "~ Walk 2m 10:07:15 10:09:15 C₁210 " + + "[10:00:15 10:09:15 9m Tₓ0 C₁768]", + path.toStringDetailed(this::stopIndexToName) + ); + } + + @Test + public void testBasicPath() { + var path = subject + .c2(7) + .access(BasicPathTestCase.ACCESS_START, STOP_A, BasicPathTestCase.ACCESS_DURATION) + .bus( + BasicPathTestCase.LINE_11, + BasicPathTestCase.L11_START, + BasicPathTestCase.L11_DURATION, + STOP_B + ) + .walk(BasicPathTestCase.TX_DURATION, STOP_C, BasicPathTestCase.TX_C1) + .bus( + BasicPathTestCase.LINE_21, + BasicPathTestCase.L21_START, + BasicPathTestCase.L21_DURATION, + STOP_D + ) + .bus( + BasicPathTestCase.LINE_31, + BasicPathTestCase.L31_START, + BasicPathTestCase.L31_DURATION, + STOP_E + ) + .egress(BasicPathTestCase.EGRESS_DURATION); + + assertEquals(BasicPathTestCase.BASIC_PATH_AS_STRING, path.toString(this::stopIndexToName)); + assertEquals( + BasicPathTestCase.BASIC_PATH_AS_DETAILED_STRING, + path.toStringDetailed(this::stopIndexToName) + ); + assertEquals(BasicPathTestCase.TOTAL_C1, path.c1()); + assertTrue(path.isC2Set()); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/AbstractStopArrival.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/AbstractStopArrival.java new file mode 100644 index 00000000000..bb4edf3a6a7 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/AbstractStopArrival.java @@ -0,0 +1,85 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +abstract class AbstractStopArrival implements ArrivalView { + + private final int round; + private final int stop; + private final int arrivalTime; + private final int c1; + private final int c2; + private final ArrivalView previous; + + AbstractStopArrival( + int round, + int stop, + int arrivalTime, + int extraCost, + int c2, + ArrivalView previous + ) { + this.round = round; + this.stop = stop; + this.arrivalTime = arrivalTime; + this.previous = previous; + this.c2 = c2; + + if (previous == null) { + this.c1 = extraCost; + } else { + this.c1 = previous.c1() + extraCost; + } + } + + AbstractStopArrival( + int round, + int stop, + int arrivalTime, + int extraCost, + ArrivalView previous + ) { + this(round, stop, arrivalTime, extraCost, previous.c2(), previous); + } + + @Override + public int stop() { + return stop; + } + + @Override + public int round() { + return round; + } + + @Override + public int arrivalTime() { + return arrivalTime; + } + + @Override + public int c1() { + return c1; + } + + @Override + public int c2() { + return c2; + } + + @Override + public ArrivalView previous() { + return previous; + } + + @Override + public String toString() { + return asString(); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Access.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Access.java new file mode 100644 index 00000000000..bb2fa1f481b --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Access.java @@ -0,0 +1,37 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import static org.opentripplanner.raptor.api.model.PathLegType.ACCESS; + +import org.opentripplanner.raptor.api.model.PathLegType; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.view.AccessPathView; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +class Access extends AbstractStopArrival { + + private final RaptorAccessEgress access; + + Access(int stop, int arrivalTime, RaptorAccessEgress path, int c2) { + super(0, stop, arrivalTime, path.c1(), c2, null); + this.access = path; + } + + @Override + public PathLegType arrivedBy() { + return ACCESS; + } + + @Override + public AccessPathView accessPath() { + return () -> access; + } + + @Override + public boolean arrivedOnBoard() { + return access.stopReachedOnBoard(); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/BasicPathTestCase.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/BasicPathTestCase.java new file mode 100644 index 00000000000..0130625784b --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/BasicPathTestCase.java @@ -0,0 +1,462 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.model.transfer.TransferConstraint.REGULAR_TRANSFER; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.utils.time.DurationUtils.durationToStr; +import static org.opentripplanner.utils.time.TimeUtils.time; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorTransfer; +import org.opentripplanner.raptor.api.path.AccessPathLeg; +import org.opentripplanner.raptor.api.path.EgressPathLeg; +import org.opentripplanner.raptor.api.path.PathLeg; +import org.opentripplanner.raptor.api.path.RaptorPath; +import org.opentripplanner.raptor.api.path.TransferPathLeg; +import org.opentripplanner.raptor.api.path.TransitPathLeg; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.path.Path; +import org.opentripplanner.raptor.rangeraptor.internalapi.WorkerLifeCycle; +import org.opentripplanner.raptor.rangeraptor.lifecycle.LifeCycleSubscriptions; +import org.opentripplanner.raptor.rangeraptor.path.DestinationArrival; +import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; +import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; + +/** + * This class is used to create a journeys with stop arrivals. + *

+ * It creates different data structures representing the same 'basic' trip to be used in + * unit-tests: + *

+ *   ~
+ *   Origin 10:00:15
+ *   ~ Walk 3m ~ A
+ *   ~ BUS L11 10:04 10:35 ~ B
+ *   ~ Walk 3m45s ~ C
+ *   ~ BUS L21 11:00 11:23 ~ D
+ *   ~ BUS L31 11:40 11:52 ~ E
+ *   ~ Walk 7m45s
+ *   ~ Destination 12:00
+ *
+ *   Duration: 1h59m45s
+ *   Transfers: 2
+ *   Generalized-cost: $8154
+ * 
+ * The Trip has 2 transfers, 1 connected by walking and without. The trip start at 10:00 and ends at + * 12:00, total 2 hours. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class BasicPathTestCase implements RaptorTestConstants { + + private static final RaptorConstrainedTransfer EMPTY_CONSTRAINTS = null; + + public static final String BASIC_PATH_AS_DETAILED_STRING = + "Walk 3m 10:00:15 10:03:15 C₁360 " + + "~ A 45s ~ " + + "BUS L11 10:04 10:35 31m C₁1_998 " + + "~ B 15s ~ " + + "Walk 3m45s 10:35:15 10:39 C₁450 " + + "~ C 21m ~ " + + "BUS L21 11:00 11:23 23m C₁2_640 " + + "~ D 17m ~ " + + "BUS L31 11:40 11:52 12m C₁1_776 " + + "~ E 15s ~ " + + "Walk 7m45s 11:52:15 12:00 C₁930 " + + "[10:00:15 12:00 1h59m45s Tₓ2 C₁8_154 C₂7]"; + + public static final String BASIC_PATH_AS_STRING = + "Walk 3m ~ A" + + " ~ BUS L11 10:04 10:35 ~ B" + + " ~ Walk 3m45s ~ C" + + " ~ BUS L21 11:00 11:23 ~ D" + + " ~ BUS L31 11:40 11:52 ~ E" + + " ~ Walk 7m45s " + + "[10:00:15 12:00 1h59m45s Tₓ2 C₁8_154 C₂7]"; + + private static final int BOARD_C1_SEC = 60; + private static final int TRANSFER_C1_SEC = 120; + private static final double[] TRANSIT_RELUCTANCE = new double[] { 1.0 }; + public static final int TRANSIT_RELUCTANCE_INDEX = 0; + public static final double WAIT_RELUCTANCE = 0.8; + private static final int C2 = 7; + + /** Stop cost for stop NA, A, C, E .. H is zero(0), B: 30s, and D: 60s. ?=0, A=1 .. H=8 */ + private static final int[] STOP_C1S = { 0, 0, 3_000, 0, 6_000, 0, 0, 0, 0, 0 }; + + // Some times which should not have eny effect on tests + private static final int VERY_EARLY = time("00:00"); + private static final int VERY_LATE = time("23:59"); + + public static final int RAPTOR_ITERATION_START_TIME = time("09:00"); + + // Access (Walk 3m15s ~ A) + public static final int ACCESS_START = time("10:00:15"); + public static final int ACCESS_END = time("10:03:15"); + public static final int ACCESS_DURATION = ACCESS_END - ACCESS_START; + public static final RaptorAccessEgress ACCESS_TRANSFER = TestAccessEgress.walk( + STOP_A, + ACCESS_DURATION + ); + public static final int ACCESS_C1 = ACCESS_TRANSFER.c1(); + public static final int ACCESS_C2 = 0; + + // Trip 1 (A ~ BUS L11 10:04 10:35 ~ B) + public static final int L11_START = time("10:04"); + private static final int L11_END = time("10:35"); + public static final int L11_DURATION = L11_END - L11_START; + private static final int L11_WAIT_DURATION = L11_START - ACCESS_END + ALIGHT_SLACK; + public static final int LINE_11_C1 = + STOP_C1S[STOP_A] + + STOP_C1S[STOP_B] + + toRaptorCost(BOARD_C1_SEC + WAIT_RELUCTANCE * L11_WAIT_DURATION + L11_DURATION); + public static final int LINE_11_C2 = 2; + + // Transfers (B ~ Walk 3m45s ~ C) + private static final int TX_START = time("10:35:15"); + private static final int TX_END = time("10:39:00"); + public static final int TX_DURATION = TX_END - TX_START; + public static final RaptorTransfer TX_TRANSFER = TestTransfer.transfer(STOP_C, TX_DURATION); + public static final int TX_C1 = TX_TRANSFER.c1(); + public static final int TX_C3 = 3; + + // Trip 2 (C ~ BUS L21 11:00 11:23 ~ D) + public static final int L21_START = time("11:00"); + private static final int L21_END = time("11:23"); + public static final int L21_DURATION = L21_END - L21_START; + private static final int L21_WAIT_DURATION = L21_START - TX_END + ALIGHT_SLACK; + public static final int LINE_21_C1 = + STOP_C1S[STOP_C] + + STOP_C1S[STOP_D] + + toRaptorCost( + BOARD_C1_SEC + TRANSFER_C1_SEC + WAIT_RELUCTANCE * L21_WAIT_DURATION + L21_DURATION + ); + public static final int LINE_21_C2 = 5; + + // Trip 3 (D ~ BUS L31 11:40 11:52 ~ E) + public static final int L31_START = time("11:40"); + private static final int L31_END = time("11:52"); + public static final int L31_DURATION = L31_END - L31_START; + private static final int L31_WAIT_DURATION = L31_START - (L21_END + ALIGHT_SLACK) + ALIGHT_SLACK; + public static final int LINE_31_C1 = + STOP_C1S[STOP_D] + + STOP_C1S[STOP_E] + + toRaptorCost( + BOARD_C1_SEC + TRANSFER_C1_SEC + WAIT_RELUCTANCE * L31_WAIT_DURATION + L31_DURATION + ); + public static final int LINE_31_C2 = 6; + + // Egress (E ~ Walk 7m45s ~ ) + public static final int EGRESS_START = time("11:52:15"); + public static final int EGRESS_END = time("12:00"); + public static final int EGRESS_DURATION = EGRESS_END - EGRESS_START; + public static final RaptorAccessEgress EGRESS_TRANSFER = TestAccessEgress.walk( + STOP_E, + EGRESS_DURATION + ); + public static final int EGRESS_C1 = EGRESS_TRANSFER.c1(); + public static final int EGRESS_C2 = 7; + + public static final int TRIP_DURATION = EGRESS_END - ACCESS_START; + + private static final RaptorAccessEgress ACCESS = TestAccessEgress.walk( + STOP_A, + ACCESS_DURATION, + ACCESS_C1 + ); + private static final RaptorAccessEgress EGRESS = TestAccessEgress.walk( + STOP_E, + EGRESS_DURATION, + EGRESS_C1 + ); + // this is of course not a real flex egress + private static final RaptorAccessEgress FLEX = TestAccessEgress.flexWithOnBoard( + STOP_E, + EGRESS_DURATION, + EGRESS_C1 + ); + + public static final String LINE_11 = "L11"; + public static final String LINE_21 = "L21"; + public static final String LINE_31 = "L31"; + + public static final TestTripSchedule TRIP_1 = TestTripSchedule + .schedule(TestTripPattern.pattern(LINE_11, STOP_A, STOP_B)) + .times(L11_START, L11_END) + .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) + .build(); + + public static final TestTripSchedule TRIP_2 = TestTripSchedule + .schedule(TestTripPattern.pattern(LINE_21, STOP_C, STOP_D)) + .times(L21_START, L21_END) + .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) + .build(); + + public static final TestTripSchedule TRIP_3 = TestTripSchedule + .schedule(TestTripPattern.pattern(LINE_31, STOP_D, STOP_E)) + // The early arrival and late departure should not have any effect on tests + .arrivals(VERY_EARLY, L31_END) + .departures(L31_START, VERY_LATE) + .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) + .build(); + + public static final RaptorCostCalculator C1_CALCULATOR = new DefaultCostCalculator<>( + BOARD_C1_SEC, + TRANSFER_C1_SEC, + WAIT_RELUCTANCE, + TRANSIT_RELUCTANCE, + STOP_C1S + ); + + public static final int TOTAL_C1 = + ACCESS_C1 + LINE_11_C1 + TX_C1 + LINE_21_C1 + LINE_31_C1 + EGRESS_C1; + + /** Wait time between trip L11 and L21 including slack */ + public static final int WAIT_TIME_L11_L21 = L21_START - L11_END - TX_DURATION; + + /** Wait time between trip L21 and L31 including slack */ + public static final int WAIT_TIME_L21_L31 = L31_START - L21_END; + + public static WorkerLifeCycle lifeCycle() { + return new LifeCycleSubscriptions(); + } + + public static DestinationArrival basicTripByForwardSearch() { + ArrivalView prevArrival, egress; + prevArrival = TestArrivals.access(STOP_A, ACCESS_START, ACCESS_END, ACCESS_C1, ACCESS_C2); + prevArrival = TestArrivals.bus(1, STOP_B, L11_END, LINE_11_C1, LINE_11_C2, TRIP_1, prevArrival); + prevArrival = TestArrivals.transfer(1, STOP_C, TX_START, TX_END, TX_C1, prevArrival); + prevArrival = TestArrivals.bus(2, STOP_D, L21_END, LINE_21_C1, LINE_21_C2, TRIP_2, prevArrival); + prevArrival = TestArrivals.bus(3, STOP_E, L31_END, LINE_31_C1, LINE_31_C2, TRIP_3, prevArrival); + egress = TestArrivals.egress(EGRESS_START, EGRESS_END, EGRESS_C1, EGRESS_C2, prevArrival); + return new DestinationArrival<>( + egress.egressPath().egress(), + egress.previous(), + egress.arrivalTime(), + egress.egressPath().egress().c1(), + egress.c2() + ); + } + + /** + * This is the same itinerary as {@link #basicTripByForwardSearch()}, as found by a reverse + * search: + */ + public static DestinationArrival basicTripByReverseSearch() { + ArrivalView nextArrival, egress; + nextArrival = TestArrivals.access(STOP_E, EGRESS_END, EGRESS_START, EGRESS_C1, EGRESS_C2); + // Board slack is subtracted from the arrival time to get the latest possible + nextArrival = + TestArrivals.bus(1, STOP_D, L31_START, LINE_31_C1, LINE_31_C2, TRIP_3, nextArrival); + nextArrival = + TestArrivals.bus(2, STOP_C, L21_START, LINE_21_C1, LINE_21_C2, TRIP_2, nextArrival); + nextArrival = TestArrivals.transfer(2, STOP_B, TX_END, TX_START, TX_C1, nextArrival); + nextArrival = + TestArrivals.bus(3, STOP_A, L11_START, LINE_11_C1, LINE_11_C2, TRIP_1, nextArrival); + egress = TestArrivals.egress(ACCESS_END, ACCESS_START, ACCESS_C1, ACCESS_C2, nextArrival); + return new DestinationArrival<>( + egress.egressPath().egress(), + egress.previous(), + egress.arrivalTime(), + egress.egressPath().egress().c1(), + egress.c2() + ); + } + + /** + * Both {@link #basicTripByForwardSearch()} and {@link #basicTripByReverseSearch()} should return + * the same trip, here returned as a path. + */ + public static RaptorPath basicTripAsPath() { + PathLeg leg6 = new EgressPathLeg<>( + EGRESS, + EGRESS_START, + EGRESS_END, + EGRESS_C1 + ); + TransitPathLeg leg5 = new TransitPathLeg<>( + TRIP_3, + L31_START, + L31_END, + TRIP_3.findDepartureStopPosition(L31_START, STOP_D), + TRIP_3.findArrivalStopPosition(L31_END, STOP_E), + EMPTY_CONSTRAINTS, + LINE_31_C1, + leg6 + ); + TransitPathLeg leg4 = new TransitPathLeg<>( + TRIP_2, + L21_START, + L21_END, + TRIP_2.findDepartureStopPosition(L21_START, STOP_C), + TRIP_2.findArrivalStopPosition(L21_END, STOP_D), + EMPTY_CONSTRAINTS, + LINE_21_C1, + leg5 + ); + var transfer = TestTransfer.transfer(STOP_C, TX_END - TX_START); + PathLeg leg3 = new TransferPathLeg<>( + STOP_B, + TX_START, + TX_END, + transfer.c1(), + transfer, + leg4.asTransitLeg() + ); + var leg2 = new TransitPathLeg<>( + TRIP_1, + L11_START, + L11_END, + TRIP_1.findDepartureStopPosition(L11_START, STOP_A), + TRIP_1.findArrivalStopPosition(L11_END, STOP_B), + EMPTY_CONSTRAINTS, + LINE_11_C1, + leg3 + ); + AccessPathLeg leg1 = new AccessPathLeg<>( + ACCESS, + ACCESS_START, + ACCESS_END, + ACCESS_C1, + leg2.asTransitLeg() + ); + return new Path<>(RAPTOR_ITERATION_START_TIME, leg1, TOTAL_C1, 7); + } + + public static RaptorPath flexTripAsPath() { + PathLeg leg6 = new EgressPathLeg<>(FLEX, EGRESS_START, EGRESS_END, EGRESS_C1); + var transfer = TestTransfer.transfer(STOP_E, TX_END - TX_START); + PathLeg leg3 = new TransferPathLeg<>( + STOP_B, + TX_START, + TX_END, + transfer.c1(), + transfer, + leg6 + ); + var leg2 = new TransitPathLeg<>( + TRIP_1, + L11_START, + L11_END, + TRIP_1.findDepartureStopPosition(L11_START, STOP_A), + TRIP_1.findArrivalStopPosition(L11_END, STOP_B), + EMPTY_CONSTRAINTS, + LINE_11_C1, + leg3 + ); + AccessPathLeg leg1 = new AccessPathLeg<>( + ACCESS, + ACCESS_START, + ACCESS_END, + ACCESS_C1, + leg2.asTransitLeg() + ); + return new Path<>(RAPTOR_ITERATION_START_TIME, leg1, TOTAL_C1, C2); + } + + public static List basicTripStops() { + return Arrays.asList(STOP_A, STOP_B, STOP_C, STOP_D, STOP_E); + } + + @Test + public void testSetup() { + // Assert test data is configured correct + assertEquals(ACCESS_END + BOARD_SLACK, L11_START); + assertEquals(BOARD_SLACK + ALIGHT_SLACK, L11_WAIT_DURATION); + assertEquals(L31_END + ALIGHT_SLACK, EGRESS_START); + assertEquals( + durationToStr(TRIP_DURATION), + durationToStr( + ACCESS_DURATION + + L11_DURATION + + L11_WAIT_DURATION + + TX_DURATION + + L21_DURATION + + L21_WAIT_DURATION + + L31_DURATION + + L31_WAIT_DURATION + + EGRESS_DURATION + ), + "Access: " + + durationToStr(ACCESS_DURATION) + + ", Line 11: " + + durationToStr(L11_DURATION) + + " (wait " + + durationToStr(L11_WAIT_DURATION) + + ")" + + ", Tx: " + + durationToStr(TX_DURATION) + + ", Line 21: " + + durationToStr(L21_DURATION) + + " (wait " + + durationToStr(L21_WAIT_DURATION) + + ")" + + ", Line 31: " + + durationToStr(L31_DURATION) + + " (wait " + + durationToStr(L31_WAIT_DURATION) + + ")" + + ", Egress: " + + durationToStr(EGRESS_DURATION) + ); + + // The calculator is not under test here, so we assert everything is as expected + assertEquals( + LINE_11_C1, + transitArrivalCost(ACCESS_END, TRIP_1, STOP_A, L11_START, STOP_B, L11_END) + ); + assertEquals( + LINE_21_C1, + transitArrivalCost(TX_END, TRIP_2, STOP_C, L21_START, STOP_D, L21_END) + ); + assertEquals( + LINE_31_C1, + transitArrivalCost(L21_END + ALIGHT_SLACK, TRIP_3, STOP_D, L31_START, STOP_E, L31_END) + ); + + assertEquals(BASIC_PATH_AS_STRING, basicTripAsPath().toString(this::stopIndexToName)); + + assertEquals( + BASIC_PATH_AS_DETAILED_STRING, + basicTripAsPath().toStringDetailed(this::stopIndexToName) + ); + } + + private static int transitArrivalCost( + int prevArrivalTime, + TestTripSchedule trip, + int boardStop, + int boardTime, + int alightStop, + int alightTime + ) { + boolean firstTransit = TRIP_1 == trip; + int boardCost = C1_CALCULATOR.boardingCost( + firstTransit, + prevArrivalTime, + boardStop, + boardTime, + trip, + REGULAR_TRANSFER + ); + + return C1_CALCULATOR.transitArrivalCost( + boardCost, + ALIGHT_SLACK, + alightTime - boardTime, + trip, + alightStop + ); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Egress.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Egress.java new file mode 100644 index 00000000000..9b781b0beb0 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Egress.java @@ -0,0 +1,54 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import org.opentripplanner.raptor.api.model.PathLegType; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.api.view.EgressPathView; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; +import org.opentripplanner.utils.time.TimeUtils; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class Egress extends AbstractStopArrival { + + private final RaptorAccessEgress egressPath; + + public Egress( + int arrivalTime, + RaptorAccessEgress egressPath, + int c2, + ArrivalView previous + ) { + super(previous.round(), previous.stop(), arrivalTime, egressPath.c1(), c2, previous); + this.egressPath = egressPath; + } + + @Override + public EgressPathView egressPath() { + return () -> egressPath; + } + + @Override + public String toString() { + return String.format( + "Egress { round: %d, stop: %d, arrival-time: %s $%d }", + round(), + stop(), + TimeUtils.timeToStrCompact(arrivalTime()), + c1() + ); + } + + @Override + public PathLegType arrivedBy() { + return PathLegType.EGRESS; + } + + @Override + public boolean arrivedOnBoard() { + return egressPath.stopReachedOnBoard(); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/FlexAccessAndEgressPathTestCase.java similarity index 90% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/FlexAccessAndEgressPathTestCase.java index 51639ecc72d..99dd81ebbb7 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/FlexAccessAndEgressPathTestCase.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/FlexAccessAndEgressPathTestCase.java @@ -1,28 +1,26 @@ -package org.opentripplanner.raptor._data.stoparrival; +package org.opentripplanner.raptorlegacy._data.stoparrival; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.access; -import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.bus; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; import static org.opentripplanner.raptor.api.model.RaptorValueFormatter.formatC1; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost; import static org.opentripplanner.utils.time.DurationUtils.durationInSeconds; import static org.opentripplanner.utils.time.TimeUtils.time; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestTransfer; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.view.ArrivalView; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrival; import org.opentripplanner.raptor.spi.DefaultSlackProvider; import org.opentripplanner.raptor.spi.RaptorSlackProvider; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.utils.time.TimeUtils; /** @@ -44,7 +42,11 @@ *
  • Walk transfer
  • *
  • Flex
  • * + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. */ +@Deprecated public class FlexAccessAndEgressPathTestCase implements RaptorTestConstants { private static final int ZERO = 0; @@ -292,19 +294,19 @@ private static DestinationArrival flexForwardSearch( if (LINE_A.equals(line)) { // The latest time the access can arrive is the same as the TX1 arrival time in case B arrivalTime = accessPath.latestArrivalTime(TX1_END); - prevArrival = access(accessPath.stop(), arrivalTime, accessPath); + prevArrival = TestArrivals.access(accessPath.stop(), arrivalTime, accessPath); int waitCost = costL1ForwardIncWait(prevArrival.arrivalTime()); - prevArrival = bus(2, STOP_D, L1_STOP_ARR_TIME, waitCost, 0, TRIP_A, prevArrival); + prevArrival = TestArrivals.bus(2, STOP_D, L1_STOP_ARR_TIME, waitCost, 0, TRIP_A, prevArrival); } else { arrivalTime = accessPath.latestArrivalTime(TX1_START); - prevArrival = access(accessPath.stop(), arrivalTime, accessPath); + prevArrival = TestArrivals.access(accessPath.stop(), arrivalTime, accessPath); int timeShift = TX1_START - prevArrival.arrivalTime(); prevArrival = new Transfer(1, TX1_END - timeShift, TX1_TRANSFER, prevArrival); int waitCost = costL1ForwardIncWait(prevArrival.arrivalTime()); - prevArrival = bus(2, STOP_C, L1_STOP_ARR_TIME, waitCost, 0, TRIP_B, prevArrival); + prevArrival = TestArrivals.bus(2, STOP_C, L1_STOP_ARR_TIME, waitCost, 0, TRIP_B, prevArrival); prevArrival = new Transfer(2, TX2_END, TX2_TRANSFER, prevArrival); } @@ -338,18 +340,18 @@ private static DestinationArrival flexReverseSearch( if (LINE_A.equals(line)) { arrivalTime = L1_END + ALIGHT_SLACK + TRANSFER_SLACK; arrivalTime = egressPath.earliestDepartureTime(arrivalTime); - prevArrival = access(egressPath.stop(), arrivalTime, egressPath); + prevArrival = TestArrivals.access(egressPath.stop(), arrivalTime, egressPath); cost = costL1ReverseIncWait(prevArrival.arrivalTime()); - prevArrival = bus(2, STOP_A, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_A, prevArrival); + prevArrival = TestArrivals.bus(2, STOP_A, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_A, prevArrival); } else { arrivalTime = L1_END + ALIGHT_SLACK + TX2_DURATION + TRANSFER_SLACK; arrivalTime = egressPath.earliestDepartureTime(arrivalTime); - prevArrival = access(egressPath.stop(), arrivalTime, egressPath); + prevArrival = TestArrivals.access(egressPath.stop(), arrivalTime, egressPath); arrivalTime = prevArrival.arrivalTime() - TX2_DURATION; prevArrival = new Transfer(1, arrivalTime, TX2_TRANSFER_REV, prevArrival); cost = costL1ReverseIncWait(prevArrival.arrivalTime()); - prevArrival = bus(2, STOP_B, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_B, prevArrival); + prevArrival = TestArrivals.bus(2, STOP_B, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_B, prevArrival); arrivalTime = prevArrival.arrivalTime() - TX1_DURATION; prevArrival = new Transfer(2, arrivalTime, TX1_TRANSFER_REV, prevArrival); } diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/TestArrivals.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/TestArrivals.java new file mode 100644 index 00000000000..4ea0398efa4 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/TestArrivals.java @@ -0,0 +1,110 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorTransfer; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class TestArrivals { + + public static ArrivalView access( + int stop, + int arrivalTime, + RaptorAccessEgress path, + int c2 + ) { + return new Access(stop, arrivalTime, path, c2); + } + + public static ArrivalView access( + int stop, + int arrivalTime, + RaptorAccessEgress path + ) { + return access(stop, arrivalTime, path, RaptorConstants.NOT_SET); + } + + public static ArrivalView access( + int stop, + int departureTime, + int arrivalTime, + int c1, + int c2 + ) { + return access( + stop, + arrivalTime, + TestAccessEgress.walk(stop, Math.abs(arrivalTime - departureTime), c1), + c2 + ); + } + + public static ArrivalView access( + int stop, + int departureTime, + int arrivalTime, + int c1 + ) { + return access(stop, departureTime, arrivalTime, c1, RaptorConstants.NOT_SET); + } + + public static ArrivalView transfer( + int round, + int arrivalTime, + RaptorTransfer transfer, + ArrivalView previous + ) { + return new Transfer(round, arrivalTime, transfer, previous); + } + + public static ArrivalView transfer( + int round, + int stop, + int departureTime, + int arrivalTime, + int extraCost, + ArrivalView previous + ) { + return transfer( + round, + arrivalTime, + TestTransfer.transfer(stop, Math.abs(arrivalTime - departureTime), extraCost), + previous + ); + } + + public static ArrivalView bus( + int round, + int stop, + int arrivalTime, + int c1, + int c2, + TestTripSchedule trip, + ArrivalView previous + ) { + return new Transit(round, stop, arrivalTime, c1, c2, trip, previous); + } + + public static ArrivalView egress( + int departureTime, + int arrivalTime, + int c1, + int c2, + ArrivalView previous + ) { + return new Egress( + departureTime, + TestAccessEgress.walk(previous.stop(), Math.abs(arrivalTime - departureTime), c1), + c2, + previous + ); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transfer.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transfer.java new file mode 100644 index 00000000000..56363c4fdde --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transfer.java @@ -0,0 +1,43 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import static org.opentripplanner.raptor.api.model.PathLegType.TRANSFER; + +import org.opentripplanner.raptor.api.model.PathLegType; +import org.opentripplanner.raptor.api.model.RaptorTransfer; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; + +/* + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +class Transfer extends AbstractStopArrival { + + private final RaptorTransfer transfer; + + Transfer( + int round, + int arrivalTime, + RaptorTransfer transfer, + ArrivalView previous + ) { + super(round, transfer.stop(), arrivalTime, transfer.c1(), previous.c2(), previous); + this.transfer = transfer; + } + + @Override + public PathLegType arrivedBy() { + return TRANSFER; + } + + @Override + public RaptorTransfer transfer() { + return transfer; + } + + @Override + public boolean arrivedOnBoard() { + return false; + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transit.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transit.java new file mode 100644 index 00000000000..5de1cdbd4dc --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/stoparrival/Transit.java @@ -0,0 +1,57 @@ +package org.opentripplanner.raptorlegacy._data.stoparrival; + +import static org.opentripplanner.raptor.api.model.PathLegType.TRANSIT; + +import org.opentripplanner.raptor.api.model.PathLegType; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.api.view.TransitPathView; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; + +/** + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +class Transit extends AbstractStopArrival implements TransitPathView { + + private final TestTripSchedule trip; + + Transit( + int round, + int stop, + int arrivalTime, + int c1, + int c2, + TestTripSchedule trip, + ArrivalView previous + ) { + super(round, stop, arrivalTime, c1, c2, previous); + this.trip = trip; + } + + @Override + public PathLegType arrivedBy() { + return TRANSIT; + } + + @Override + public TransitPathView transitPath() { + return this; + } + + @Override + public int boardStop() { + return previous().stop(); + } + + @Override + public TestTripSchedule trip() { + return trip; + } + + @Override + public boolean arrivedOnBoard() { + return true; + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestAccessEgress.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestAccessEgress.java new file mode 100644 index 00000000000..6fb26c22dfb --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestAccessEgress.java @@ -0,0 +1,365 @@ +package org.opentripplanner.raptorlegacy._data.transit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptorlegacy._data.RaptorTestConstants.SECONDS_IN_A_DAY; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.utils.time.TimeUtils; + +/** + * Simple implementation for {@link RaptorAccessEgress} for use in unit-tests. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class TestAccessEgress implements RaptorAccessEgress { + + public static final int DEFAULT_NUMBER_OF_RIDES = 0; + public static final boolean STOP_REACHED_ON_BOARD = true; + public static final boolean STOP_REACHED_ON_FOOT = false; + public static final double DEFAULT_WALK_RELUCTANCE = 2.0; + + private final int stop; + private final int durationInSeconds; + private final int c1; + private final int numberOfRides; + private final boolean stopReachedOnBoard; + private final boolean free; + private final Integer opening; + private final Integer closing; + private final boolean closed; + private final int timePenalty; + + private TestAccessEgress(Builder builder) { + this.stop = builder.stop; + this.durationInSeconds = builder.durationInSeconds; + this.numberOfRides = builder.numberOfRides; + this.stopReachedOnBoard = builder.stopReachedOnBoard; + this.free = builder.free; + this.opening = builder.opening; + this.closing = builder.closing; + this.closed = builder.closed; + this.timePenalty = builder.timePenalty; + this.c1 = builder.c1; + + if (free) { + assertEquals(0, durationInSeconds); + } else { + assertTrue(durationInSeconds > 0); + } + if (closed) { + assertNull(opening); + assertNull(closing); + } + assertTrue(numberOfRides >= 0); + } + + public static TestAccessEgress free(int stop) { + return new Builder(stop, 0).withFree().build(); + } + + /** + * @deprecated A stop cannot be both free and have a cost - This is not a valid + * access/egress. + */ + @Deprecated + public static TestAccessEgress free(int stop, int cost) { + return new Builder(stop, 0).withFree().withCost(cost).build(); + } + + public static TestAccessEgress walk(int stop, int durationInSeconds) { + return new Builder(stop, durationInSeconds).build(); + } + + public static TestAccessEgress walk(int stop, int durationInSeconds, double walkReluctance) { + return walk(stop, durationInSeconds, walkCost(durationInSeconds, walkReluctance)); + } + + public static TestAccessEgress walk(int stop, int durationInSeconds, int cost) { + return new Builder(stop, durationInSeconds).withCost(cost).build(); + } + + public static TestAccessEgress flexWithOnBoard(int stop, int durationInSeconds, int cost) { + return new Builder(stop, durationInSeconds) + .withCost(cost) + .withNRides(1) + .stopReachedOnBoard() + .build(); + } + + /** Create a new flex access and arrive stop onBoard with 1 ride/extra transfer. */ + public static TestAccessEgress flex(int stop, int durationInSeconds) { + return flex(stop, durationInSeconds, 1, walkCost(durationInSeconds)); + } + + /** Create a new flex access and arrive stop onBoard with 1 ride/extra transfer. */ + public static TestAccessEgress flex(int stop, int durationInSeconds, int nRides) { + return flex(stop, durationInSeconds, nRides, walkCost(durationInSeconds)); + } + + /** Create a new flex access and arrive stop onBoard. */ + public static TestAccessEgress flex(int stop, int durationInSeconds, int nRides, int cost) { + assert nRides > DEFAULT_NUMBER_OF_RIDES; + return new Builder(stop, durationInSeconds) + .stopReachedOnBoard() + .withNRides(nRides) + .withCost(cost) + .build(); + } + + /** Create a flex access arriving at given stop by walking with 1 ride/extra transfer. */ + public static TestAccessEgress flexAndWalk(int stop, int durationInSeconds) { + return flexAndWalk(stop, durationInSeconds, 1, walkCost(durationInSeconds)); + } + + /** Create a flex access arriving at given stop by walking with 1 ride/extra transfer. */ + public static TestAccessEgress flexAndWalk(int stop, int durationInSeconds, int nRides) { + return flexAndWalk(stop, durationInSeconds, nRides, walkCost(durationInSeconds)); + } + + /** Create a flex access arriving at given stop by walking. */ + public static TestAccessEgress flexAndWalk( + int stop, + int durationInSeconds, + int nRides, + int cost + ) { + assert nRides > DEFAULT_NUMBER_OF_RIDES; + return new Builder(stop, durationInSeconds).withNRides(nRides).withCost(cost).build(); + } + + public static Collection transfers(int... stopTimes) { + List legs = new ArrayList<>(); + for (int i = 0; i < stopTimes.length; i += 2) { + legs.add(walk(stopTimes[i], stopTimes[i + 1])); + } + return legs; + } + + public static int walkCost(int durationInSeconds) { + return walkCost(durationInSeconds, DEFAULT_WALK_RELUCTANCE); + } + + public static int walkCost(int durationInSeconds, double reluctance) { + return toRaptorCost(durationInSeconds * reluctance); + } + + /** + * Add opening and closing hours and return a new object. + *

    + * Opening and closing is specified as seconds since the start of "RAPTOR time" to limit the + * time periods that the access is traversable, which is repeatead every 24 hours. This allows + * access to only be traversable between given times like 08:00 and 16:00 every day. + */ + public TestAccessEgress openingHours(int opening, int closing) { + return copyOf().withOpeningHours(opening, closing).build(); + } + + /** Alias for {@code openingHours(TimeUtils.time(opening), TimeUtils.time(closing))} */ + public TestAccessEgress openingHours(String opening, String closing) { + return openingHours(TimeUtils.time(opening), TimeUtils.time(closing)); + } + + public TestAccessEgress openingHoursClosed() { + return copyOf().withClosed().build(); + } + + public TestAccessEgress withTimePenalty(int timePenalty) { + return this.copyOf().withTimePenalty(timePenalty).build(); + } + + public Builder copyOf() { + return new Builder(this); + } + + @Override + public int stop() { + return stop; + } + + @Override + public int c1() { + return c1; + } + + @Override + public int durationInSeconds() { + return durationInSeconds; + } + + @Override + public int timePenalty() { + return timePenalty; + } + + @Override + public int earliestDepartureTime(int requestedDepartureTime) { + if (!hasOpeningHours()) { + return requestedDepartureTime; + } + if (closed) { + return RaptorConstants.TIME_NOT_SET; + } + + int days = Math.floorDiv(requestedDepartureTime, SECONDS_IN_A_DAY); + int specificOpening = days * SECONDS_IN_A_DAY + opening; + int specificClosing = days * SECONDS_IN_A_DAY + closing; + + if (requestedDepartureTime < specificOpening) { + return specificOpening; + } else if (requestedDepartureTime > specificClosing) { + // return the opening time for the next day + return specificOpening + SECONDS_IN_A_DAY; + } + return requestedDepartureTime; + } + + @Override + public int latestArrivalTime(int requestedArrivalTime) { + if (!hasOpeningHours()) { + return requestedArrivalTime; + } + if (closed) { + return RaptorConstants.TIME_NOT_SET; + } + + // opening & closing is relative to the departure + int requestedDepartureTime = requestedArrivalTime - durationInSeconds(); + int days = Math.floorDiv(requestedDepartureTime, SECONDS_IN_A_DAY); + int specificOpening = days * SECONDS_IN_A_DAY + opening; + int specificClosing = days * SECONDS_IN_A_DAY + closing; + int closeAtArrival = specificClosing + durationInSeconds(); + + if (requestedDepartureTime < specificOpening) { + // return the closing for the previous day, offset with durationInSeconds() + return closeAtArrival - SECONDS_IN_A_DAY; + } else if (requestedArrivalTime > closeAtArrival) { + return closeAtArrival; + } + return requestedArrivalTime; + } + + @Override + public boolean hasOpeningHours() { + return closed || opening != null || closing != null; + } + + @Override + public int numberOfRides() { + return numberOfRides; + } + + @Override + public boolean stopReachedOnBoard() { + return stopReachedOnBoard; + } + + @Override + public boolean isFree() { + return this.free; + } + + @Override + public String toString() { + return asString(true, true, null); + } + + /** + * Do not use the builder, use the static factory methods. Only use the builder if you need to + * override the {@link TestAccessEgress class}. + */ + protected static class Builder { + + int stop; + int durationInSeconds; + int c1; + int numberOfRides = DEFAULT_NUMBER_OF_RIDES; + boolean stopReachedOnBoard = STOP_REACHED_ON_FOOT; + Integer opening = null; + Integer closing = null; + private boolean free = false; + private boolean closed = false; + private int timePenalty; + + Builder(int stop, int durationInSeconds) { + this.stop = stop; + this.durationInSeconds = durationInSeconds; + this.c1 = walkCost(durationInSeconds); + this.timePenalty = RaptorConstants.TIME_NOT_SET; + } + + Builder(TestAccessEgress original) { + this.free = original.free; + this.stop = original.stop; + this.durationInSeconds = original.durationInSeconds; + this.stopReachedOnBoard = original.stopReachedOnBoard; + this.c1 = original.c1; + this.numberOfRides = original.numberOfRides; + this.opening = original.opening; + this.closing = original.closing; + this.closed = original.closed; + this.timePenalty = original.timePenalty; + } + + Builder withFree() { + this.free = true; + this.durationInSeconds = 0; + return this; + } + + Builder withCost(int cost) { + this.c1 = cost; + return this; + } + + Builder withNRides(int numberOfRides) { + this.numberOfRides = numberOfRides; + return this; + } + + Builder stopReachedOnBoard() { + this.stopReachedOnBoard = STOP_REACHED_ON_BOARD; + return this; + } + + Builder withTimePenalty(int timePenalty) { + this.timePenalty = timePenalty; + return this; + } + + Builder withOpeningHours(int opening, int closing) { + if (opening > closing) { + throw new IllegalStateException( + "Must open before is close. Opens at " + + TimeUtils.timeToStrCompact(opening) + + " and close at " + + TimeUtils.timeToStrCompact(closing) + + "." + ); + } + this.closed = false; + this.opening = opening; + this.closing = closing; + return this; + } + + Builder withClosed() { + this.opening = null; + this.closing = null; + this.closed = true; + return this; + } + + TestAccessEgress build() { + return new TestAccessEgress(this); + } + } +} diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedBoardingSearch.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedBoardingSearch.java new file mode 100644 index 00000000000..2766f760067 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedBoardingSearch.java @@ -0,0 +1,128 @@ +package org.opentripplanner.raptorlegacy._data.transit; + +import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Collection; +import java.util.List; +import java.util.function.BiPredicate; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import org.opentripplanner.model.transfer.TransferConstraint; +import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; +import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; +import org.opentripplanner.raptor.spi.RaptorTimeTable; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public class TestConstrainedBoardingSearch + implements RaptorConstrainedBoardingSearch { + + /** Index of guaranteed transfers by fromStopPos */ + private final TIntObjectMap> transfersByFromStopPos = new TIntObjectHashMap<>(); + private final BitSet transfersByToStopPosExist = new BitSet(); + private final BiPredicate timeAfterOrEqual; + private int currentTargetStopPos; + + TestConstrainedBoardingSearch(boolean forward) { + this.timeAfterOrEqual = forward ? (a, b) -> a >= b : (a, b) -> a <= b; + } + + @Override + public boolean transferExistTargetStop(int targetStopPos) { + this.currentTargetStopPos = targetStopPos; + return transfersByFromStopPos.containsKey(targetStopPos); + } + + @Override + public boolean transferExistSourceStop(int targetStopPos) { + // This is only used to check for + return transfersByToStopPosExist.get(targetStopPos); + } + + @Nullable + @Override + public RaptorBoardOrAlightEvent find( + RaptorTimeTable targetTimetable, + int transferSlack, + TestTripSchedule sourceTrip, + int sourceStopIndex, + int prevTransitArrivalTime, + int earliestBoardTime + ) { + var list = transfersByFromStopPos.get(currentTargetStopPos); + for (TestConstrainedTransfer tx : list) { + var trip = tx.getSourceTrip(); + if (trip == sourceTrip) { + int stopPos = trip.findDepartureStopPosition(prevTransitArrivalTime, sourceStopIndex); + boolean boardAlightPossible = timeAfterOrEqual.test(tx.getTime(), prevTransitArrivalTime); + if (tx.getSourceStopPos() == stopPos && boardAlightPossible) { + return tx.boardingEvent(tx.isFacilitated() ? prevTransitArrivalTime : earliestBoardTime); + } + } + } + return RaptorBoardOrAlightEvent.empty(earliestBoardTime); + } + + /** + * Return boardings as a result for constrained transfers like a guaranteed transfer. + */ + public List constrainedBoardings() { + return transfersByFromStopPos + .valueCollection() + .stream() + .flatMap(Collection::stream) + .collect(Collectors.toList()); + } + + @Override + public String toString() { + return ToStringBuilder + .of(TestConstrainedBoardingSearch.class) + .addNum("currentTargetStopPos", currentTargetStopPos) + .addObj("index", transfersByFromStopPos) + .toString(); + } + + /** + * The the {@code source/target} is the trips in order of the search direction (forward or + * reverse). For reverse search it is the opposite from {@code from/to} in the result path. + */ + void addConstraintTransfers( + TestTripSchedule sourceTrip, + int sourceStopPos, + TestTripSchedule targetTrip, + int targetTripIndex, + int targetStopPos, + int targetTime, + TransferConstraint constraint + ) { + List list = transfersByFromStopPos.get(targetStopPos); + if (list == null) { + list = new ArrayList<>(); + transfersByFromStopPos.put(targetStopPos, list); + } + list.add( + new TestConstrainedTransfer( + constraint, + sourceTrip, + sourceStopPos, + targetTrip, + targetTripIndex, + targetStopPos, + targetTime + ) + ); + transfersByToStopPosExist.set(sourceStopPos); + } + + void clear() { + transfersByFromStopPos.clear(); + transfersByToStopPosExist.clear(); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedTransfer.java similarity index 91% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedTransfer.java index 643585f8c5b..034a029787d 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestConstrainedTransfer.java @@ -1,4 +1,4 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import javax.annotation.Nullable; import org.opentripplanner.model.transfer.TransferConstraint; @@ -8,6 +8,11 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.ConstrainedTransferBoarding; import org.opentripplanner.utils.tostring.ToStringBuilder; +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated class TestConstrainedTransfer implements RaptorConstrainedTransfer { private final TransferConstraint transferConstraints; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestRoute.java similarity index 95% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestRoute.java index 6a606876e0e..715021521ef 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestRoute.java @@ -1,4 +1,4 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import java.util.ArrayList; import java.util.Collections; @@ -13,6 +13,11 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.TripScheduleSearchFactory; import org.opentripplanner.utils.tostring.ToStringBuilder; +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated public class TestRoute implements RaptorRoute, RaptorTimeTable { private final TestTripPattern pattern; diff --git a/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransfer.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransfer.java new file mode 100644 index 00000000000..dead63d0135 --- /dev/null +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransfer.java @@ -0,0 +1,52 @@ +package org.opentripplanner.raptorlegacy._data.transit; + +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; + +import org.opentripplanner.raptor.api.model.RaptorTransfer; + +/** + * Simple implementation for {@link RaptorTransfer} for use in unit-tests. + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated +public record TestTransfer(int stop, int durationInSeconds, int cost) implements RaptorTransfer { + public static final double DEFAULT_WALK_RELUCTANCE = 2.0; + + public static TestTransfer transfer(int stop, int durationInSeconds) { + return new TestTransfer(stop, durationInSeconds, walkCost(durationInSeconds)); + } + + public static TestTransfer transfer(int stop, int durationInSeconds, int cost) { + return new TestTransfer(stop, durationInSeconds, cost); + } + + public static int walkCost(int durationInSeconds) { + return walkCost(durationInSeconds, DEFAULT_WALK_RELUCTANCE); + } + + public static int walkCost(int durationInSeconds, double reluctance) { + return toRaptorCost(durationInSeconds * reluctance); + } + + @Override + public int stop() { + return stop; + } + + @Override + public int c1() { + return cost; + } + + @Override + public int durationInSeconds() { + return durationInSeconds; + } + + @Override + public String toString() { + return asString(); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransferPoint.java similarity index 84% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransferPoint.java index ef2271e51ae..8c274f779d8 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferPoint.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransferPoint.java @@ -1,8 +1,13 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import org.opentripplanner.model.transfer.TransferPoint; import org.opentripplanner.utils.tostring.ToStringBuilder; +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated public class TestTransferPoint implements TransferPoint { private final int stop; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransitData.java similarity index 95% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransitData.java index 4f225106ba2..1cbf591c01d 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTransitData.java @@ -1,8 +1,8 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; -import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; +import static org.opentripplanner.raptorlegacy._data.transit.TestRoute.route; +import static org.opentripplanner.raptorlegacy._data.transit.TestTripPattern.pattern; +import static org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule.schedule; import java.util.ArrayList; import java.util.BitSet; @@ -13,7 +13,6 @@ import javax.annotation.Nullable; import org.opentripplanner.model.transfer.ConstrainedTransfer; import org.opentripplanner.model.transfer.TransferConstraint; -import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; import org.opentripplanner.raptor.api.model.RaptorTransfer; @@ -30,6 +29,7 @@ import org.opentripplanner.raptor.spi.RaptorTimeTable; import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; import org.opentripplanner.raptor.util.BitSetIterator; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; import org.opentripplanner.routing.algorithm.raptoradapter.api.DefaultTripPattern; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultRaptorTransfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.CostCalculatorFactory; @@ -38,6 +38,11 @@ import org.opentripplanner.routing.algorithm.transferoptimization.model.TripStopTime; import org.opentripplanner.routing.algorithm.transferoptimization.services.TransferServiceAdaptor; +/** + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated @SuppressWarnings("UnusedReturnValue") public class TestTransitData implements RaptorTransitDataProvider, RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripPattern.java similarity index 94% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripPattern.java index 811c17cc568..f6d9aace021 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripPattern.java @@ -1,9 +1,15 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import org.opentripplanner.routing.algorithm.raptoradapter.api.DefaultTripPattern; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.utils.tostring.ToStringBuilder; +/** + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated public class TestTripPattern implements DefaultTripPattern { public static final byte BOARDING_MASK = 0b0001; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSchedule.java similarity index 97% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSchedule.java index 75062d9a61e..0ef437cb3d0 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSchedule.java @@ -1,4 +1,4 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import static org.opentripplanner.transit.model.basic.Accessibility.NO_INFORMATION; @@ -19,8 +19,11 @@ * An implementation of the {@link RaptorTripSchedule} for unit-testing. *

    * The {@link DefaultTripPattern} for this schedule return {@code stopIndex == stopPosInPattern + 1 } + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. */ -// TODO : This class should implement RaptorTripSchedule not raptoradapter TripSchedule +@Deprecated public class TestTripSchedule implements TripSchedule { private static final int DEFAULT_DEPARTURE_DELAY = 10; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSearchTimetable.java similarity index 86% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java rename to application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSearchTimetable.java index 0785e20c241..a486492a2c6 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSearchTimetable.java +++ b/application/src/test/java/org/opentripplanner/raptorlegacy/_data/transit/TestTripSearchTimetable.java @@ -1,4 +1,4 @@ -package org.opentripplanner.raptor._data.transit; +package org.opentripplanner.raptorlegacy._data.transit; import java.util.function.IntUnaryOperator; import org.opentripplanner.raptor.api.model.SearchDirection; @@ -6,6 +6,12 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.TripScheduleSearchFactory; import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.TripSearchTimetable; +/** + * + * @deprecated This was earlier part of Raptor and should not be used outside the Raptor + * module. Use the OTP model entities instead. + */ +@Deprecated public class TestTripSearchTimetable implements TripSearchTimetable { private final TestTripSchedule[] trips; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java index 64797b9c5a1..0eb7bfae1d3 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/PagingServiceFactoryTest.java @@ -7,10 +7,10 @@ import java.time.Instant; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.api.request.RaptorTuningParameters; import org.opentripplanner.raptor.api.request.SearchParams; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.utils.time.DurationUtils; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java index ede3166e22b..8f2fc45b875 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/mapping/RaptorPathToItineraryMapperTest.java @@ -5,7 +5,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.raptor._data.RaptorTestConstants.BOARD_SLACK; +import static org.opentripplanner.raptorlegacy._data.RaptorTestConstants.BOARD_SLACK; import java.time.Duration; import java.time.Instant; @@ -29,13 +29,8 @@ import org.opentripplanner.model.plan.Leg; import org.opentripplanner.model.plan.ScheduledTransitLeg; import org.opentripplanner.model.plan.StreetLeg; -import org.opentripplanner.raptor._data.api.TestPathBuilder; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestRoute; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransfer; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.AccessPathLeg; @@ -45,6 +40,12 @@ import org.opentripplanner.raptor.api.path.TransferPathLeg; import org.opentripplanner.raptor.path.Path; import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptorlegacy._data.api.TestPathBuilder; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestRoute; +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.router.street.AccessEgressType; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultAccessEgress; import org.opentripplanner.routing.algorithm.raptoradapter.transit.DefaultRaptorTransfer; @@ -52,7 +53,6 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.search.state.State; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java index dacd0dcac9c..8dc4d548c18 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransferTest.java @@ -9,8 +9,8 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.opentripplanner._support.geometry.Coordinates; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransfer; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; import org.opentripplanner.street.model._data.StreetModelForTest; import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.search.request.StreetSearchRequest; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java index 3570d92bdbe..ad31b250046 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/DefaultCostCalculatorTest.java @@ -3,8 +3,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; public class DefaultCostCalculatorTest { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java index 1aaf3dcd8ef..1cf9a324de5 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/PatternCostCalculatorTest.java @@ -3,7 +3,7 @@ import static graphql.Assert.assertFalse; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.raptor._data.transit.TestRoute.route; +import static org.opentripplanner.raptorlegacy._data.transit.TestRoute.route; import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.agency; import static org.opentripplanner.transit.model._data.TimetableRepositoryForTest.id; @@ -16,11 +16,11 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.framework.model.Cost; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.mappers.GeneralizedCostParametersMapper; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java index 2769a95b634..b38cefe232c 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostLinearFunctionTest.java @@ -11,6 +11,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.framework.model.Cost; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.test.support.TestTableParser; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java index b7d3f255a9d..76de708c817 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/WheelchairCostCalculatorTest.java @@ -6,9 +6,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.api.request.preference.AccessibilityPreferences; import org.opentripplanner.transit.model.basic.Accessibility; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java index 9f7458376cc..2620dd506bc 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/GeneralizedCostParametersMapperTest.java @@ -10,9 +10,9 @@ import java.util.BitSet; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.transit.TestRoute; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestRoute; +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.transit.model.framework.FeedScopedId; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java index a8e00056a3f..03027b219d1 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/RaptorRequestMapperTest.java @@ -12,10 +12,10 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor._data.transit.TestAccessEgress; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.api.request.RaptorRequest; +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.framework.CostLinearFunction; import org.opentripplanner.routing.api.request.via.PassThroughViaLocation; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java index fa76a2790ed..37620d80bc3 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripAssert.java @@ -4,9 +4,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; import org.opentripplanner.raptor.spi.RaptorTripScheduleSearch; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; class TripAssert { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java index 8fddca9511f..55cb99b2f82 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleAlightSearchTest.java @@ -1,18 +1,18 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; +import static org.opentripplanner.raptorlegacy._data.transit.TestTripPattern.pattern; +import static org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule.schedule; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestRoute; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.SearchDirection; import org.opentripplanner.raptor.spi.RaptorTripScheduleSearch; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestRoute; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; public class TripScheduleAlightSearchTest implements RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java index dd3a7d64cf6..28811fcc42c 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/request/TripScheduleBoardSearchTest.java @@ -1,17 +1,17 @@ package org.opentripplanner.routing.algorithm.raptoradapter.transit.request; -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; +import static org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule.schedule; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestRoute; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.SearchDirection; import org.opentripplanner.raptor.spi.RaptorTripScheduleSearch; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestRoute; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; public class TripScheduleBoardSearchTest implements RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java index 788192c45b5..bc01a082740 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/api/OptimizedPathTest.java @@ -4,9 +4,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase; import org.opentripplanner.raptor.api.model.RaptorValueFormatter; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase; class OptimizedPathTest implements RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java index 9b0cf342c0b..d5d8f7c7c62 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/MinSafeTransferTimeCalculatorTest.java @@ -1,17 +1,17 @@ package org.opentripplanner.routing.algorithm.transferoptimization.model; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; +import static org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; import static org.opentripplanner.routing.algorithm.transferoptimization.model.MinSafeTransferTimeCalculator.bound; import static org.opentripplanner.utils.time.TimeUtils.time; import java.util.List; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.api.TestPathBuilder; -import org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.api.TestPathBuilder; +import org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.utils.time.DurationUtils; public class MinSafeTransferTimeCalculatorTest implements RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java index 8c82f68a8bc..505b6581000 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/OptimizedPathTailTest.java @@ -4,11 +4,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; import org.opentripplanner.raptor.api.path.TransitPathLeg; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.transferoptimization.services.TestTransferBuilder; class OptimizedPathTailTest implements RaptorTestConstants { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java index e81b51c4eaa..640dd48d27d 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/TripStopTimeTest.java @@ -5,8 +5,8 @@ import static org.opentripplanner.utils.time.TimeUtils.time; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.transit.TestTripPattern; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.utils.time.TimeUtils; public class TripStopTimeTest { diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java index 8ecf0006e48..e32559c2dad 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/costfilter/MinCostPathTailFilterTest.java @@ -1,15 +1,15 @@ package org.opentripplanner.routing.algorithm.transferoptimization.model.costfilter; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; +import static org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import org.junit.jupiter.api.Test; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.transferoptimization.model.OptimizedPathTail; import org.opentripplanner.routing.algorithm.transferoptimization.model.TransferWaitTimeCostCalculator; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java index 11552ea3d1e..ff1f37ef5fa 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughNoTransfersTest.java @@ -10,8 +10,8 @@ import java.util.List; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; /** * This test focus on the PASS-THROUGH functionality with a very simple scenario - one transit leg diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java index acd99ab4bef..d1bc95f3b68 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughOneTransferTest.java @@ -12,8 +12,8 @@ import java.util.stream.Collectors; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; /** * This test focus on the PASS-THROUGH functionality with two transit legs and one transfer in the diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java index 05da490c857..bed2bff0202 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/PassThroughTwoTransfersTest.java @@ -10,10 +10,10 @@ import java.util.List; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.api.PathUtils; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.api.PathUtils; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; /** * This test focus on the PASS-THROUGH functionality with three transit legs and two transfer in diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java index 3b2059cf4d9..8ca961dcab0 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestCase.java @@ -1,8 +1,8 @@ package org.opentripplanner.routing.algorithm.transferoptimization.model.passthrough; import java.util.List; -import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor.api.request.PassThroughPoint; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; record TestCase( String description, diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java index 2faf0ee95c1..103e2c88f3f 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/model/passthrough/TestUtils.java @@ -4,12 +4,12 @@ import java.util.Collection; import java.util.List; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.api.TestPathBuilder; -import org.opentripplanner.raptor._data.transit.TestTransitData; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.request.PassThroughPoint; import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.api.TestPathBuilder; +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; import org.opentripplanner.routing.algorithm.transferoptimization.model.TripToTripTransfer; import org.opentripplanner.routing.algorithm.transferoptimization.model.costfilter.MinCostPathTailFilterFactory; diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java index 109032a0110..3cfba2330c1 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceConstrainedTest.java @@ -13,9 +13,9 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.model.transfer.ConstrainedTransfer; import org.opentripplanner.model.transfer.TransferPriority; -import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.api.PathUtils; -import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants; +import org.opentripplanner.raptorlegacy._data.api.PathUtils; +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule; /** *

    diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java
    index 54c45b8a76b..6a023138751 100644
    --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java
    +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/OptimizePathDomainServiceTest.java
    @@ -8,13 +8,13 @@
     import java.util.List;
     import javax.annotation.Nullable;
     import org.junit.jupiter.api.Test;
    -import org.opentripplanner.raptor._data.RaptorTestConstants;
    -import org.opentripplanner.raptor._data.api.PathUtils;
    -import org.opentripplanner.raptor._data.api.TestPathBuilder;
    -import org.opentripplanner.raptor._data.transit.TestTripSchedule;
     import org.opentripplanner.raptor.spi.DefaultSlackProvider;
     import org.opentripplanner.raptor.spi.RaptorCostCalculator;
     import org.opentripplanner.raptor.spi.RaptorSlackProvider;
    +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants;
    +import org.opentripplanner.raptorlegacy._data.api.PathUtils;
    +import org.opentripplanner.raptorlegacy._data.api.TestPathBuilder;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule;
     import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.TransferWaitTimeCostCalculator;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.costfilter.MinCostPathTailFilterFactory;
    diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java
    index d553bac75eb..f32b5366907 100644
    --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java
    +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TestTransferBuilder.java
    @@ -5,9 +5,9 @@
     import org.opentripplanner.model.transfer.TransferConstraint;
     import org.opentripplanner.model.transfer.TransferPriority;
     import org.opentripplanner.model.transfer.TripTransferPoint;
    -import org.opentripplanner.raptor._data.transit.TestTransfer;
     import org.opentripplanner.raptor.api.model.RaptorConstants;
     import org.opentripplanner.raptor.api.model.RaptorTripSchedule;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.TripStopTime;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.TripToTripTransfer;
     import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
    diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java
    index 4392e89a83d..e021a38a8de 100644
    --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java
    +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorDummy.java
    @@ -2,9 +2,9 @@
     
     import java.util.Arrays;
     import java.util.List;
    -import org.opentripplanner.raptor._data.transit.TestTransitData;
    -import org.opentripplanner.raptor._data.transit.TestTripSchedule;
     import org.opentripplanner.raptor.api.path.TransitPathLeg;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.TripToTripTransfer;
     
     /**
    diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java
    index acaefbcf1d9..4e1d89c6b49 100644
    --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java
    +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransferGeneratorTest.java
    @@ -2,9 +2,9 @@
     
     import static java.time.Duration.ofMinutes;
     import static org.junit.jupiter.api.Assertions.assertEquals;
    -import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.C1_CALCULATOR;
    -import static org.opentripplanner.raptor._data.transit.TestRoute.route;
    -import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule;
    +import static org.opentripplanner.raptorlegacy._data.stoparrival.BasicPathTestCase.C1_CALCULATOR;
    +import static org.opentripplanner.raptorlegacy._data.transit.TestRoute.route;
    +import static org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule.schedule;
     
     import java.time.Duration;
     import java.util.List;
    @@ -17,17 +17,17 @@
     import org.junit.jupiter.params.provider.Arguments;
     import org.junit.jupiter.params.provider.MethodSource;
     import org.opentripplanner.model.transfer.TransferConstraint;
    -import org.opentripplanner.raptor._data.RaptorTestConstants;
    -import org.opentripplanner.raptor._data.api.TestPathBuilder;
    -import org.opentripplanner.raptor._data.transit.TestRoute;
    -import org.opentripplanner.raptor._data.transit.TestTransfer;
    -import org.opentripplanner.raptor._data.transit.TestTransitData;
    -import org.opentripplanner.raptor._data.transit.TestTripPattern;
    -import org.opentripplanner.raptor._data.transit.TestTripSchedule;
     import org.opentripplanner.raptor.api.path.RaptorPath;
     import org.opentripplanner.raptor.api.path.TransitPathLeg;
     import org.opentripplanner.raptor.spi.DefaultSlackProvider;
     import org.opentripplanner.raptor.spi.RaptorSlackProvider;
    +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants;
    +import org.opentripplanner.raptorlegacy._data.api.TestPathBuilder;
    +import org.opentripplanner.raptorlegacy._data.transit.TestRoute;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTransfer;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTransitData;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTripPattern;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule;
     import org.opentripplanner.utils.time.TimeUtils;
     
     public class TransferGeneratorTest implements RaptorTestConstants {
    diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java
    index 5ce84b4a00d..5ca18f63cb9 100644
    --- a/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java
    +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/transferoptimization/services/TransitPathLegSelectorTest.java
    @@ -8,14 +8,14 @@
     import java.util.Set;
     import java.util.stream.Collectors;
     import org.junit.jupiter.api.Test;
    -import org.opentripplanner.raptor._data.RaptorTestConstants;
    -import org.opentripplanner.raptor._data.transit.TestAccessEgress;
    -import org.opentripplanner.raptor._data.transit.TestTripSchedule;
     import org.opentripplanner.raptor.api.path.EgressPathLeg;
     import org.opentripplanner.raptor.api.path.TransitPathLeg;
     import org.opentripplanner.raptor.spi.DefaultSlackProvider;
     import org.opentripplanner.raptor.spi.RaptorCostCalculator;
     import org.opentripplanner.raptor.spi.RaptorSlackProvider;
    +import org.opentripplanner.raptorlegacy._data.RaptorTestConstants;
    +import org.opentripplanner.raptorlegacy._data.transit.TestAccessEgress;
    +import org.opentripplanner.raptorlegacy._data.transit.TestTripSchedule;
     import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.OptimizedPathTail;
     import org.opentripplanner.routing.algorithm.transferoptimization.model.PathTailFilter;
    diff --git a/pom.xml b/pom.xml
    index 284153b6486..abc70e5dc8c 100644
    --- a/pom.xml
    +++ b/pom.xml
    @@ -97,6 +97,7 @@
             application
             gtfs-realtime-protobuf
             utils
    +        raptor
         
     
         
    diff --git a/raptor/pom.xml b/raptor/pom.xml
    new file mode 100644
    index 00000000000..d2d93e36f9d
    --- /dev/null
    +++ b/raptor/pom.xml
    @@ -0,0 +1,59 @@
    +
    +
    +    4.0.0
    +    
    +        org.opentripplanner
    +        otp-root
    +        2.7.0-SNAPSHOT
    +    
    +
    +    otp-raptor
    +    OpenTripPlanner - Raptor
    +
    +    
    +        
    +
    +        
    +            ${project.groupId}
    +            otp-utils
    +            ${project.version}
    +        
    +
    +        
    +
    +        
    +        
    +            com.google.code.findbugs
    +            jsr305
    +        
    +        
    +            net.sf.trove4j
    +            trove4j
    +        
    +        
    +        
    +            org.slf4j
    +            slf4j-api
    +        
    +
    +        
    +
    +        
    +            org.junit.jupiter
    +            junit-jupiter-api
    +            test
    +        
    +        
    +            org.junit.jupiter
    +            junit-jupiter-params
    +            test
    +        
    +        
    +            com.tngtech.archunit
    +            archunit
    +            test
    +        
    +    
    +
    diff --git a/application/src/main/java/org/opentripplanner/raptor/RaptorService.java b/raptor/src/main/java/org/opentripplanner/raptor/RaptorService.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/RaptorService.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/RaptorService.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg b/raptor/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg
    rename to raptor/src/main/java/org/opentripplanner/raptor/RaptorTimeLine.svg
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java b/raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugEvent.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java b/raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugLogger.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java b/raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/debug/DebugTopic.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java b/raptor/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/debug/RaptorTimers.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/AbstractAccessEgressDecorator.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/DominanceFunction.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunction.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/PathLegType.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorAccessEgress.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstants.java
    diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java
    similarity index 100%
    rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorConstrainedTransfer.java
    diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorCostConverter.java
    similarity index 86%
    rename from application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java
    rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorCostConverter.java
    index 210197f107b..3801c948e3e 100644
    --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverter.java
    +++ b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorCostConverter.java
    @@ -1,14 +1,14 @@
    -package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost;
    +package org.opentripplanner.raptor.api.model;
     
     import java.time.Duration;
    -import org.opentripplanner.raptor.api.model.RaptorValueFormatter;
     
     /**
    - * Convert Raptor internal cost to OTP domain model cost, and back.
    + * Convert Raptor internal cost to OTP domain model cost, and back. This is provided by the Raptor
    + * module as a utility, but not used in Raptor except in unit-tests.
      * 

    - * Inside Raptor the a cost unit is 1/100 of a "transit second" using {@code int} as type. In the - * OTP internal domain the unit used for cost is one "transit second" with type {@code double}. Cost - * in raptor is calculated using ints to spped up the calculations and to save memory. + * Inside Raptor the cost unit is 1/100 of a "transit second" using {@code int} as type. In the + * OTP internal domain the unit used for cost is one "transit second" with type {@code double}. + * Cost in raptor is calculated using ints to speed up the calculations and to save memory. *

    * The reason for using 1/100 of a second resolution is that we want a cost factor of {@code 0.99} * to win over a cost factor of {@code 1.00}. diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorStopNameResolver.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransfer.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTransferConstraint.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripPattern.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorTripSchedule.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RaptorValueFormatter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/RelaxFunction.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/SearchDirection.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/model/TransitArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/AccessPathLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/EgressPathLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/PathLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/PathStringBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/RaptorPath.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/TransferPathLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/path/TransitPathLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/DebugRequest.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/DebugRequestBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/DynamicSearchWindowCoefficients.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequest.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/Optimization.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/PassThroughPoint.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorEnvironment.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorEnvironment.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorEnvironment.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorEnvironment.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorProfile.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequest.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorRequestBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorTransitGroupPriorityCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorTuningParameters.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaConnection.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/RaptorViaLocation.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/SearchParams.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/request/SearchParamsBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java b/raptor/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/response/RaptorResponse.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/response/StopArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java b/raptor/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/view/AccessPathView.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java b/raptor/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/view/ArrivalView.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java b/raptor/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/view/EgressPathView.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java b/raptor/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/view/PatternRideView.java diff --git a/application/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java b/raptor/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java rename to raptor/src/main/java/org/opentripplanner/raptor/api/view/TransitPathView.java diff --git a/application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java b/raptor/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java similarity index 99% rename from application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java rename to raptor/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java index ed10d0d715c..66d72900889 100644 --- a/application/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java +++ b/raptor/src/main/java/org/opentripplanner/raptor/configure/RaptorConfig.java @@ -90,7 +90,8 @@ public RaptorRouter createRangeRaptorWithMcWorker( mainSearch, alternativeSearch, extraMcSearch.merger(), - threadPool() + threadPool(), + environment::mapInterruptedException ); } diff --git a/application/src/main/java/org/opentripplanner/raptor/package.md b/raptor/src/main/java/org/opentripplanner/raptor/package.md similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/package.md rename to raptor/src/main/java/org/opentripplanner/raptor/package.md diff --git a/application/src/main/java/org/opentripplanner/raptor/path/Path.java b/raptor/src/main/java/org/opentripplanner/raptor/path/Path.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/path/Path.java rename to raptor/src/main/java/org/opentripplanner/raptor/path/Path.java diff --git a/application/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/path/PathBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/path/PathBuilderLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/CompositeResult.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/CompositeResult.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/CompositeResult.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/CompositeResult.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java similarity index 86% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java index a4ddf36347f..1a16c6f0527 100644 --- a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java +++ b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/ConcurrentCompositeRaptorRouter.java @@ -4,8 +4,8 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.function.BiFunction; +import java.util.function.Function; import javax.annotation.Nullable; -import org.opentripplanner.framework.application.OTPRequestTimeoutException; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; import org.opentripplanner.raptor.rangeraptor.internalapi.RaptorRouter; @@ -26,16 +26,21 @@ public class ConcurrentCompositeRaptorRouter @Nullable private final ExecutorService executorService; + @Nullable + private final Function mapInterruptedException; + public ConcurrentCompositeRaptorRouter( RaptorRouter mainWorker, RaptorRouter alternativeWorker, BiFunction>, Collection>, Collection>> merger, - @Nullable ExecutorService executorService + @Nullable ExecutorService executorService, + @Nullable Function mapInterruptedException ) { this.mainWorker = mainWorker; this.alternativeWorker = alternativeWorker; this.merger = merger; this.executorService = executorService; + this.mapInterruptedException = mapInterruptedException; } @Override @@ -59,7 +64,7 @@ public RaptorRouterResult route() { mainResultFuture.cancel(true); alternativeResultFuture.cancel(true); - throw new OTPRequestTimeoutException(); + throw mapInterruptedException.apply(e); } catch (ExecutionException e) { throw (e.getCause() instanceof RuntimeException re) ? re : new RuntimeException(e); } diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/DefaultRangeRaptorWorker.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptor.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/RangeRaptorWorkerComposite.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/SystemErrDebugLogger.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContext.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextBuilder.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextViaLeg.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/AbstractDebugHandlerAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPathAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerPatternRideAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/DebugHandlerStopArrivalAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/debug/ParetoSetDebugHandlerAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/DebugHandler.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/HeuristicAtStop.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/Heuristics.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetCost.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/ParetoSetTime.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/PassThroughPointsService.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RangeRaptorWorker.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorRouterResult.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RaptorWorkerState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/RoutingStrategy.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SingleCriteriaStopArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/SlackProvider.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/internalapi/WorkerLifeCycle.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleEventPublisher.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/lifecycle/LifeCycleSubscriptions.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/CalculateTransferToDestination.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/DebugStopArrivalsStatistics.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRangeRaptorWorkerState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McRaptorRouterResult.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/McStopArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/MultiCriteriaRoutingStrategy.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalParetoSet.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ViaConnectionStopArrivalEventListener.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AbstractStopArrivalC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/configure/McRangeRaptorConfig.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/heuristic/HeuristicsProvider.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsService.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRide.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/PatternRideFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PassThroughRideFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/TransitGroupPriorityRideFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/BoardAndAlightTimeSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrival.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalPaths.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ForwardPathMapper.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathMapper.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparators.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/ReversePathMapper.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/path/configure/PathConfig.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/ArrivalTimeRoutingStrategy.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/MinTravelDurationRoutingStrategy.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRangeRaptorWorkerState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdRaptorRouterResult.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/StdWorkerState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimes.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/BestTimesOnlyStopArrivalsState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheck.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleBestNumberOfTransfers.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/UnknownPathFactory.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/StdRangeRaptorConfig.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/configure/VerifyRequestIsValid.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/DebugStopArrivalsState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/debug/StateDebugger.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/heuristics/HeuristicsAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/ArrivedAtDestinationCheck.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/BestNumberOfTransfers.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/DestinationArrivalListener.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/internalapi/StopArrivalsState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/AccessStopArrivalState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/DefaultStopArrivalState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/EgressStopArrivalState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StdStopArrivalsState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/StopArrivalState.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/path/EgressArrivalToPathAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Access.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopArrivalViewAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/StopsCursor.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transfer.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/standard/stoparrivals/view/Transit.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/support/TimeBasedBoardingSupport.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctions.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPaths.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenalty.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPaths.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenalty.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorTransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTracker.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapter.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TimeCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TransitCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java b/raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java rename to raptor/src/main/java/org/opentripplanner/raptor/rangeraptor/transit/ViaConnections.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java b/raptor/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/DebugHeuristics.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java b/raptor/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/DefaultStopArrivals.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java b/raptor/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/DestinationNotReachedException.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java b/raptor/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/HeuristicSearchTask.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java b/raptor/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/HeuristicToRunResolver.java diff --git a/application/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/service/RangeRaptorDynamicSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/BoardAndAlightTime.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/DefaultSlackProvider.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java similarity index 86% rename from application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java index 07984903f2a..4c0b76d99f9 100644 --- a/application/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java +++ b/raptor/src/main/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEvent.java @@ -4,6 +4,7 @@ import org.opentripplanner.raptor.api.model.RaptorConstants; import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.utils.time.TimeUtils; record EmptyBoardOrAlightEvent(int earliestBoardTime) implements RaptorBoardOrAlightEvent { @@ -44,4 +45,9 @@ public void boardWithFallback( ) { alternativeBoardingFallback.accept(this); } + + @Override + public String toString() { + return "EmptyBoardOrAlightEvent(" + TimeUtils.timeToStrLong(earliestBoardTime) + ")"; + } } diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/ExtraMcRouterSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/ExtraMcRouterSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/ExtraMcRouterSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/ExtraMcRouterSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/Flyweight.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/IntIterator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorBoardOrAlightEvent.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorConstrainedBoardingSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorCostCalculator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorPathConstrainedTransferSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorRoute.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorSlackProvider.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTimeTable.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTransitDataProvider.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/RaptorTripScheduleSearch.java diff --git a/application/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java b/raptor/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java rename to raptor/src/main/java/org/opentripplanner/raptor/spi/UnknownPath.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java b/raptor/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/BitSetIterator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java b/raptor/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/CompareIntArrays.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/IntIterators.java b/raptor/src/main/java/org/opentripplanner/raptor/util/IntIterators.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/IntIterators.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/IntIterators.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java b/raptor/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/composite/CompositeUtil.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java b/raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoComparator.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java b/raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSet.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java b/raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListener.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java b/raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerComposite.java diff --git a/application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java b/raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java similarity index 100% rename from application/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java rename to raptor/src/main/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarker.java diff --git a/application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java b/raptor/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java similarity index 84% rename from application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java index 13f341279f7..3ada07c090b 100644 --- a/application/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/RaptorArchitectureTest.java @@ -1,21 +1,22 @@ package org.opentripplanner.raptor; import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices; -import static org.opentripplanner.OtpArchitectureModules.FRAMEWORK_UTILS; -import static org.opentripplanner.OtpArchitectureModules.GNU_TROVE; -import static org.opentripplanner.OtpArchitectureModules.OTP_ROOT; -import static org.opentripplanner.OtpArchitectureModules.RAPTOR_API; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.opentripplanner._support.arch.ArchComponent; -import org.opentripplanner._support.arch.Module; -import org.opentripplanner._support.arch.Package; +import org.opentripplanner.raptor._support.arch.ArchComponent; +import org.opentripplanner.raptor._support.arch.Module; +import org.opentripplanner.raptor._support.arch.Package; public class RaptorArchitectureTest { + private static final Package OTP_ROOT = Package.of("org.opentripplanner"); + private static final Package GNU_TROVE = Package.of("gnu.trove.."); + private static final Package OTP_UTILS = OTP_ROOT.subPackage("utils.."); + /* The Raptor module, all packages that other paths of OTP may use. */ private static final Package RAPTOR = OTP_ROOT.subPackage("raptor"); + private static final Package RAPTOR_API = RAPTOR.subPackage("api.."); private static final Package API = RAPTOR.subPackage("api"); private static final Package API_MODEL = API.subPackage("model"); private static final Package API_PATH = API.subPackage("path"); @@ -49,7 +50,7 @@ public class RaptorArchitectureTest { * Packages used by standard-range-raptor and multi-criteria-range-raptor. */ private static final Module RR_SHARED_PACKAGES = Module.of( - FRAMEWORK_UTILS, + OTP_UTILS, GNU_TROVE, RAPTOR_API, RAPTOR_SPI, @@ -64,37 +65,37 @@ public class RaptorArchitectureTest { @Test void enforcePackageDependenciesRaptorAPI() { - API_MODEL.dependsOn(FRAMEWORK_UTILS).verify(); - API_PATH.dependsOn(FRAMEWORK_UTILS, API_MODEL).verify(); - var debug = API.subPackage("debug").dependsOn(FRAMEWORK_UTILS).verify(); - var view = API.subPackage("view").dependsOn(FRAMEWORK_UTILS, API_MODEL).verify(); + API_MODEL.dependsOn(OTP_UTILS).verify(); + API_PATH.dependsOn(OTP_UTILS, API_MODEL).verify(); + var debug = API.subPackage("debug").dependsOn(OTP_UTILS).verify(); + var view = API.subPackage("view").dependsOn(OTP_UTILS, API_MODEL).verify(); var request = API .subPackage("request") - .dependsOn(FRAMEWORK_UTILS, debug, API_MODEL, API_PATH, view) + .dependsOn(OTP_UTILS, debug, API_MODEL, API_PATH, view) .verify(); - API.subPackage("response").dependsOn(FRAMEWORK_UTILS, API_MODEL, API_PATH, request).verify(); + API.subPackage("response").dependsOn(OTP_UTILS, API_MODEL, API_PATH, request).verify(); } @Test void enforcePackageDependenciesRaptorSPI() { - RAPTOR_SPI.dependsOn(FRAMEWORK_UTILS, API_MODEL, API_PATH).verify(); + RAPTOR_SPI.dependsOn(OTP_UTILS, API_MODEL, API_PATH).verify(); } @Test void enforcePackageDependenciesUtil() { - RAPTOR_UTIL.dependsOn(FRAMEWORK_UTILS, RAPTOR_SPI).verify(); + RAPTOR_UTIL.dependsOn(OTP_UTILS, RAPTOR_SPI).verify(); RAPTOR_UTIL_PARETO_SET.dependsOn(RAPTOR_UTIL_COMPOSITE).verify(); RAPTOR_UTIL_COMPOSITE.verify(); } @Test void enforcePackageDependenciesRaptorPath() { - RAPTOR_PATH.dependsOn(FRAMEWORK_UTILS, API_PATH, API_MODEL, RAPTOR_SPI, RR_TRANSIT).verify(); + RAPTOR_PATH.dependsOn(OTP_UTILS, API_PATH, API_MODEL, RAPTOR_SPI, RR_TRANSIT).verify(); } @Test void enforcePackageDependenciesInRangeRaptorSharedPackages() { - RR_INTERNAL_API.dependsOn(FRAMEWORK_UTILS, RAPTOR_API, RAPTOR_SPI).verify(); + RR_INTERNAL_API.dependsOn(OTP_UTILS, RAPTOR_API, RAPTOR_SPI).verify(); RR_DEBUG.dependsOn(RR_SHARED_PACKAGES).verify(); RR_LIFECYCLE.dependsOn(RR_SHARED_PACKAGES).verify(); RR_TRANSIT.dependsOn(RR_SHARED_PACKAGES, RR_DEBUG, RR_LIFECYCLE).verify(); @@ -200,7 +201,7 @@ void enforcePackageDependenciesInMultiCriteriaImplementation() { void enforcePackageDependenciesInRaptorService() { SERVICE .dependsOn( - FRAMEWORK_UTILS, + OTP_UTILS, RAPTOR_API, RAPTOR_SPI, RAPTOR_UTIL, @@ -216,6 +217,7 @@ void enforcePackageDependenciesInRaptorService() { void enforcePackageDependenciesInConfigure() { CONFIGURE .dependsOn( + OTP_UTILS, RAPTOR_API, RAPTOR_SPI, RANGE_RAPTOR, @@ -223,8 +225,7 @@ void enforcePackageDependenciesInConfigure() { RR_TRANSIT, RR_CONTEXT, RR_STD_CONFIGURE, - RR_MC_CONFIGURE, - FRAMEWORK_UTILS + RR_MC_CONFIGURE ) .verify(); } diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/RaptorTestConstants.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/api/PathUtils.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilder.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java similarity index 97% rename from application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java index 9b37057cdc6..e5a48ecd289 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestPathBuilderTestRaptor.java @@ -2,9 +2,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.model.transfer.TransferConstraint.REGULAR_TRANSFER; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; import static org.opentripplanner.raptor._data.transit.TestAccessEgress.walk; +import static org.opentripplanner.raptor.api.model.RaptorTransferConstraint.REGULAR_TRANSFER; import static org.opentripplanner.utils.time.DurationUtils.durationInSeconds; import static org.opentripplanner.utils.time.TimeUtils.time; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/api/TestRaptorPath.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/multicriteria/ride/TestPatterRideBuilder.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AbstractStopArrival.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Access.java diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AccessAndEgressWithOpeningHoursPathTestCase.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AccessAndEgressWithOpeningHoursPathTestCase.java new file mode 100644 index 00000000000..89e13aa58ec --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/AccessAndEgressWithOpeningHoursPathTestCase.java @@ -0,0 +1,381 @@ +package org.opentripplanner.raptor._data.stoparrival; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.access; +import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.bus; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorValueFormatter.formatC1; +import static org.opentripplanner.utils.time.DurationUtils.durationInSeconds; +import static org.opentripplanner.utils.time.TimeUtils.time; + +import org.junit.jupiter.api.Test; +import org.opentripplanner.raptor._data.RaptorTestConstants; +import org.opentripplanner.raptor._data.transit.TestAccessEgress; +import org.opentripplanner.raptor._data.transit.TestCostCalculator; +import org.opentripplanner.raptor._data.transit.TestTransfer; +import org.opentripplanner.raptor._data.transit.TestTripPattern; +import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorConstants; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; +import org.opentripplanner.raptor.api.model.RaptorTransfer; +import org.opentripplanner.raptor.api.view.ArrivalView; +import org.opentripplanner.raptor.rangeraptor.path.DestinationArrival; +import org.opentripplanner.raptor.spi.DefaultSlackProvider; +import org.opentripplanner.raptor.spi.RaptorSlackProvider; +import org.opentripplanner.utils.time.TimeUtils; + +/** + * This test case construct two Raptor paths for forward and reverse search, with and without + * opening hours for the flex access and egress. + *

    + * Case A with flex access and egress and one transit: + *

      + *
    1. Flex access
    2. + *
    3. Transit, BUS A
    4. + *
    5. Flex egress
    6. + *
    + *

    + * Case B with walking between transit and flex: + *

      + *
    1. Flex access
    2. + *
    3. Walk transfer
    4. + *
    5. Transit. BUS B
    6. + *
    7. Walk transfer
    8. + *
    9. Flex egress
    10. + *
    + */ +public class AccessAndEgressWithOpeningHoursPathTestCase implements RaptorTestConstants { + + private static final int ZERO = 0; + // The transit reluctance is ignored, any value should work + private static final int TRANSIT_RELUCTANCE_INDEX = -1; + public static final double WAIT_RELUCTANCE = 0.8; + public static final int BOARD_C1_SEC = 60; + public static final int TRANSFER_C1_SEC = 120; + // The C1_CALCULATOR is not under test, so we use it to calculate correct cost values. + public static final TestCostCalculator C1_CALCULATOR = new TestCostCalculator( + BOARD_C1_SEC, + TRANSFER_C1_SEC, + WAIT_RELUCTANCE, + null + ); + + public static final RaptorSlackProvider SLACK_PROVIDER = new DefaultSlackProvider( + TRANSFER_SLACK, + BOARD_SLACK, + ALIGHT_SLACK + ); + + // FLEX Access 5m tx 1 ~ A. Note! The actual times might get time-shifted. + public static final int ACCESS_DURATION = durationInSeconds("5m15s"); + public static final int ACCESS_C1 = toRaptorCost(600); + // Using transfer reluctance is incorrect, we should use the cost from the access path + public static final TestAccessEgress ACCESS = TestAccessEgress.flex( + STOP_A, + ACCESS_DURATION, + ONE_RIDE, + ACCESS_C1 + ); + // Alternative Flex access with restricted opening hours: 09:00 - 09:50 + public static final int ACCESS_OPEN = time("09:00"); + public static final int ACCESS_CLOSE = time("09:50"); + public static final TestAccessEgress ACCESS_W_OPENING_HOURS = ACCESS.openingHours( + ACCESS_OPEN, + ACCESS_CLOSE + ); + + // Transfers (A ~ Walk 1m ~ B) (Used in Case B only) + public static final int TX1_START = time("10:05:15"); + public static final int TX1_END = time("10:06:15"); + public static final int TX1_DURATION = TX1_END - TX1_START; + public static final RaptorTransfer TX1_TRANSFER = TestTransfer.transfer(STOP_B, TX1_DURATION); + public static final RaptorTransfer TX1_TRANSFER_REV = TestTransfer.transfer(STOP_A, TX1_DURATION); + public static final int TX1_C1 = TX1_TRANSFER.c1(); + + // Trip A (B ~ BUS L11 10:08 10:20 ~ C) + public static final int L1_START = time("10:08"); + public static final int L1_END = time("10:20"); + // The departure time with transfer_slack excluded + public static final int L1_STOP_ARR_TIME = L1_END + ALIGHT_SLACK; + public static final int L1_STOP_ARR_TIME_REV = L1_START - BOARD_SLACK; + + // Wait at least 1m45s (45s BOARD_SLACK and 60s TRANSFER_SLACK) + public static final int L1_TRANSIT_DURATION = L1_END - L1_START; + + // Transfers (C ~ Walk 2m ~ D) (Used in Case B only) + public static final int TX2_START = time("10:20:15"); + public static final int TX2_END = time("10:22:15"); + public static final int TX2_DURATION = TX2_END - TX2_START; + public static final RaptorTransfer TX2_TRANSFER = TestTransfer.transfer(STOP_D, TX2_DURATION); + public static final RaptorTransfer TX2_TRANSFER_REV = TestTransfer.transfer(STOP_C, TX2_DURATION); + public static final int TX2_C1 = TX2_TRANSFER.c1(); + + // Wait 15s (ALIGHT_SLACK) + // D ~ FLEX Egress 6m tx 1 . Note! The actual times might get time-shifted. + public static final int EGRESS_DURATION = durationInSeconds("6m"); + public static final int EGRESS_C1 = toRaptorCost(800); + // Using transfer reluctance is incorrect, we should use the cost from the egress path + public static final TestAccessEgress EGRESS = TestAccessEgress.flex( + STOP_D, + EGRESS_DURATION, + ONE_RIDE, + EGRESS_C1 + ); + public static final int EGRESS_OPENING = TimeUtils.time("10:30"); + public static final int EGRESS_CLOSING = TimeUtils.time("11:00"); + public static final TestAccessEgress EGRESS_W_OPENING_HOURS = EGRESS.openingHours( + EGRESS_OPENING, + EGRESS_CLOSING + ); + + public static final int EGRESS_C1_W_1M_SLACK = + EGRESS_C1 + toRaptorCost(TRANSFER_C1_SEC) + C1_CALCULATOR.waitCost(TRANSFER_SLACK); + public static final int EGRESS_C1_W_7M45S_SLACK = + EGRESS_C1_W_1M_SLACK + C1_CALCULATOR.waitCost(durationInSeconds("6m45s")); + public static final int EGRESS_C1_W_9M45S_SLACK = + EGRESS_C1_W_1M_SLACK + C1_CALCULATOR.waitCost(durationInSeconds("8m45s")); + + public static final String LINE_A = "A"; + public static final String LINE_B = "B"; + + public static final TestTripSchedule TRIP_A = TestTripSchedule + .schedule(TestTripPattern.pattern(LINE_A, STOP_A, STOP_D)) + .times(L1_START, L1_END) + .build(); + + public static final TestTripSchedule TRIP_B = TestTripSchedule + .schedule(TestTripPattern.pattern(LINE_B, STOP_B, STOP_C)) + .times(L1_START, L1_END) + .build(); + + public static final int L1_C1_EX_WAIT = C1_CALCULATOR.transitArrivalCost( + C1_CALCULATOR.boardingCostRegularTransfer(false, L1_START, STOP_B, L1_START), + ZERO, + L1_TRANSIT_DURATION, + TRIP_A, + STOP_C + ); + + private static final int TOT_C1_A = toRaptorCost(2564); + private static final int TOT_C1_W_OPENING_HOURS_A = toRaptorCost(3512); + private static final int TOT_C1_B = toRaptorCost(2924); + private static final int TOT_C1_W_OPENING_HOURS_B = toRaptorCost(3728); + // Wait before 12m45s + ALIGHT SLACK 15s + private static final int L1_C1_INC_WAIT_W_OPENING_HOURS_A = + L1_C1_EX_WAIT + C1_CALCULATOR.waitCost(durationInSeconds("13m")); + private static final int L1_C1_INC_WAIT_W_OPENING_HOURS_B = + L1_C1_EX_WAIT + C1_CALCULATOR.waitCost(durationInSeconds("12m")); + + /* TEST CASES WITH EXPECTED TO-STRING TEXTS */ + + public static DestinationArrival flexCaseAForwardSearch() { + return flexForwardSearch(ACCESS, EGRESS, LINE_A); + } + + public static String flexCaseAText() { + return String.format( + "Flex 5m15s 1x 10:01 10:06:15 %s ~ A 1m45s ~ " + + "BUS A 10:08 10:20 12m C₁996 ~ D 1m15s ~ " + + "Flex 6m 1x 10:21:15 10:27:15 %s " + + "[10:01 10:27:15 26m15s Tₓ2 %s]", + RaptorCostConverter.toString(ACCESS_C1), + RaptorCostConverter.toString(EGRESS_C1_W_1M_SLACK), + RaptorCostConverter.toString(TOT_C1_A) + ); + } + + public static DestinationArrival flexCaseBForwardSearch() { + return flexForwardSearch(ACCESS, EGRESS, LINE_B); + } + + public static String flexCaseBText() { + return String.format( + "Flex 5m15s 1x 10:00 10:05:15 %s ~ A 0s ~ " + + "Walk 1m 10:05:15 10:06:15 C₁120 ~ B 1m45s ~ " + + "BUS B 10:08 10:20 12m C₁996 ~ C 15s ~ " + + "Walk 2m 10:20:15 10:22:15 C₁240 ~ D 1m ~ " + + "Flex 6m 1x 10:23:15 10:29:15 %s" + + " [10:00 10:29:15 29m15s Tₓ2 %s]", + RaptorCostConverter.toString(ACCESS_C1), + RaptorCostConverter.toString(EGRESS_C1_W_1M_SLACK), + RaptorCostConverter.toString(TOT_C1_B) + ); + } + + public static DestinationArrival flexCaseAWithOpeningHoursForwardSearch() { + return flexForwardSearch(ACCESS_W_OPENING_HOURS, EGRESS_W_OPENING_HOURS, LINE_A); + } + + public static String flexCaseAWithOpeningHoursText() { + return String.format( + "Flex 5m15s 1x Open(9:00 9:50) 9:50 9:55:15 %s ~ A 12m45s ~ " + + "BUS A 10:08 10:20 12m %s ~ D 10m ~ " + + "Flex 6m 1x Open(10:30 11:00) 10:30 10:36 %s " + + "[9:50 10:36 46m Tₓ2 %s]", + formatC1(ACCESS_C1), + formatC1(L1_C1_INC_WAIT_W_OPENING_HOURS_A), + formatC1(EGRESS_C1_W_9M45S_SLACK), + formatC1(TOT_C1_W_OPENING_HOURS_A) + ); + } + + public static DestinationArrival flexCaseBWithOpeningHoursForwardSearch() { + return flexForwardSearch(ACCESS_W_OPENING_HOURS, EGRESS_W_OPENING_HOURS, LINE_B); + } + + public static String flexCaseBWithOpeningHoursText() { + return String.format( + "Flex 5m15s 1x Open(9:00 9:50) 9:50 9:55:15 %s ~ A 0s ~ " + + "Walk 1m 9:55:15 9:56:15 C₁120 ~ B 11m45s ~ " + + "BUS B 10:08 10:20 12m %s ~ C 15s ~ " + + "Walk 2m 10:20:15 10:22:15 C₁240 ~ D 7m45s ~ " + + "Flex 6m 1x Open(10:30 11:00) 10:30 10:36 %s" + + " [9:50 10:36 46m Tₓ2 %s]", + formatC1(ACCESS_C1), + formatC1(L1_C1_INC_WAIT_W_OPENING_HOURS_B), + formatC1(EGRESS_C1_W_7M45S_SLACK), + formatC1(TOT_C1_W_OPENING_HOURS_B) + ); + } + + public static DestinationArrival flexCaseAReverseSearch() { + return flexReverseSearch(ACCESS, EGRESS, LINE_A); + } + + public static DestinationArrival flexCaseBReverseSearch() { + return flexReverseSearch(ACCESS, EGRESS, LINE_B); + } + + public static DestinationArrival flexCaseAWithOpeningHoursReverseSearch() { + return flexReverseSearch(ACCESS_W_OPENING_HOURS, EGRESS_W_OPENING_HOURS, LINE_A); + } + + public static DestinationArrival flexCaseBWithOpeningHoursReverseSearch() { + return flexReverseSearch(ACCESS_W_OPENING_HOURS, EGRESS_W_OPENING_HOURS, LINE_B); + } + + @Test + public void testSetup() { + // Assert test data is configured correct + + // Assert all durations + assertEquals(TX1_END - TX1_START, TX1_DURATION); + assertEquals(L1_END - L1_START, L1_TRANSIT_DURATION); + assertEquals(TX2_END - TX2_START, TX2_DURATION); + + // Asset proper wait times + int txBoardSlack = TRANSFER_SLACK + BOARD_SLACK; + assertEquals(TX1_END + txBoardSlack, L1_START); + assertEquals(L1_END + ALIGHT_SLACK, TX2_START); + + // Assert cost + // The calculator is not under test here, so we assert everything is as expected + assertEquals(12000, TX1_C1); + assertEquals(90000, L1_C1_EX_WAIT); + assertEquals(24000, TX2_C1); + } + + /* PRIVATE METHODS */ + + private static DestinationArrival flexForwardSearch( + RaptorAccessEgress accessPath, + RaptorAccessEgress egressPath, + String line + ) { + int departureTime, arrivalTime, waitTime; + ArrivalView prevArrival; + + if (LINE_A.equals(line)) { + // The latest time the access can arrive is the same as the TX1 arrival time in case B + arrivalTime = accessPath.latestArrivalTime(TX1_END); + prevArrival = access(accessPath.stop(), arrivalTime, accessPath); + + int waitCost = costL1ForwardIncWait(prevArrival.arrivalTime()); + prevArrival = bus(2, STOP_D, L1_STOP_ARR_TIME, waitCost, 0, TRIP_A, prevArrival); + } else { + arrivalTime = accessPath.latestArrivalTime(TX1_START); + prevArrival = access(accessPath.stop(), arrivalTime, accessPath); + int timeShift = TX1_START - prevArrival.arrivalTime(); + + prevArrival = new Transfer(1, TX1_END - timeShift, TX1_TRANSFER, prevArrival); + + int waitCost = costL1ForwardIncWait(prevArrival.arrivalTime()); + prevArrival = bus(2, STOP_C, L1_STOP_ARR_TIME, waitCost, 0, TRIP_B, prevArrival); + + prevArrival = new Transfer(2, TX2_END, TX2_TRANSFER, prevArrival); + } + + // Egress + departureTime = prevArrival.arrivalTime() + TRANSFER_SLACK; + // Time-shift departure time + departureTime = egressPath.earliestDepartureTime(departureTime); + arrivalTime = departureTime + egressPath.durationInSeconds(); + waitTime = departureTime - prevArrival.arrivalTime(); + int additionalCost = + egressPath.c1() + toRaptorCost(waitTime * WAIT_RELUCTANCE + TRANSFER_C1_SEC); + + return new DestinationArrival<>( + egressPath, + prevArrival, + arrivalTime, + additionalCost, + RaptorConstants.NOT_SET + ); + } + + private static DestinationArrival flexReverseSearch( + RaptorAccessEgress accessPath, + RaptorAccessEgress egressPath, + String line + ) { + int departureTime, arrivalTime, cost; + ArrivalView prevArrival; + + if (LINE_A.equals(line)) { + arrivalTime = L1_END + ALIGHT_SLACK + TRANSFER_SLACK; + arrivalTime = egressPath.earliestDepartureTime(arrivalTime); + prevArrival = access(egressPath.stop(), arrivalTime, egressPath); + + cost = costL1ReverseIncWait(prevArrival.arrivalTime()); + prevArrival = bus(2, STOP_A, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_A, prevArrival); + } else { + arrivalTime = L1_END + ALIGHT_SLACK + TX2_DURATION + TRANSFER_SLACK; + arrivalTime = egressPath.earliestDepartureTime(arrivalTime); + prevArrival = access(egressPath.stop(), arrivalTime, egressPath); + arrivalTime = prevArrival.arrivalTime() - TX2_DURATION; + prevArrival = new Transfer(1, arrivalTime, TX2_TRANSFER_REV, prevArrival); + cost = costL1ReverseIncWait(prevArrival.arrivalTime()); + prevArrival = bus(2, STOP_B, L1_STOP_ARR_TIME_REV, cost, 0, TRIP_B, prevArrival); + arrivalTime = prevArrival.arrivalTime() - TX1_DURATION; + prevArrival = new Transfer(2, arrivalTime, TX1_TRANSFER_REV, prevArrival); + } + + // Access + departureTime = prevArrival.arrivalTime() - TRANSFER_SLACK; + // Time-shift departure time + departureTime = accessPath.latestArrivalTime(departureTime); + arrivalTime = departureTime - accessPath.durationInSeconds(); + int waitTime = prevArrival.arrivalTime() - departureTime; + int additionalCost = + accessPath.c1() + toRaptorCost(waitTime * WAIT_RELUCTANCE + TRANSFER_C1_SEC); + + return new DestinationArrival<>( + accessPath, + prevArrival, + arrivalTime, + additionalCost, + RaptorConstants.NOT_SET + ); + } + + private static int costL1ForwardIncWait(int prevArrivalTime) { + int waitTime = L1_START - prevArrivalTime + ALIGHT_SLACK; + return toRaptorCost(waitTime * WAIT_RELUCTANCE) + L1_C1_EX_WAIT; + } + + private static int costL1ReverseIncWait(int prevArrivalTime) { + int waitTime = (prevArrivalTime - L1_END) + BOARD_SLACK; + return toRaptorCost(waitTime * WAIT_RELUCTANCE) + L1_C1_EX_WAIT; + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java similarity index 96% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java index 88aa857f76a..5163140e40f 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/BasicPathTestCase.java @@ -1,14 +1,14 @@ package org.opentripplanner.raptor._data.stoparrival; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.model.transfer.TransferConstraint.REGULAR_TRANSFER; import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.access; import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.bus; import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.egress; import static org.opentripplanner.raptor._data.stoparrival.TestArrivals.transfer; import static org.opentripplanner.raptor._data.transit.TestAccessEgress.flexWithOnBoard; import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorTransferConstraint.REGULAR_TRANSFER; import static org.opentripplanner.utils.time.DurationUtils.durationToStr; import static org.opentripplanner.utils.time.TimeUtils.time; @@ -17,6 +17,7 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor._data.transit.TestAccessEgress; +import org.opentripplanner.raptor._data.transit.TestCostCalculator; import org.opentripplanner.raptor._data.transit.TestTransfer; import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; @@ -34,7 +35,6 @@ import org.opentripplanner.raptor.rangeraptor.lifecycle.LifeCycleSubscriptions; import org.opentripplanner.raptor.rangeraptor.path.DestinationArrival; import org.opentripplanner.raptor.spi.RaptorCostCalculator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; /** * This class is used to create a journeys with stop arrivals. @@ -96,7 +96,7 @@ public class BasicPathTestCase implements RaptorTestConstants { /** Stop cost for stop NA, A, C, E .. H is zero(0), B: 30s, and D: 60s. ?=0, A=1 .. H=8 */ private static final int[] STOP_C1S = { 0, 0, 3_000, 0, 6_000, 0, 0, 0, 0, 0 }; - // Some times which should not have eny effect on tests + // These times should not have eny effect on tests private static final int VERY_EARLY = time("00:00"); private static final int VERY_LATE = time("23:59"); @@ -195,13 +195,11 @@ public class BasicPathTestCase implements RaptorTestConstants { public static final TestTripSchedule TRIP_1 = TestTripSchedule .schedule(pattern(LINE_11, STOP_A, STOP_B)) .times(L11_START, L11_END) - .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) .build(); public static final TestTripSchedule TRIP_2 = TestTripSchedule .schedule(pattern(LINE_21, STOP_C, STOP_D)) .times(L21_START, L21_END) - .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) .build(); public static final TestTripSchedule TRIP_3 = TestTripSchedule @@ -209,14 +207,12 @@ public class BasicPathTestCase implements RaptorTestConstants { // The early arrival and late departure should not have any effect on tests .arrivals(VERY_EARLY, L31_END) .departures(L31_START, VERY_LATE) - .transitReluctanceIndex(TRANSIT_RELUCTANCE_INDEX) .build(); - public static final RaptorCostCalculator C1_CALCULATOR = new DefaultCostCalculator<>( + public static final RaptorCostCalculator C1_CALCULATOR = new TestCostCalculator( BOARD_C1_SEC, TRANSFER_C1_SEC, WAIT_RELUCTANCE, - TRANSIT_RELUCTANCE, STOP_C1S ); diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Egress.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/TestArrivals.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transfer.java diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/stoparrival/Transit.java diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/BoardAlightRestrictions.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/BoardAlightRestrictions.java new file mode 100644 index 00000000000..b18082f71ca --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/BoardAlightRestrictions.java @@ -0,0 +1,98 @@ +package org.opentripplanner.raptor._data.transit; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; + +public class BoardAlightRestrictions { + + private static final EnumSet BOARDING_ONLY = EnumSet.of( + BoardAlightRestriction.BOARDING + ); + private static final EnumSet ALIGHTING_ONLY = EnumSet.of( + BoardAlightRestriction.ALIGHTING + ); + private static final EnumSet ALL_ALLOWED = EnumSet.allOf( + BoardAlightRestriction.class + ); + private static final EnumSet NONE_ALLOWED = EnumSet.noneOf( + BoardAlightRestriction.class + ); + + private final List> restrictions; + + private BoardAlightRestrictions(List> restrictions) { + if (restrictions.isEmpty()) { + throw new IllegalArgumentException("At least one stop is required."); + } + this.restrictions = restrictions; + } + + public static BoardAlightRestrictions noRestriction(int size) { + var list = new ArrayList>(size); + for (int i = 0; i < size; i++) { + list.add(ALL_ALLOWED); + } + return new BoardAlightRestrictions(List.copyOf(list)); + } + + /** + * Set alight and board restriction using a "coded" string, use space as a separator + * between stops. + *
    +   * Codes:
    +   *   b : Board
    +   *   a : Alight
    +   *   * : Board & Alight
    +   *   - : Boarding & Alighting is not allowed
    +   *
    +   * Example:   B BA * A
    +   * 
    + */ + public static BoardAlightRestrictions restrictions(String restrictions) { + var codes = restrictions.toLowerCase().trim().split("\\s"); + var list = new ArrayList>(); + for (String code : codes) { + if ("a".equals(code)) { + list.add(ALIGHTING_ONLY); + } else if ("b".equals(code)) { + list.add(BOARDING_ONLY); + } else if (code.matches("ab|ba|\\*")) { + list.add(ALL_ALLOWED); + } else if ("-".equals(code)) { + list.add(NONE_ALLOWED); + } + } + return new BoardAlightRestrictions(list); + } + + public boolean isBoardingPossibleAt(int stopPositionInPattern) { + return restrictions.get(stopPositionInPattern).contains(BoardAlightRestriction.BOARDING); + } + + public boolean isAlightingPossibleAt(int stopPositionInPattern) { + return restrictions.get(stopPositionInPattern).contains(BoardAlightRestriction.ALIGHTING); + } + + @Override + public String toString() { + var buf = new StringBuilder(); + for (int i = 0; i < restrictions.size(); ++i) { + if (isAlightingPossibleAt(i) && isBoardingPossibleAt(i)) { + buf.append(" *"); + } else if (isAlightingPossibleAt(i)) { + buf.append(" A"); + } else if (isBoardingPossibleAt(i)) { + buf.append(" B"); + } else { + buf.append(" Ø"); + } + } + return buf.substring(1); + } + + private enum BoardAlightRestriction { + BOARDING, + ALIGHTING, + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java index c58240126de..4714c92939c 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestAccessEgress.java @@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.opentripplanner.raptor._data.RaptorTestConstants.SECONDS_IN_A_DAY; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; import java.util.ArrayList; import java.util.Collection; diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java similarity index 95% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java index 5e8980dc50a..2b0e09bd397 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedBoardingSearch.java @@ -9,7 +9,6 @@ import java.util.function.BiPredicate; import java.util.stream.Collectors; import javax.annotation.Nullable; -import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; import org.opentripplanner.raptor.spi.RaptorTimeTable; @@ -55,7 +54,7 @@ public RaptorBoardOrAlightEvent find( var trip = tx.getSourceTrip(); if (trip == sourceTrip) { int stopPos = trip.findDepartureStopPosition(prevTransitArrivalTime, sourceStopIndex); - boolean boardAlightPossible = timeAfterOrEqual.test(tx.getTime(), prevTransitArrivalTime); + boolean boardAlightPossible = timeAfterOrEqual.test(tx.time(), prevTransitArrivalTime); if (tx.getSourceStopPos() == stopPos && boardAlightPossible) { return tx.boardingEvent(tx.isFacilitated() ? prevTransitArrivalTime : earliestBoardTime); } @@ -95,7 +94,7 @@ void addConstraintTransfers( int targetTripIndex, int targetStopPos, int targetTime, - TransferConstraint constraint + TestTransferConstraint constraint ) { List list = transfersByFromStopPos.get(targetStopPos); if (list == null) { diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java new file mode 100644 index 00000000000..132d20465ac --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestConstrainedTransfer.java @@ -0,0 +1,139 @@ +package org.opentripplanner.raptor._data.transit; + +import static org.opentripplanner.raptor.api.model.RaptorConstants.NOT_SET; + +import java.util.function.Consumer; +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; +import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +class TestConstrainedTransfer + implements RaptorConstrainedTransfer, RaptorBoardOrAlightEvent { + + private final TestTransferConstraint transferConstraint; + private final TestTripSchedule sourceTrip; + private final int sourceStopPos; + private final TestTripSchedule targetTrip; + private final int targetStopPos; + private final int targetTripIndex; + private final int targetTime; + + private int earliestBoardTime = NOT_SET; + + TestConstrainedTransfer( + TestTransferConstraint transferConstraint, + TestTripSchedule sourceTrip, + int sourceStopPos, + TestTripSchedule targetTrip, + int targetStopPos, + int targetTripIndex, + int targetTime + ) { + this.transferConstraint = transferConstraint; + this.sourceTrip = sourceTrip; + this.sourceStopPos = sourceStopPos; + this.targetTrip = targetTrip; + this.targetTripIndex = targetTripIndex; + this.targetStopPos = targetStopPos; + this.targetTime = targetTime; + } + + @Override + public int tripIndex() { + return targetTripIndex; + } + + @Override + public TestTripSchedule trip() { + return targetTrip; + } + + @Override + public int stopPositionInPattern() { + return targetStopPos; + } + + @Override + public int time() { + return targetTime; + } + + @Override + public int earliestBoardTime() { + return earliestBoardTime; + } + + @Override + public RaptorTransferConstraint transferConstraint() { + return transferConstraint; + } + + @Override + public boolean empty() { + return false; + } + + @Override + public void boardWithFallback( + Consumer> boardCallback, + Consumer> alternativeBoardingFallback + ) { + if (empty()) { + alternativeBoardingFallback.accept(this); + } else if (!transferConstraint.isNotAllowed()) { + boardCallback.accept(this); + } + } + + public boolean isFacilitated() { + return transferConstraint.isStaySeated() || transferConstraint.isGuaranteed(); + } + + @Nullable + @Override + public RaptorTransferConstraint getTransferConstraint() { + return transferConstraint; + } + + TestTripSchedule getSourceTrip() { + return sourceTrip; + } + + int getSourceStopPos() { + return sourceStopPos; + } + + RaptorBoardOrAlightEvent boardingEvent(int earliestBoardingTime) { + this.earliestBoardTime = earliestBoardingTime; + return this; + } + + public boolean match( + TestTripSchedule sourceTrip, + int sourceStopPos, + TestTripSchedule targetTrip, + int targetStopPos + ) { + return ( + this.sourceTrip.equals(sourceTrip) && + this.sourceStopPos == sourceStopPos && + this.targetTrip.equals(targetTrip) && + this.targetStopPos == targetStopPos + ); + } + + @Override + public String toString() { + return ToStringBuilder + .of(TestConstrainedTransfer.class) + .addObj("sourceTrip", sourceTrip) + .addNum("sourceStopPos", sourceStopPos) + .addObj("targetTrip", targetTrip) + .addNum("targetTripIndex", targetTripIndex) + .addNum("targetStopPos", targetStopPos) + .addServiceTime("targetTime", targetTime) + .toString(); + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestCostCalculator.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestCostCalculator.java new file mode 100644 index 00000000000..ab2d4ae3476 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestCostCalculator.java @@ -0,0 +1,199 @@ +package org.opentripplanner.raptor._data.transit; + +import javax.annotation.Nullable; +import org.opentripplanner.raptor.api.model.RaptorAccessEgress; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; +import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; +import org.opentripplanner.raptor.spi.RaptorCostCalculator; + +/** + * The responsibility for the cost calculator is to calculate the default multi-criteria cost. + *

    + * This class is immutable and thread safe. + */ +public final class TestCostCalculator implements RaptorCostCalculator { + + private static final int TRANSIT_RELUCTANCE = RaptorCostConverter.toRaptorCost(1); + + private final int boardCost; + private final int transferCost; + private final int waitFactor; + + /** + * Costs for boarding and alighting at a given stop during transfer. + * See TransitLayer.getStopBoardAlightTransferCosts() + */ + @Nullable + private final int[] stopBoardAlightTransferCosts; + + /** + * Cost unit: SECONDS - The unit for all input parameters are in the OTP TRANSIT model cost unit + * (in Raptor the unit for cost is centi-seconds). + * + * @param stopBoardAlightTransferCosts Unit centi-seconds. This parameter is used "as-is" and not + * transformed into the Raptor cast unit to avoid the transformation for each + * request. Use {@code null} to ignore stop cost. + */ + public TestCostCalculator( + int boardCost, + int transferCost, + double waitReluctanceFactor, + @Nullable int[] stopBoardAlightTransferCosts + ) { + this.boardCost = RaptorCostConverter.toRaptorCost(boardCost); + this.transferCost = RaptorCostConverter.toRaptorCost(transferCost); + this.waitFactor = RaptorCostConverter.toRaptorCost(waitReluctanceFactor); + this.stopBoardAlightTransferCosts = stopBoardAlightTransferCosts; + } + + @Override + public int boardingCost( + boolean firstBoarding, + int prevArrivalTime, + int boardStop, + int boardTime, + TestTripSchedule trip, + RaptorTransferConstraint transferConstraints + ) { + if (transferConstraints.isRegularTransfer()) { + return boardingCostRegularTransfer(firstBoarding, prevArrivalTime, boardStop, boardTime); + } else { + return boardingCostConstrainedTransfer( + prevArrivalTime, + boardStop, + boardTime, + firstBoarding, + transferConstraints + ); + } + } + + @Override + public int onTripRelativeRidingCost(int boardTime, TestTripSchedule tripScheduledBoarded) { + // The relative-transit-time is time spent on transit. We do not know the alight-stop, so + // it is impossible to calculate the "correct" time. But the only thing that maters is that + // the relative difference between to boardings are correct, assuming riding the same trip. + // So, we can use the negative board time as relative-transit-time. + return -boardTime * TRANSIT_RELUCTANCE; + } + + @Override + public int transitArrivalCost( + int boardCost, + int alightSlack, + int transitTime, + TestTripSchedule trip, + int toStop + ) { + int cost = boardCost + TRANSIT_RELUCTANCE * transitTime + waitFactor * alightSlack; + + // Add transfer cost on all alighting events. + // If it turns out to be the last one this cost will be removed during costEgress phase. + if (stopBoardAlightTransferCosts != null) { + cost += stopBoardAlightTransferCosts[toStop]; + } + + return cost; + } + + @Override + public int waitCost(int waitTimeInSeconds) { + return waitFactor * waitTimeInSeconds; + } + + @Override + public int calculateRemainingMinCost(int minTravelTime, int minNumTransfers, int fromStop) { + if (minNumTransfers > -1) { + return ( + boardCost + + ((boardCost + transferCost) * minNumTransfers) + + (TRANSIT_RELUCTANCE * minTravelTime) + ); + } else { + // Remove cost that was added during alighting similar as we do in the costEgress() method + return stopBoardAlightTransferCosts == null + ? (TRANSIT_RELUCTANCE * minTravelTime) + : (TRANSIT_RELUCTANCE * minTravelTime) - stopBoardAlightTransferCosts[fromStop]; + } + } + + @Override + public int costEgress(RaptorAccessEgress egress) { + if (egress.hasRides()) { + return egress.c1() + transferCost; + } else if (stopBoardAlightTransferCosts != null) { + // Remove cost that was added during alighting. + // We do not want to add this cost on last alighting since it should only be applied on transfers + // It has to be done here because during alighting we do not know yet if it will be + // a transfer or not. + return egress.c1() - stopBoardAlightTransferCosts[egress.stop()]; + } else { + return egress.c1(); + } + } + + /** This is public for test purposes only */ + public int boardingCostRegularTransfer( + boolean firstBoarding, + int prevArrivalTime, + int boardStop, + int boardTime + ) { + // Calculate the wait-time before the boarding which should be accounted for in the cost + // calculation. Any slack at the end of the last leg is not part of this, because it is + // already accounted for. If the previous leg is an access leg, then it is already + // time-shifted, which is important for this calculation to be correct. + final int boardWaitTime = boardTime - prevArrivalTime; + + int cost = waitFactor * boardWaitTime; + + cost += firstBoarding ? boardCost : (boardCost + transferCost); + + // If it's first boarding event then it is not a transfer + if (stopBoardAlightTransferCosts != null && !firstBoarding) { + cost += stopBoardAlightTransferCosts[boardStop]; + } + return cost; + } + + /* private methods */ + + private int boardingCostConstrainedTransfer( + int prevArrivalTime, + int boardStop, + int boardTime, + boolean firstBoarding, + RaptorTransferConstraint txConstraints + ) { + // This cast could be avoided, if we added another generic type to the Raptor component, + // but it would be rather messy, just to avoid a single cast. + var tx = (TestTransferConstraint) txConstraints; + + if (tx.isStaySeated()) { + final int boardWaitTime = boardTime - prevArrivalTime; + // For a stay-seated transfer the wait-time is spent on-board and we should use the + // transitReluctance, not the waitReluctance, to find the cost of the time since + // the stop arrival. So we take the time and multiply it with the transit reluctance. + // + // Note! if the boarding happens BEFORE the previous stop arrival, we will get a + // negative time - this is ok, so we allow it in this calculation. + // + // The previous stop arrival might have a small alight-slack, this should be replaced + // with "on-board" time, but the slack should be short and the differance between + // transit reluctance and wait reluctance is also small, so we ignore this. + // + return TRANSIT_RELUCTANCE * boardWaitTime; + } else if (tx.isGuaranteed()) { + // For a guaranteed transfer we skip board- and transfer-cost + final int boardWaitTime = boardTime - prevArrivalTime; + + // StopBoardAlightTransferCost is NOT added to the cost here. This is because a trip-to-trip + // constrained transfer take precedence over stop-to-stop transfer priority (NeTEx station + // transfer priority). + return waitFactor * boardWaitTime; + } + + // fallback to regular transfer + return boardingCostRegularTransfer(firstBoarding, prevArrivalTime, boardStop, boardTime); + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java new file mode 100644 index 00000000000..2cd87a065ea --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestRoute.java @@ -0,0 +1,144 @@ +package org.opentripplanner.raptor._data.transit; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.opentripplanner.raptor.api.model.SearchDirection; +import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; +import org.opentripplanner.raptor.spi.RaptorRoute; +import org.opentripplanner.raptor.spi.RaptorTimeTable; +import org.opentripplanner.raptor.spi.RaptorTripScheduleSearch; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +public class TestRoute implements RaptorRoute, RaptorTimeTable { + + private final TestTripPattern pattern; + private final List schedules = new ArrayList<>(); + private final TestConstrainedBoardingSearch transferConstraintsForwardSearch = new TestConstrainedBoardingSearch( + true + ); + private final TestConstrainedBoardingSearch transferConstraintsReverseSearch = new TestConstrainedBoardingSearch( + false + ); + + private TestRoute(TestTripPattern pattern) { + this.pattern = pattern; + } + + public static TestRoute route(TestTripPattern pattern) { + return new TestRoute(pattern); + } + + public static TestRoute route(String name, int... stopIndexes) { + return route(TestTripPattern.pattern(name, stopIndexes)); + } + + /* RaptorRoute */ + + @Override + public RaptorTimeTable timetable() { + return this; + } + + @Override + public TestTripPattern pattern() { + return pattern; + } + + public RaptorConstrainedBoardingSearch transferConstraintsForwardSearch() { + return transferConstraintsForwardSearch; + } + + public RaptorConstrainedBoardingSearch transferConstraintsReverseSearch() { + return transferConstraintsReverseSearch; + } + + /* RaptorTimeTable */ + + @Override + public TestTripSchedule getTripSchedule(int index) { + return schedules.get(index); + } + + @Override + public int numberOfTripSchedules() { + return schedules.size(); + } + + @Override + public RaptorTripScheduleSearch tripSearch(SearchDirection direction) { + return new TestTripScheduleSearch(direction, schedules); + } + + public List listTransferConstraintsForwardSearch() { + return transferConstraintsForwardSearch.constrainedBoardings(); + } + + public TestRoute withTimetable(TestTripSchedule... trips) { + Collections.addAll(schedules, trips); + return this; + } + + public TestRoute withTimetable(TestTripSchedule.Builder... scheduleBuilders) { + for (TestTripSchedule.Builder builder : scheduleBuilders) { + var tripSchedule = builder.pattern(pattern).build(); + schedules.add(tripSchedule); + } + return this; + } + + @Override + public String toString() { + return ToStringBuilder + .of(TestRoute.class) + .addObj("pattern", pattern) + .addObj("schedules", schedules) + .toString(); + } + + void clearTransferConstraints() { + transferConstraintsForwardSearch.clear(); + transferConstraintsReverseSearch.clear(); + } + + /** + * Add a transfer constraint to the route by iterating over all trips and matching the provided + * {@code toTrip}(added to forward search) {@code fromTrip}(added to reverse search) with the rips + * in the route timetable. + */ + void addTransferConstraint( + TestTripSchedule fromTrip, + int fromStopPos, + TestTripSchedule toTrip, + int toStopPos, + TestTransferConstraint constraint + ) { + for (int i = 0; i < timetable().numberOfTripSchedules(); i++) { + var trip = timetable().getTripSchedule(i); + if (toTrip == trip) { + this.transferConstraintsForwardSearch.addConstraintTransfers( + fromTrip, + fromStopPos, + trip, + i, + toStopPos, + trip.arrival(toStopPos), + constraint + ); + } + // Reverse search transfer, the {@code source/target} is the trips in order of the + // reverse search, which is opposite from {@code from/to} in the result path. + if (fromTrip == trip) { + this.transferConstraintsReverseSearch.addConstraintTransfers( + toTrip, + toStopPos, + trip, + i, + fromStopPos, + trip.departure(fromStopPos), + constraint + ); + } + } + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java similarity index 86% rename from application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java rename to raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java index 5645f6342d6..b90fd5f7c46 100644 --- a/application/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransfer.java @@ -1,6 +1,6 @@ package org.opentripplanner.raptor._data.transit; -import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost; +import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost; import org.opentripplanner.raptor.api.model.RaptorTransfer; @@ -18,6 +18,10 @@ public static TestTransfer transfer(int stop, int durationInSeconds, int cost) { return new TestTransfer(stop, durationInSeconds, cost); } + public TestTransfer reverse(int stop) { + return new TestTransfer(stop, durationInSeconds, cost); + } + public static int walkCost(int durationInSeconds) { return walkCost(durationInSeconds, DEFAULT_WALK_RELUCTANCE); } diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferConstraint.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferConstraint.java new file mode 100644 index 00000000000..c630c6a8bbb --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransferConstraint.java @@ -0,0 +1,84 @@ +package org.opentripplanner.raptor._data.transit; + +import java.io.Serializable; +import java.util.Objects; +import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; + +/** + * This class holds transfer constraint information. + *

    + * The class is immutable. + */ +public class TestTransferConstraint implements Serializable, RaptorTransferConstraint { + + private enum Type { + NOT_ALLOWED, + STAY_SEATED, + GUARANTEED; + + boolean is(Type type) { + return this == type; + } + } + + private final Type type; + + public TestTransferConstraint(Type type) { + this.type = type; + } + + public static TestTransferConstraint notAllowed() { + return new TestTransferConstraint(Type.NOT_ALLOWED); + } + + public static TestTransferConstraint staySeated() { + return new TestTransferConstraint(Type.STAY_SEATED); + } + + public static TestTransferConstraint guaranteed() { + return new TestTransferConstraint(Type.GUARANTEED); + } + + public static RaptorTransferConstraint regular() { + return RaptorTransferConstraint.REGULAR_TRANSFER; + } + + public boolean isGuaranteed() { + return type.is(Type.GUARANTEED); + } + + @Override + public boolean isNotAllowed() { + return type.is(Type.NOT_ALLOWED); + } + + @Override + public boolean isRegularTransfer() { + return false; + } + + @Override + public boolean isStaySeated() { + return type.is(Type.STAY_SEATED); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof final TestTransferConstraint that)) { + return false; + } + return type == that.type; + } + + public String toString() { + return "{" + type + "}"; + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java new file mode 100644 index 00000000000..edd87c16b48 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTransitData.java @@ -0,0 +1,347 @@ +package org.opentripplanner.raptor._data.transit; + +import static org.opentripplanner.raptor._data.transit.TestRoute.route; +import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; +import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import javax.annotation.Nullable; +import org.opentripplanner.raptor._data.RaptorTestConstants; +import org.opentripplanner.raptor.api.model.RaptorConstrainedTransfer; +import org.opentripplanner.raptor.api.model.RaptorStopNameResolver; +import org.opentripplanner.raptor.api.model.RaptorTransfer; +import org.opentripplanner.raptor.api.model.RaptorTripPattern; +import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; +import org.opentripplanner.raptor.rangeraptor.SystemErrDebugLogger; +import org.opentripplanner.raptor.spi.DefaultSlackProvider; +import org.opentripplanner.raptor.spi.IntIterator; +import org.opentripplanner.raptor.spi.RaptorConstrainedBoardingSearch; +import org.opentripplanner.raptor.spi.RaptorCostCalculator; +import org.opentripplanner.raptor.spi.RaptorPathConstrainedTransferSearch; +import org.opentripplanner.raptor.spi.RaptorRoute; +import org.opentripplanner.raptor.spi.RaptorSlackProvider; +import org.opentripplanner.raptor.spi.RaptorTimeTable; +import org.opentripplanner.raptor.spi.RaptorTransitDataProvider; +import org.opentripplanner.raptor.util.BitSetIterator; + +@SuppressWarnings("UnusedReturnValue") +public class TestTransitData + implements RaptorTransitDataProvider, RaptorTestConstants { + + public static final TestTransferConstraint TX_GUARANTEED = TestTransferConstraint.guaranteed(); + public static final TestTransferConstraint TX_NOT_ALLOWED = TestTransferConstraint.notAllowed(); + + // Slack defaults: 1 minute for transfer-slack, 0 minutes for board- and alight-slack. + public static final RaptorSlackProvider SLACK_PROVIDER = new DefaultSlackProvider(60, 0, 0); + + private final List> transfersFromStop = new ArrayList<>(); + private final List> transfersToStop = new ArrayList<>(); + private final List> routeIndexesByStopIndex = new ArrayList<>(); + private final List routes = new ArrayList<>(); + private final List constrainedTransfers = new ArrayList<>(); + private int boardCostSec = 600; + private int transferCostSec = 0; + private double waitReluctance = 1.0; + + private final int[] stopBoardAlightTransferCosts = new int[NUM_STOPS]; + + private RaptorSlackProvider slackProvider = SLACK_PROVIDER; + + @Override + public Iterator getTransfersFromStop(int fromStop) { + return transfersFromStop.get(fromStop).iterator(); + } + + @Override + public Iterator getTransfersToStop(int toStop) { + return transfersToStop.get(toStop).iterator(); + } + + @Override + public IntIterator routeIndexIterator(IntIterator stops) { + BitSet routes = new BitSet(); + while (stops.hasNext()) { + int stop = stops.next(); + for (int i : routeIndexesByStopIndex.get(stop)) { + routes.set(i); + } + } + return new BitSetIterator(routes); + } + + @Override + public RaptorRoute getRouteForIndex(int routeIndex) { + return this.routes.get(routeIndex); + } + + @Override + public int numberOfStops() { + return routeIndexesByStopIndex.size(); + } + + @Override + public RaptorCostCalculator multiCriteriaCostCalculator() { + return new TestCostCalculator( + boardCostSec, + transferCostSec, + waitReluctance, + stopBoardAlightTransferCosts() + ); + } + + @Override + public RaptorSlackProvider slackProvider() { + return slackProvider; + } + + public TestTransitData withSlackProvider(RaptorSlackProvider slackProvider) { + this.slackProvider = slackProvider; + return this; + } + + @Override + public RaptorPathConstrainedTransferSearch transferConstraintsSearch() { + return new RaptorPathConstrainedTransferSearch<>() { + @Nullable + @Override + public RaptorConstrainedTransfer findConstrainedTransfer( + TestTripSchedule fromTrip, + int fromStopPosition, + TestTripSchedule toTrip, + int toStopPosition + ) { + var list = routes + .stream() + .flatMap(r -> r.listTransferConstraintsForwardSearch().stream()) + .filter(tx -> tx.match(fromTrip, fromStopPosition, toTrip, toStopPosition)) + .toList(); + + if (list.isEmpty()) { + return null; + } + if (list.size() == 1) { + return list.get(0); + } + throw new IllegalStateException("More than on transfers found: " + list); + } + }; + } + + @Override + public RaptorStopNameResolver stopNameResolver() { + // Index is translated: 1->'A', 2->'B', 3->'C' ... + return this::stopIndexToName; + } + + @Override + public int getValidTransitDataStartTime() { + return this.routes.stream() + .mapToInt(route -> route.timetable().getTripSchedule(0).departure(0)) + .min() + .orElseThrow(); + } + + @Override + public int getValidTransitDataEndTime() { + return this.routes.stream() + .mapToInt(route -> { + RaptorTimeTable timetable = route.timetable(); + RaptorTripPattern pattern = route.pattern(); + return timetable + .getTripSchedule(timetable.numberOfTripSchedules() - 1) + .departure(pattern.numberOfStopsInPattern() - 1); + }) + .max() + .orElseThrow(); + } + + @Override + public RaptorConstrainedBoardingSearch transferConstraintsForwardSearch( + int routeIndex + ) { + return getRoute(routeIndex).transferConstraintsForwardSearch(); + } + + @Override + public RaptorConstrainedBoardingSearch transferConstraintsReverseSearch( + int routeIndex + ) { + return getRoute(routeIndex).transferConstraintsReverseSearch(); + } + + public TestRoute getRoute(int index) { + return routes.get(index); + } + + public void debugToStdErr(RaptorRequestBuilder request, boolean dryRun) { + var debug = request.debug(); + + if (debug.stops().isEmpty()) { + debug.addStops(stopsVisited()); + } + var logger = new SystemErrDebugLogger(true, dryRun); + + debug + .stopArrivalListener(logger::stopArrivalLister) + .patternRideDebugListener(logger::patternRideLister) + .pathFilteringListener(logger::pathFilteringListener) + .logger(logger); + } + + public TestTransitData withRoute(TestRoute route) { + this.routes.add(route); + int routeIndex = this.routes.indexOf(route); + var pattern = route.pattern(); + for (int i = 0; i < pattern.numberOfStopsInPattern(); ++i) { + int stopIndex = pattern.stopIndex(i); + expandNumOfStops(stopIndex); + routeIndexesByStopIndex.get(stopIndex).add(routeIndex); + } + return this; + } + + /** + * Same as: + *

    +   * withRoute(
    +   *   route(pattern(routeName, stopIndexes))
    +   *     .withTimetable(schedule().times(times))
    +   * )
    +   * 
    + */ + public TestTransitData withTransit(String routeName, String times, int... stopIndexes) { + return withRoute(route(pattern(routeName, stopIndexes)).withTimetable(schedule().times(times))); + } + + public TestTransitData withRoutes(TestRoute... routes) { + for (TestRoute route : routes) { + withRoute(route); + } + return this; + } + + public TestTransitData withTransfer(int fromStop, TestTransfer transfer) { + expandNumOfStops(Math.max(fromStop, transfer.stop())); + transfersFromStop.get(fromStop).add(transfer); + transfersToStop.get(transfer.stop()).add(transfer.reverse(fromStop)); + return this; + } + + public TestTransitData withTransferCost(int transferCostSec) { + this.transferCostSec = transferCostSec; + return this; + } + + public TestTransitData withGuaranteedTransfer( + TestTripSchedule fromTrip, + int fromStop, + TestTripSchedule toTrip, + int toStop + ) { + return withConstrainedTransfer(fromTrip, fromStop, toTrip, toStop, TX_GUARANTEED); + } + + public void clearConstrainedTransfers() { + constrainedTransfers.clear(); + for (TestRoute route : routes) { + route.clearTransferConstraints(); + } + } + + /** + * Create constraint for a given transfer. If trip passes through the stop more than once + * constraint will be placed on stop position for the first visit. + * @param fromTrip initial trip + * @param fromStop initial stop index + * @param toTrip destination trip + * @param toStop destination trip index + * @param constraint constraint to set + */ + public TestTransitData withConstrainedTransfer( + TestTripSchedule fromTrip, + int fromStop, + TestTripSchedule toTrip, + int toStop, + TestTransferConstraint constraint + ) { + int fromStopPos = fromTrip.pattern().findStopPositionAfter(0, fromStop); + int toStopPos = toTrip.pattern().findStopPositionAfter(0, toStop); + + for (TestRoute route : routes) { + route.addTransferConstraint(fromTrip, fromStopPos, toTrip, toStopPos, constraint); + } + constrainedTransfers.add( + new TestConstrainedTransfer( + constraint, + fromTrip, + fromStopPos, + toTrip, + toStopPos, + toTrip.tripSortIndex(), + toTrip.departure(toStopPos) + ) + ); + return this; + } + + public TestTransitData withStopBoardAlightTransferCost(int stop, int boardAlightTransferCost) { + stopBoardAlightTransferCosts[stop] = boardAlightTransferCost; + return this; + } + + public TestConstrainedTransfer findConstrainedTransfer( + TestTripSchedule fromTrip, + int fromStop, + int fromStopPosition, + TestTripSchedule toTrip, + int toStop, + int toStopPosition + ) { + for (var tx : constrainedTransfers) { + if (tx.match(fromTrip, fromStopPosition, toTrip, toStopPosition)) { + return tx; + } + } + return null; + } + + public TestTransitData withBoardCost(int boardCostSec) { + this.boardCostSec = boardCostSec; + return this; + } + + public TestTransitData withWaitReluctance(double waitReluctance) { + this.waitReluctance = waitReluctance; + return this; + } + + /* private methods */ + + private int[] stopBoardAlightTransferCosts() { + // Not implemented, no test for this yet. + return stopBoardAlightTransferCosts; + } + + private void expandNumOfStops(int stopIndex) { + for (int i = numberOfStops(); i <= stopIndex; ++i) { + transfersFromStop.add(new ArrayList<>()); + transfersToStop.add(new ArrayList<>()); + routeIndexesByStopIndex.add(new HashSet<>()); + } + } + + private List stopsVisited() { + final List stops = new ArrayList<>(); + for (int i = 0; i < routeIndexesByStopIndex.size(); i++) { + if (!routeIndexesByStopIndex.get(i).isEmpty()) { + stops.add(i); + } + } + return stops; + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java new file mode 100644 index 00000000000..e9b6613500b --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripPattern.java @@ -0,0 +1,160 @@ +package org.opentripplanner.raptor._data.transit; + +import java.util.Objects; +import org.opentripplanner.raptor.api.model.RaptorTripPattern; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +public class TestTripPattern implements RaptorTripPattern { + + private final String name; + private final int[] stopIndexes; + private final BoardAlightRestrictions restrictions; + private final int slackIndex; + private final int patternIndex; + private final int priorityGroupId; + + private TestTripPattern( + String name, + int[] stopIndexes, + BoardAlightRestrictions restrictions, + int slackIndex, + int patternIndex, + int priorityGroupId + ) { + this.name = Objects.requireNonNull(name); + this.stopIndexes = Objects.requireNonNull(stopIndexes); + this.restrictions = Objects.requireNonNull(restrictions); + this.slackIndex = slackIndex; + this.patternIndex = patternIndex; + this.priorityGroupId = priorityGroupId; + } + + public static TestTripPattern.Builder of(String name, int... stopIndexes) { + return new TestTripPattern.Builder(name, stopIndexes); + } + + public static TestTripPattern pattern(String name, int... stopIndexes) { + return of(name, stopIndexes).build(); + } + + /** Create a pattern with name 'R1' and given stop indexes */ + public static TestTripPattern pattern(int... stopIndexes) { + return pattern("R1", stopIndexes); + } + + @Override + public int stopIndex(int stopPositionInPattern) { + return stopIndexes[stopPositionInPattern]; + } + + @Override + public boolean boardingPossibleAt(int stopPositionInPattern) { + return restrictions.isBoardingPossibleAt(stopPositionInPattern); + } + + @Override + public boolean alightingPossibleAt(int stopPositionInPattern) { + return restrictions.isAlightingPossibleAt(stopPositionInPattern); + } + + @Override + public int slackIndex() { + return slackIndex; + } + + @Override + public int priorityGroupId() { + return priorityGroupId; + } + + @Override + public int patternIndex() { + return patternIndex; + } + + @Override + public int numberOfStopsInPattern() { + return stopIndexes.length; + } + + @Override + public String debugInfo() { + return "BUS " + name; + } + + @Override + public String toString() { + return ToStringBuilder + .of(TestTripPattern.class) + .addStr("name", name) + .addInts("stops", stopIndexes) + .addObj("restrictions", restrictions) + .toString(); + } + + public static class Builder { + + private final String name; + private int[] stopIndexes; + private String restrictions; + private int slackIndex = 0; + private int patternIndex = 0; + private int priorityGroupId = 0; + + public Builder(String name, int... stopIndexes) { + this.name = name; + this.stopIndexes = stopIndexes; + } + + public Builder pattern(int... stopIndexes) { + this.stopIndexes = stopIndexes; + return this; + } + + /** + * Set alight and board restriction using a "coded" string, use space as a separator + * between stops. + *
    +     * Codes:
    +     *   b : Board
    +     *   a : Alight
    +     *   * : Board & Alight
    +     *   - : Boarding & Alighting is not allowed
    +     *
    +     * Example:   B BA * A
    +     * 
    + */ + public Builder restrictions(String restrictions) { + this.restrictions = restrictions; + return this; + } + + public Builder slackIndex(int index) { + this.slackIndex = index; + return this; + } + + public Builder patternIndex(int index) { + this.patternIndex = index; + return this; + } + + public Builder priorityGroup(int priorityGroupId) { + this.priorityGroupId = priorityGroupId; + return this; + } + + public TestTripPattern build() { + return new TestTripPattern( + name, + stopIndexes, + restrictions == null + ? BoardAlightRestrictions.noRestriction(stopIndexes.length) + : BoardAlightRestrictions.restrictions(restrictions), + slackIndex, + patternIndex, + priorityGroupId + ); + } + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java new file mode 100644 index 00000000000..cbce4a642e0 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripSchedule.java @@ -0,0 +1,216 @@ +package org.opentripplanner.raptor._data.transit; + +import java.util.Arrays; +import java.util.stream.IntStream; +import org.opentripplanner.raptor.api.model.RaptorTripPattern; +import org.opentripplanner.raptor.api.model.RaptorTripSchedule; +import org.opentripplanner.utils.lang.IntUtils; +import org.opentripplanner.utils.time.TimeUtils; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +/** + * An implementation of the {@link RaptorTripSchedule} for unit-testing. + */ +public class TestTripSchedule implements RaptorTripSchedule { + + private static final int DEFAULT_DEPARTURE_DELAY = 10; + private final int[] arrivalTimes; + private final int[] departureTimes; + private final RaptorTripPattern pattern; + + protected TestTripSchedule(TestTripPattern pattern, int[] arrivalTimes, int[] departureTimes) { + this.pattern = pattern; + this.arrivalTimes = arrivalTimes; + this.departureTimes = departureTimes; + } + + public static TestTripSchedule.Builder schedule() { + return new TestTripSchedule.Builder(); + } + + public static TestTripSchedule.Builder schedule(TestTripPattern pattern) { + return schedule().pattern(pattern); + } + + public static TestTripSchedule.Builder schedule(String times) { + return new TestTripSchedule.Builder().times(times); + } + + @Override + public int tripSortIndex() { + // We sort trips based on the departure from the first stop + return arrival(0); + } + + @Override + public int arrival(int stopPosInPattern) { + return arrivalTimes[stopPosInPattern]; + } + + @Override + public int departure(int stopPosInPattern) { + return departureTimes[stopPosInPattern]; + } + + @Override + public RaptorTripPattern pattern() { + return pattern; + } + + public int size() { + return arrivalTimes.length; + } + + @Override + public String toString() { + if (Arrays.equals(arrivalTimes, departureTimes)) { + return ToStringBuilder + .of(TestTripSchedule.class) + .addServiceTimeSchedule("times", arrivalTimes) + .toString(); + } + return ToStringBuilder + .of(TestTripSchedule.class) + .addServiceTimeSchedule("arrivals", arrivalTimes) + .addServiceTimeSchedule("departures", departureTimes) + .toString(); + } + + @SuppressWarnings("UnusedReturnValue") + public static class Builder { + + private TestTripPattern pattern; + private int[] arrivalTimes; + private int[] departureTimes; + private int arrivalDepartureOffset = DEFAULT_DEPARTURE_DELAY; + + public TestTripSchedule.Builder pattern(TestTripPattern pattern) { + this.pattern = pattern; + return this; + } + + public TestTripSchedule.Builder copy() { + var b = new TestTripSchedule.Builder(); + b.pattern = pattern; + b.arrivalTimes = arrivalTimes; + b.departureTimes = departureTimes; + b.arrivalDepartureOffset = arrivalDepartureOffset; + return b; + } + + public TestTripSchedule.Builder pattern(String name, int... stops) { + return pattern(TestTripPattern.pattern(name, stops)); + } + + /** @param times departure and arrival times per stop. Example: "0:10, 0:20, 0:45 .." */ + public TestTripSchedule.Builder times(String times) { + return times(TimeUtils.times(times)); + } + + /** @param times departure and arrival times per stop in seconds past midnight. */ + public TestTripSchedule.Builder times(int... times) { + arrivals(times); + departures(times); + return this; + } + + /** @param arrivalTimes arrival times per stop. Example: "0:10, 0:20, 0:45 .. */ + public TestTripSchedule.Builder arrivals(String arrivalTimes) { + return this.arrivals(TimeUtils.times(arrivalTimes)); + } + + /** @param arrivalTimes arrival times per stop in seconds past midnight. */ + public TestTripSchedule.Builder arrivals(int... arrivalTimes) { + this.arrivalTimes = arrivalTimes; + return this; + } + + /** @param departureTimes departure times per stop. Example: "0:10, 0:20, 0:45 .. */ + public TestTripSchedule.Builder departures(String departureTimes) { + return this.departures(TimeUtils.times(departureTimes)); + } + + /** @param departureTimes departure times per stop in seconds past midnight. */ + public TestTripSchedule.Builder departures(int... departureTimes) { + this.departureTimes = departureTimes; + return this; + } + + /** + * The time between arrival and departure for each stop in the pattern. If not both arrival and + * departure times are set, this parameter is used to calculate the unset values. + *

    + * Unit: seconds. The default is 10 seconds. + */ + public TestTripSchedule.Builder arrDepOffset(int arrivalDepartureOffset) { + this.arrivalDepartureOffset = arrivalDepartureOffset; + return this; + } + + /** + * Shift all arrival/departure times by the given {@code offset}. Be careful, this + * method change the builder instance, use {@link #copy()} if you need the original. + *

    + * Offset unit is seconds. + */ + public TestTripSchedule.Builder shiftTimes(int offset) { + if (arrivalTimes == departureTimes) { + arrivalTimes = departureTimes = IntUtils.shiftArray(offset, arrivalTimes); + } else { + if (arrivalTimes != null) { + arrivalTimes = IntUtils.shiftArray(offset, arrivalTimes); + } + if (departureTimes != null) { + departureTimes = IntUtils.shiftArray(offset, departureTimes); + } + } + return this; + } + + public TestTripSchedule.Builder[] repeat(int nTimes, int everySeconds) { + return IntStream + .range(0, nTimes) + .mapToObj(i -> copy().shiftTimes(i * everySeconds)) + .toArray(Builder[]::new); + } + + public TestTripSchedule build() { + if (arrivalTimes == null) { + arrivalTimes = copyWithOffset(departureTimes, -arrivalDepartureOffset); + } else if (departureTimes == null) { + departureTimes = copyWithOffset(arrivalTimes, arrivalDepartureOffset); + } + if (arrivalTimes.length != departureTimes.length) { + throw new IllegalStateException( + "Number of arrival and departure times do not match." + + " Arrivals: " + + arrivalTimes.length + + ", departures: " + + arrivalTimes.length + ); + } + if (pattern == null) { + pattern = TestTripPattern.pattern("DummyPattern", new int[arrivalTimes.length]); + } + if (arrivalTimes.length != pattern.numberOfStopsInPattern()) { + throw new IllegalStateException( + "Number of arrival and departure times do not match stops in pattern." + + " Arrivals/departures: " + + arrivalTimes.length + + ", stops: " + + pattern.numberOfStopsInPattern() + ); + } + + return new TestTripSchedule(pattern, arrivalTimes, departureTimes); + } + + private static int[] copyWithOffset(int[] source, int offset) { + int[] target = new int[source.length]; + for (int i = 0; i < source.length; i++) { + target[i] = source[i] + offset; + } + return target; + } + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearch.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearch.java new file mode 100644 index 00000000000..7e9a73e162e --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearch.java @@ -0,0 +1,122 @@ +package org.opentripplanner.raptor._data.transit; + +import static org.opentripplanner.raptor.api.model.RaptorConstants.NOT_FOUND; +import static org.opentripplanner.raptor.api.model.RaptorConstants.TIME_NOT_SET; + +import java.util.List; +import org.opentripplanner.raptor.api.model.RaptorTransferConstraint; +import org.opentripplanner.raptor.api.model.SearchDirection; +import org.opentripplanner.raptor.spi.RaptorBoardOrAlightEvent; +import org.opentripplanner.raptor.spi.RaptorTripScheduleSearch; +import org.opentripplanner.utils.tostring.ToStringBuilder; + +class TestTripScheduleSearch + implements + RaptorTripScheduleSearch, RaptorBoardOrAlightEvent { + + private final List trips; + private final SearchDirection direction; + + private int tripIndex; + private int stopPositionInPattern; + /** + * earliest-board-time in forward search, and latest-arrival-time for reverse search + */ + private int timeLimit; + private int time; + + public TestTripScheduleSearch(SearchDirection direction, List trips) { + this.trips = trips; + this.direction = direction; + this.tripIndex = NOT_FOUND; + this.time = TIME_NOT_SET; + } + + @Override + public RaptorBoardOrAlightEvent search( + int earliestBoardTime, + int stopPositionInPattern, + int tripIndexLimit + ) { + this.tripIndex = NOT_FOUND; + this.stopPositionInPattern = stopPositionInPattern; + this.timeLimit = earliestBoardTime; + + return direction.isForward() ? searchForward(tripIndexLimit) : searchInReverse(tripIndexLimit); + } + + private RaptorBoardOrAlightEvent searchForward(int tripIndexLimit) { + final int end = tripIndexLimit == UNBOUNDED_TRIP_INDEX ? trips.size() - 1 : tripIndexLimit - 1; + + for (int i = 0; i <= end; ++i) { + int departureTime = trips.get(i).departure(stopPositionInPattern); + if (timeLimit <= departureTime) { + this.time = departureTime; + this.tripIndex = i; + return this; + } + } + return RaptorBoardOrAlightEvent.empty(timeLimit); + } + + private RaptorBoardOrAlightEvent searchInReverse(int tripIndexLimit) { + final int end = tripIndexLimit == UNBOUNDED_TRIP_INDEX ? 0 : tripIndexLimit + 1; + + for (int i = trips.size() - 1; i >= end; --i) { + int arrivalTime = trips.get(i).arrival(stopPositionInPattern); + if (timeLimit >= arrivalTime) { + this.time = arrivalTime; + this.tripIndex = i; + return this; + } + } + return RaptorBoardOrAlightEvent.empty(timeLimit); + } + + @Override + public int tripIndex() { + return tripIndex; + } + + @Override + public TestTripSchedule trip() { + return trips.get(tripIndex); + } + + @Override + public int stopPositionInPattern() { + return stopPositionInPattern; + } + + @Override + public int time() { + return time; + } + + @Override + public int earliestBoardTime() { + return timeLimit; + } + + @Override + public RaptorTransferConstraint transferConstraint() { + return RaptorTransferConstraint.REGULAR_TRANSFER; + } + + @Override + public boolean empty() { + return tripIndex == NOT_FOUND; + } + + @Override + public String toString() { + return ToStringBuilder + .of(TestTripScheduleSearch.class) + .addBoolIfTrue("REVERSE", direction.isInReverse()) + .addNum("tripIndex", tripIndex, NOT_FOUND) + .addNum("stopPos", stopPositionInPattern) + .addServiceTime("timeLimit", timeLimit) + .addServiceTime("time", time, TIME_NOT_SET) + .toString(); + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearchTest.java b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearchTest.java new file mode 100644 index 00000000000..db4ff4610ba --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_data/transit/TestTripScheduleSearchTest.java @@ -0,0 +1,175 @@ +package org.opentripplanner.raptor._data.transit; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opentripplanner.raptor.api.model.RaptorConstants.NOT_FOUND; +import static org.opentripplanner.raptor.api.model.SearchDirection.FORWARD; +import static org.opentripplanner.raptor.api.model.SearchDirection.REVERSE; + +import java.util.List; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.opentripplanner.raptor._data.RaptorTestConstants; +import org.opentripplanner.raptor.api.model.SearchDirection; +import org.opentripplanner.utils.time.TimeUtils; + +/** + * This tests another test class - we do it to make sure the + * {@link TestTripScheduleSearch} is following the Raptor SPI contract. + */ +class TestTripScheduleSearchTest implements RaptorTestConstants { + + private static final int NOT_DEFINED = -999_999; + private static final int T09_59_59 = TimeUtils.time("09:59:59"); + private static final int T10_00_00 = TimeUtils.time("10:00:00"); + private static final int T10_00_01 = TimeUtils.time("10:00:01"); + private static final int T10_09_59 = TimeUtils.time("10:09:59"); + private static final int T10_10_00 = TimeUtils.time("10:10:00"); + private static final int T10_10_01 = TimeUtils.time("10:10:01"); + private static final int T10_19_59 = TimeUtils.time("10:19:59"); + private static final int T10_20_00 = TimeUtils.time("10:20:00"); + private static final int T10_20_01 = TimeUtils.time("10:20:01"); + + private static final int TRIP_ONE = 0; + private static final int TRIP_TWO = 1; + + private static final TestTripPattern PATTERN = TestTripPattern.pattern("R1", STOP_A, STOP_B); + + private static final List ONE_TRIP = List.of( + TestTripSchedule.schedule(PATTERN).times("10:00 10:10").build() + ); + + private static final List TWO_TRIPS = List.of( + TestTripSchedule.schedule(PATTERN).times("10:00 10:10").build(), + TestTripSchedule.schedule(PATTERN).times("10:10 10:20").build() + ); + + static List tripSearchWithOneTripTestCases() { + return List.of( + Arguments.of(FORWARD, STOP_POS_0, T09_59_59, T10_00_00, Status.OK), + Arguments.of(FORWARD, STOP_POS_0, T10_00_00, T10_00_00, Status.OK), + Arguments.of(FORWARD, STOP_POS_0, T10_00_01, NOT_DEFINED, Status.EMPTY), + Arguments.of(FORWARD, STOP_POS_1, T10_09_59, T10_10_00, Status.OK), + Arguments.of(FORWARD, STOP_POS_1, T10_10_00, T10_10_00, Status.OK), + Arguments.of(FORWARD, STOP_POS_1, T10_10_01, NOT_DEFINED, Status.EMPTY), + Arguments.of(REVERSE, STOP_POS_0, T09_59_59, NOT_DEFINED, Status.EMPTY), + Arguments.of(REVERSE, STOP_POS_0, T10_00_00, T10_00_00, Status.OK), + Arguments.of(REVERSE, STOP_POS_0, T10_00_01, T10_00_00, Status.OK), + Arguments.of(REVERSE, STOP_POS_1, T10_09_59, NOT_DEFINED, Status.EMPTY), + Arguments.of(REVERSE, STOP_POS_1, T10_10_00, T10_10_00, Status.OK), + Arguments.of(REVERSE, STOP_POS_1, T10_10_01, T10_10_00, Status.OK) + ); + } + + @ParameterizedTest + @MethodSource("tripSearchWithOneTripTestCases") + void tripSearchWithOneTrip( + SearchDirection direction, + int stopPos, + int searchTime, + int expTime, + Status expStatus + ) { + var search = new TestTripScheduleSearch(direction, ONE_TRIP); + var result = search.search(searchTime, stopPos); + + if (expStatus == Status.EMPTY) { + assertTrue(result.empty()); + assertTime(searchTime, result.earliestBoardTime()); + assertEquals(NOT_FOUND, result.tripIndex()); + } else if (expStatus == Status.OK) { + assertFalse(result.empty()); + assertEquals(stopPos, result.stopPositionInPattern()); + assertTime(expTime, result.time()); + assertTime(searchTime, result.earliestBoardTime()); + assertEquals(0, result.tripIndex()); + } + + if (!result.empty()) { + // A second search fails if the first search succeeded + int tripIndex = result.tripIndex(); + var e = search.search(direction.isForward() ? T09_59_59 : T10_20_01, stopPos, tripIndex); + assertTrue(e.empty()); + } + } + + static List tripSearchWithTwoTripsTestCases() { + return List.of( + Arguments.of(FORWARD, STOP_POS_0, T09_59_59, T10_00_00, TRIP_ONE), + Arguments.of(FORWARD, STOP_POS_0, T10_00_00, T10_00_00, TRIP_ONE), + Arguments.of(FORWARD, STOP_POS_0, T10_00_01, T10_10_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_0, T10_09_59, T10_10_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_0, T10_10_00, T10_10_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_0, T10_10_01, NOT_DEFINED, NOT_FOUND), + Arguments.of(FORWARD, STOP_POS_1, T10_09_59, T10_10_00, TRIP_ONE), + Arguments.of(FORWARD, STOP_POS_1, T10_10_00, T10_10_00, TRIP_ONE), + Arguments.of(FORWARD, STOP_POS_1, T10_10_01, T10_20_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_1, T10_19_59, T10_20_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_1, T10_20_00, T10_20_00, TRIP_TWO), + Arguments.of(FORWARD, STOP_POS_1, T10_20_01, NOT_DEFINED, NOT_FOUND), + Arguments.of(REVERSE, STOP_POS_0, T09_59_59, NOT_DEFINED, NOT_FOUND), + Arguments.of(REVERSE, STOP_POS_0, T10_00_00, T10_00_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_0, T10_00_01, T10_00_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_0, T10_09_59, T10_00_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_0, T10_10_00, T10_10_00, TRIP_TWO), + Arguments.of(REVERSE, STOP_POS_0, T10_10_01, T10_10_00, TRIP_TWO), + Arguments.of(REVERSE, STOP_POS_1, T10_09_59, NOT_DEFINED, NOT_FOUND), + Arguments.of(REVERSE, STOP_POS_1, T10_10_00, T10_10_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_1, T10_10_01, T10_10_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_1, T10_19_59, T10_10_00, TRIP_ONE), + Arguments.of(REVERSE, STOP_POS_1, T10_20_00, T10_20_00, TRIP_TWO), + Arguments.of(REVERSE, STOP_POS_1, T10_20_01, T10_20_00, TRIP_TWO) + ); + } + + @ParameterizedTest + @MethodSource("tripSearchWithTwoTripsTestCases") + void tripSearchWithTwoTrips( + SearchDirection direction, + int stopPos, + int searchTime, + int expTime, + int expTripIndex + ) { + var search = new TestTripScheduleSearch(direction, TWO_TRIPS); + var result = search.search(searchTime, stopPos); + + if (expTripIndex == NOT_FOUND) { + assertTrue(result.empty()); + assertTime(searchTime, result.earliestBoardTime()); + assertEquals(NOT_FOUND, result.tripIndex()); + } else { + assertFalse(result.empty()); + assertEquals(stopPos, result.stopPositionInPattern()); + assertTime(expTime, result.time()); + assertTime(searchTime, result.earliestBoardTime()); + assertEquals(expTripIndex, result.tripIndex()); + } + + if (!result.empty()) { + int secondTrip = direction.isForward() ? TRIP_TWO : TRIP_ONE; + int firstTrip = direction.isForward() ? TRIP_ONE : TRIP_TWO; + int tripIndex = result.tripIndex(); + var e = search.search(direction.isForward() ? T09_59_59 : T10_20_01, stopPos, tripIndex); + + if (tripIndex == secondTrip) { + assertFalse(e.empty()); + assertEquals(firstTrip, result.tripIndex()); + } else { + assertTrue(e.empty()); + assertEquals(NOT_FOUND, result.tripIndex()); + } + } + } + + private static void assertTime(int expected, int actual) { + assertEquals(TimeUtils.timeToStrLong(expected), TimeUtils.timeToStrLong(actual)); + } + + private enum Status { + OK, + EMPTY, + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/ArchComponent.java b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/ArchComponent.java new file mode 100644 index 00000000000..eb95bfaf708 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/ArchComponent.java @@ -0,0 +1,35 @@ +package org.opentripplanner.raptor._support.arch; + +import com.tngtech.archunit.core.domain.JavaClasses; +import com.tngtech.archunit.core.importer.ClassFileImporter; +import com.tngtech.archunit.core.importer.ImportOption; +import java.util.Collection; + +public interface ArchComponent { + /** + * ArchUnit cached set of classes in OTP. It takes a bit of time to build the set of + * classes, so it is nice to avoid this for every test. ArchUnit also support JUnit5 + * with a @ArchTest annotation which cache and inject the classes, but the test become + * slightly more complex by using it and chasing it here works fine. + */ + JavaClasses OTP_CLASSES = new ClassFileImporter() + .withImportOption(new ImportOption.DoNotIncludeTests()) + .importPackages("org.opentripplanner"); + + /** + * All Java packages in {@code java.*} and {@code javax.*} + */ + Module JAVA_PACKAGES = Module.of( + Package.of("java.."), + Package.of("javax.(*).."), + Package.of("jakarta.(*)..") + ); + + Module LOG_FRAMEWORK = Module.of(Package.of("org.slf4j")); + + Collection packages(); + + default Collection packageIdentifiers() { + return packages().stream().map(Package::packageIdentifier).toList(); + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Module.java b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Module.java new file mode 100644 index 00000000000..c6b16a8faf5 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Module.java @@ -0,0 +1,23 @@ +package org.opentripplanner.raptor._support.arch; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +public class Module implements ArchComponent { + + private final List packages; + + private Module(List packages) { + this.packages = packages; + } + + public static Module of(ArchComponent... components) { + return new Module(Arrays.stream(components).flatMap(c -> c.packages().stream()).toList()); + } + + @Override + public Collection packages() { + return packages; + } +} diff --git a/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Package.java b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Package.java new file mode 100644 index 00000000000..d87daf06448 --- /dev/null +++ b/raptor/src/test/java/org/opentripplanner/raptor/_support/arch/Package.java @@ -0,0 +1,91 @@ +package org.opentripplanner.raptor._support.arch; + +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; + +import com.tngtech.archunit.lang.ArchRule; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@SuppressWarnings("UnusedReturnValue") +public class Package implements ArchComponent { + + private final String packageIdentifier; + private final Set allowedPackages = new HashSet<>(); + + private Package(String packageIdentifier) { + this.packageIdentifier = packageIdentifier; + } + + public static Package of(String packageIdentifier) { + return new Package(packageIdentifier); + } + + public Package subPackage(String packageIdentifier) { + return new Package(this.packageIdentifier + "." + packageIdentifier); + } + + public String packageIdentifier() { + return packageIdentifier; + } + + public String packageIdentifierAllSubPackages() { + return packageIdentifier + ".(**)"; + } + + public Package dependsOn(ArchComponent... allowedDependencies) { + for (ArchComponent it : allowedDependencies) { + this.allowedPackages.addAll(it.packages()); + } + return this; + } + + @Override + public Set packages() { + return Set.of(this); + } + + public Package verify() { + ArchRule rule = classes() + .that() + .resideInAPackage(packageIdentifier) + .should() + .onlyDependOnClassesThat() + .resideInAnyPackage(allAllowedPackages()); + + rule.check(OTP_CLASSES); + return this; + } + + /** + * This includes the allowed packages plus all globally allowed packages like: + *

      + *
    • Java framework
    • + *
    • Log framework
    • + *
    • Arrays (in package "")
    • + *
    + */ + private String[] allAllowedPackages() { + List all = new ArrayList<>(); + + for (Package p : allowedPackages) { + all.add(p.packageIdentifier()); + } + // Allow all packages to depend on Java + for (Package p : JAVA_PACKAGES.packages()) { + all.add(p.packageIdentifier()); + } + // Allow all packages to depend on the log framework + for (Package p : LOG_FRAMEWORK.packages()) { + all.add(p.packageIdentifier()); + } + // Allow all packages to depend on itself + all.add(packageIdentifier); + + // Allow all packages to depend on array types in package "" (empty) + all.add(""); + + return all.toArray(String[]::new); + } +} diff --git a/application/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/model/GeneralizedCostRelaxFunctionTest.java diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/model/RaptorCostConverterTest.java similarity index 95% rename from application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/model/RaptorCostConverterTest.java index 3827bdd31b6..036ab4d4346 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/cost/RaptorCostConverterTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/api/model/RaptorCostConverterTest.java @@ -1,4 +1,4 @@ -package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost; +package org.opentripplanner.raptor.api.model; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/application/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java index 7ea3c9805f5..e0819717e10 100644 --- a/application/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/api/path/PathTest.java @@ -18,10 +18,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import org.junit.jupiter.api.Test; -import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase; import org.opentripplanner.raptor._data.transit.TestAccessEgress; +import org.opentripplanner.raptor._data.transit.TestTransferConstraint; import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.model.RaptorAccessEgress; import org.opentripplanner.raptor.path.Path; @@ -176,7 +176,7 @@ public void testCountTransfersWithStaySeated() { .times(time("09:10"), time("09:20")) .build(); - var tx = TransferConstraint.of().staySeated().build(); + var tx = TestTransferConstraint.staySeated(); TransitPathLeg leg2 = new TransitPathLeg<>( trip2, trip2.departure(0), diff --git a/application/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/path/RaptorPathTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/request/MultiCriteriaRequestTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/request/PassThroughPointTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/request/RaptorRequestTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/request/SearchParamsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/request/ViaLocationTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java b/raptor/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/api/view/BoardAndAlightTimeTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/A01_SingleRouteTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/A04_BoardingTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/B01_AccessTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/B02_EgressTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/B03_AccessEgressTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/B04_AccessEgressBoardingTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java index df38aabc483..7f2dd2f0072 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/B05_EgressStopBoardAlightTransferCostTest.java @@ -39,7 +39,7 @@ void setup() { .withRoute(route("R1", STOP_B, STOP_C).withTimetable(schedule("0:10, 0:14"))) .withRoute(route("R2", STOP_C, STOP_D).withTimetable(schedule("0:18, 0:20"))); - data.mcCostParamsBuilder().transferCost(0).boardCost(0); + data.withTransferCost(0).withBoardCost(0); data.withStopBoardAlightTransferCost(STOP_D, 60000); requestBuilder diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/C01_TransferBoardAndAlightSlackTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/C02_OnStreetTransfersTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/C03_OnBoardArrivalDominateTransfersTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java similarity index 94% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java index a63c208cae3..cde91ab61f8 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/D01_SingeRouteBoardAlightRestrictionsTest.java @@ -2,7 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; import static org.opentripplanner.raptor.moduletests.support.RaptorModuleTestConfig.multiCriteria; import static org.opentripplanner.raptor.moduletests.support.RaptorModuleTestConfig.standard; @@ -57,8 +56,10 @@ public class D01_SingeRouteBoardAlightRestrictionsTest implements RaptorTestCons */ @BeforeEach void setup() { - TestTripPattern pattern = pattern("R1", STOP_B, STOP_C, STOP_D); - pattern.restrictions("BW BA AW"); + TestTripPattern pattern = TestTripPattern + .of("R1", STOP_B, STOP_C, STOP_D) + .restrictions("B BA A") + .build(); data.withRoute(route(pattern).withTimetable(schedule("00:01, 00:03, 00:05"))); requestBuilder .searchParams() diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java similarity index 93% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java index d1d1f2191f5..16d0ea745fe 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E01_StaySeatedTransferTest.java @@ -10,11 +10,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.opentripplanner.model.transfer.TransferConstraint; import org.opentripplanner.raptor.RaptorService; import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor._data.api.PathUtils; import org.opentripplanner.raptor._data.transit.TestAccessEgress; +import org.opentripplanner.raptor._data.transit.TestTransferConstraint; import org.opentripplanner.raptor._data.transit.TestTransitData; import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; @@ -57,14 +57,8 @@ public void setup() { var tripB = r2.timetable().getTripSchedule(0); data.withRoutes(r1, r2); - data.withConstrainedTransfer( - tripA, - STOP_B, - tripB, - STOP_B, - TransferConstraint.of().staySeated().build() - ); - data.mcCostParamsBuilder().transferCost(100); + data.withConstrainedTransfer(tripA, STOP_B, tripB, STOP_B, TestTransferConstraint.staySeated()); + data.withTransferCost(100); // NOTE! No search-window is set. requestBuilder diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java index c448560c7fb..cd2b1f3c25e 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E02_GuaranteedWalkTransferTest.java @@ -61,7 +61,7 @@ public void setup() { data.withRoutes(r1, r2); data.withGuaranteedTransfer(tripA, STOP_B, tripB, STOP_C); data.withTransfer(STOP_B, TestTransfer.transfer(STOP_C, 30)); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); // NOTE! No search-window is set. requestBuilder diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java index 0866042548d..1a324796784 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/E03_NotAllowedConstrainedTransferTest.java @@ -64,7 +64,7 @@ public void setup() { // transit model, a not-allowed transfer should apply to ALL trips if constraint is passed // to raptor. data.withConstrainedTransfer(tripR1a, STOP_B, tripR2a, STOP_B, TestTransitData.TX_NOT_ALLOWED); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); // NOTE! No search-window set requestBuilder diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java index e93f464826c..96a5a04d7fd 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F01_AccessWithRidesTest.java @@ -20,12 +20,12 @@ import org.opentripplanner.raptor._data.RaptorTestConstants; import org.opentripplanner.raptor._data.transit.TestTransitData; import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; import org.opentripplanner.raptor.moduletests.support.RaptorModuleTestCase; import org.opentripplanner.raptor.spi.DefaultSlackProvider; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; /** * FEATURE UNDER TEST diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F02_EgressWithRidesTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F03_AccessEgressWithRidesBoardAndAlightSlackTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F04_AccessEgressWithRidesNoTransitTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F05_OnBoardAccessEgressAndTransfersTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F11_AccessWithRidesMultipleOptimalPathsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java index 1ec5399a668..40e4ffd567d 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/F12_EgressWithRidesMultipleOptimalPathsTest.java @@ -25,12 +25,12 @@ import org.opentripplanner.raptor._data.transit.TestTransfer; import org.opentripplanner.raptor._data.transit.TestTransitData; import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; import org.opentripplanner.raptor.moduletests.support.RaptorModuleTestCase; import org.opentripplanner.raptor.spi.DefaultSlackProvider; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; /** * FEATURE UNDER TEST diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G01_AccessWithOpeningHoursTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G02_EgressWithOpeningHoursTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G03_AccessWithOpeningHoursMultipleOptionsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G04_EgressWithOpeningHoursMultipleOptionsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G05_ClosedAccessOpeningHoursTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/G06_ClosedEgressOpeningHoursTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java similarity index 96% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java index 9cf2aaf7b82..64e4f728d09 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/H11_GuaranteedTransferWithFlexAccessTest.java @@ -20,11 +20,11 @@ import org.opentripplanner.raptor._data.transit.TestTransfer; import org.opentripplanner.raptor._data.transit.TestTransitData; import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.ModuleTestDebugLogging; import org.opentripplanner.raptor.moduletests.support.RaptorModuleTestCase; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; /** * FEATURE UNDER TEST @@ -54,7 +54,7 @@ public void setup() { data.withRoutes(r1, r2); data.withGuaranteedTransfer(tripA, STOP_C, tripB, STOP_C); data.withTransfer(STOP_A, TestTransfer.transfer(STOP_B, D10m)); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); requestBuilder .searchParams() diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/I01_HeuristicTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java similarity index 98% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java index d37a1adf61f..6047280488a 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/J01_PassThroughTest.java @@ -1,7 +1,7 @@ package org.opentripplanner.raptor.moduletests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.model.plan.PlanTestConstants.D2m; +import static org.opentripplanner.raptor._data.RaptorTestConstants.D2m; import static org.opentripplanner.raptor._data.RaptorTestConstants.D30s; import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_A; import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_B; @@ -163,7 +163,7 @@ void passThroughPointInTheMiddle() { var r2 = route("R2", STOP_A, STOP_C, STOP_D).withTimetable(schedule("0:02 0:10 0:50")); data.withRoutes(r1, r2); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); var requestBuilder = prepareRequest(); @@ -195,7 +195,7 @@ void multiplePassThroughPoints() { .withTimetable(schedule("0:15 0:20 0:30 0:50")); data.withRoutes(r1, r2); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); var requestBuilder = prepareRequest(); diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java similarity index 99% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java index 581cd117cb1..fd872a3d138 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/J02_ViaSearchTest.java @@ -1,8 +1,8 @@ package org.opentripplanner.raptor.moduletests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.model.plan.PlanTestConstants.D2m; import static org.opentripplanner.raptor._data.RaptorTestConstants.D1m; +import static org.opentripplanner.raptor._data.RaptorTestConstants.D2m; import static org.opentripplanner.raptor._data.RaptorTestConstants.D30s; import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_A; import static org.opentripplanner.raptor._data.RaptorTestConstants.STOP_B; @@ -258,7 +258,7 @@ void multipleViaPoints() { ) ); - data.mcCostParamsBuilder().transferCost(100); + data.withTransferCost(100); var requestBuilder = prepareRequest(); diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java similarity index 90% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java index f03eb5335a0..4a08634db93 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/K01_TransitPriorityTest.java @@ -8,7 +8,6 @@ import static org.opentripplanner.raptor._data.api.PathUtils.pathsToString; import static org.opentripplanner.raptor._data.transit.TestAccessEgress.walk; import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; import static org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator.GROUP_A; import static org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator.GROUP_B; @@ -19,13 +18,14 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.raptor.RaptorService; import org.opentripplanner.raptor._data.transit.TestTransitData; +import org.opentripplanner.raptor._data.transit.TestTripPattern; import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.request.RaptorProfile; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.api.request.RaptorTransitGroupPriorityCalculator; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; /** * FEATURE UNDER TEST @@ -54,13 +54,13 @@ public class K01_TransitPriorityTest { @BeforeEach private void prepareRequest() { data.withRoutes( - route(pattern("L1", STOP_B, STOP_C).withPriorityGroup(GROUP_A)) + route(TestTripPattern.of("L1", STOP_B, STOP_C).priorityGroup(GROUP_A).build()) .withTimetable(schedule("00:02 00:12")), - route(pattern("U1", STOP_B, STOP_C).withPriorityGroup(GROUP_A)) + route(TestTripPattern.of("U1", STOP_B, STOP_C).priorityGroup(GROUP_A).build()) .withTimetable(schedule("00:02 00:12:01")), - route(pattern("L2", STOP_B, STOP_C).withPriorityGroup(GROUP_B)) + route(TestTripPattern.of("L2", STOP_B, STOP_C).priorityGroup(GROUP_B).build()) .withTimetable(schedule("00:02 00:13")), - route(pattern("L3", STOP_B, STOP_C).withPriorityGroup(GROUP_C)) + route(TestTripPattern.of("L3", STOP_B, STOP_C).priorityGroup(GROUP_C).build()) .withTimetable(schedule("00:02 00:14")) ); diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java similarity index 90% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java index fb21128728c..e6d1fc38d12 100644 --- a/application/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/K02_TransitPriorityDestinationTest.java @@ -11,7 +11,6 @@ import static org.opentripplanner.raptor._data.api.PathUtils.pathsToString; import static org.opentripplanner.raptor._data.transit.TestAccessEgress.walk; import static org.opentripplanner.raptor._data.transit.TestRoute.route; -import static org.opentripplanner.raptor._data.transit.TestTripPattern.pattern; import static org.opentripplanner.raptor._data.transit.TestTripSchedule.schedule; import static org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator.GROUP_A; import static org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator.GROUP_B; @@ -22,13 +21,14 @@ import org.junit.jupiter.api.Test; import org.opentripplanner.raptor.RaptorService; import org.opentripplanner.raptor._data.transit.TestTransitData; +import org.opentripplanner.raptor._data.transit.TestTripPattern; import org.opentripplanner.raptor._data.transit.TestTripSchedule; +import org.opentripplanner.raptor.api.model.RaptorCostConverter; import org.opentripplanner.raptor.api.request.RaptorProfile; import org.opentripplanner.raptor.api.request.RaptorRequestBuilder; import org.opentripplanner.raptor.api.request.RaptorTransitGroupPriorityCalculator; import org.opentripplanner.raptor.configure.RaptorConfig; import org.opentripplanner.raptor.moduletests.support.TestGroupPriorityCalculator; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter; /** * FEATURE UNDER TEST @@ -56,13 +56,13 @@ private void prepareRequest() { // they are in different groups), but not L3 (which certainly is in its own group but // its cost is outside the range allowed by the slack). data.withRoutes( - route(pattern("L1", STOP_B, STOP_C).withPriorityGroup(GROUP_A)) + route(TestTripPattern.of("L1", STOP_B, STOP_C).priorityGroup(GROUP_A).build()) .withTimetable(schedule("00:02 00:12")), - route(pattern("U1", STOP_B, STOP_D).withPriorityGroup(GROUP_A)) + route(TestTripPattern.of("U1", STOP_B, STOP_D).priorityGroup(GROUP_A).build()) .withTimetable(schedule("00:02 00:12:01")), - route(pattern("L2", STOP_B, STOP_E).withPriorityGroup(GROUP_B)) + route(TestTripPattern.of("L2", STOP_B, STOP_E).priorityGroup(GROUP_B).build()) .withTimetable(schedule("00:02 00:13")), - route(pattern("L3", STOP_B, STOP_F).withPriorityGroup(GROUP_C)) + route(TestTripPattern.of("L3", STOP_B, STOP_F).priorityGroup(GROUP_C).build()) .withTimetable(schedule("00:02 00:14")) ); diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyAccessTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/L01_TimePenaltyEgressTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/F11.svg diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/F12.svg diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/images/Samples.excalidraw diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/package-info.md diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/ExpectedList.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/ModuleTestDebugLogging.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCase.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestCaseFactory.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfig.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/RaptorModuleTestConfigSetBuilder.java diff --git a/application/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java b/raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java rename to raptor/src/test/java/org/opentripplanner/raptor/moduletests/support/TestGroupPriorityCalculator.java diff --git a/application/src/test/java/org/opentripplanner/raptor/package-info.md b/raptor/src/test/java/org/opentripplanner/raptor/package-info.md similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/package-info.md rename to raptor/src/test/java/org/opentripplanner/raptor/package-info.md diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/context/SearchContextTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/internalapi/NoopPassThroughPointsServiceTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/StopArrivalStateParetoSetTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/ArrivalParetoSetComparatorFactoryTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/McStopArrivalTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/AccessStopArrivalTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/StopArrivalFactoryC1Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransferStopArrivalTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c1/TransitStopArrivalTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/AccessStopArrivalC2Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/StopArrivalFactoryC2Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransferStopArrivalC2Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/arrivals/c2/TransitStopArrivalC2Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/passthrough/BitSetPassThroughPointsServiceTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c1/PatternRideC1Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/multicriteria/ride/c2/PatternRideC2Test.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/DestinationArrivalTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java similarity index 69% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java index bac2c1b0431..027d3d5852a 100644 --- a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathMapperTest.java @@ -1,38 +1,38 @@ package org.opentripplanner.raptor.rangeraptor.path; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAForwardSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAReverseSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAText; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAWithOpeningHoursForwardSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAWithOpeningHoursReverseSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseAWithOpeningHoursText; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBForwardSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBReverseSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBText; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBWithOpeningHoursForwardSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBWithOpeningHoursReverseSearch; +import static org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase.flexCaseBWithOpeningHoursText; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.BASIC_PATH_AS_DETAILED_STRING; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.C1_CALCULATOR; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.basicTripByForwardSearch; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.basicTripByReverseSearch; import static org.opentripplanner.raptor._data.stoparrival.BasicPathTestCase.lifeCycle; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAForwardSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAReverseSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAText; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAWithOpeningHoursForwardSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAWithOpeningHoursReverseSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseAWithOpeningHoursText; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBForwardSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBReverseSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBText; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBWithOpeningHoursForwardSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBWithOpeningHoursReverseSearch; -import static org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase.flexCaseBWithOpeningHoursText; import org.junit.jupiter.api.Test; import org.opentripplanner.raptor._data.RaptorTestConstants; -import org.opentripplanner.raptor._data.stoparrival.FlexAccessAndEgressPathTestCase; +import org.opentripplanner.raptor._data.stoparrival.AccessAndEgressWithOpeningHoursPathTestCase; +import org.opentripplanner.raptor._data.transit.TestCostCalculator; import org.opentripplanner.raptor._data.transit.TestTripSchedule; import org.opentripplanner.raptor.api.path.RaptorPath; import org.opentripplanner.raptor.spi.RaptorSlackProvider; -import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.DefaultCostCalculator; public class PathMapperTest implements RaptorTestConstants { private static final RaptorSlackProvider FLEX_SLACK_PROVIDER = - FlexAccessAndEgressPathTestCase.SLACK_PROVIDER; - private static final DefaultCostCalculator FLEX_COST_CALCULATOR = - FlexAccessAndEgressPathTestCase.C1_CALCULATOR; + AccessAndEgressWithOpeningHoursPathTestCase.SLACK_PROVIDER; + private static final TestCostCalculator FLEX_COST_CALCULATOR = + AccessAndEgressWithOpeningHoursPathTestCase.C1_CALCULATOR; /* BASIC CASES */ diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java similarity index 99% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java index 296103499a1..00558b6f63d 100644 --- a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/path/PathParetoSetComparatorsTest.java @@ -21,7 +21,6 @@ import org.opentripplanner.raptor.api.model.GeneralizedCostRelaxFunction; import org.opentripplanner.raptor.api.model.RaptorTripSchedule; import org.opentripplanner.raptor.api.model.RelaxFunction; -import org.opentripplanner.raptor.api.model.SearchDirection; import org.opentripplanner.raptor.api.path.RaptorPath; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetCost; import org.opentripplanner.raptor.rangeraptor.internalapi.ParetoSetTime; diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/standard/besttimes/SimpleArrivedAtDestinationCheckTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/support/IntArraySingleCriteriaArrivalsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessEgressFunctionsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessPathsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/AccessWithPenaltyTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressPathsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/EgressWithPenaltyTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardRaptorTransitCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTimeCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ForwardTransitCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RaptorSearchWindowCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseRaptorTransitCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTimeCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/ReverseTransitCalculatorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/RoundTrackerTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/SlackProviderAdapterTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripScheduleExactMatchSearchTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java b/raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/rangeraptor/transit/TripTimesSearchTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java b/raptor/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/service/HeuristicToRunResolverTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java b/raptor/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java similarity index 87% rename from application/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java index 0ae5a09aa18..76c05386f18 100644 --- a/application/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java +++ b/raptor/src/test/java/org/opentripplanner/raptor/spi/EmptyBoardOrAlightEventTest.java @@ -15,6 +15,6 @@ void testEmptyBoardOrAlightEvent() { assertTrue(subject.empty()); assertEquals(300, subject.earliestBoardTime()); assertEquals(RaptorTransferConstraint.REGULAR_TRANSFER, subject.transferConstraint()); - assertEquals("EmptyBoardOrAlightEvent[earliestBoardTime=300]", subject.toString()); + assertEquals("EmptyBoardOrAlightEvent(00:05:00)", subject.toString()); } } diff --git a/application/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java b/raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorSlackProviderTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java b/raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorTripPatternTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java b/raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/spi/RaptorTripScheduleTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java b/raptor/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/spi/UnknownPathTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/BitSetIteratorTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/IntIteratorsTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/PathStringBuilderTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/composite/CompositeUtilTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerCompositeTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetEventListenerTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/ParetoSetWithMarkerTest.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/TestParetoSetEventListener.java diff --git a/application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java b/raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java similarity index 100% rename from application/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java rename to raptor/src/test/java/org/opentripplanner/raptor/util/paretoset/TestVector.java