diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java index 3662d45affa..177a74a58db 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/AtlantaFareServiceTest.java @@ -32,7 +32,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class AtlantaFareServiceTest implements PlanTestConstants { @@ -262,7 +262,7 @@ private static Leg createLeg(String agencyId, String shortName, long startTimeMi } private static Itinerary createItinerary(String agencyId, String shortName, long startTimeMins) { - var stopModelBuilder = StopModel.of(); + var siteRepositoryBuilder = SiteRepository.of(); Agency agency = Agency .of(new FeedScopedId(FEED_ID, agencyId)) .withName(agencyId) @@ -270,12 +270,12 @@ private static Itinerary createItinerary(String agencyId, String shortName, long .build(); // Set up stops - RegularStop firstStop = stopModelBuilder + RegularStop firstStop = siteRepositoryBuilder .regularStop(new FeedScopedId(FEED_ID, "1")) .withCoordinate(new WgsCoordinate(1, 1)) .withName(new NonLocalizedString("first stop")) .build(); - RegularStop lastStop = stopModelBuilder + RegularStop lastStop = siteRepositoryBuilder .regularStop(new FeedScopedId(FEED_ID, "2")) .withCoordinate(new WgsCoordinate(1, 2)) .withName(new NonLocalizedString("last stop")) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java index d9325d139a8..ccd2303f366 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/FareModelForTest.java @@ -13,8 +13,8 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.FareZone; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; public class FareModelForTest { @@ -25,40 +25,40 @@ public class FareModelForTest { .of(FeedScopedId.ofNullable("F2", "other-feed-zone")) .build(); - private static final StopModelBuilder STOP_MODEL_BUILDER = StopModel.of(); + private static final SiteRepositoryBuilder SITE_REPOSITORY_BUILDER = SiteRepository.of(); - static final RegularStop AIRPORT_STOP = STOP_MODEL_BUILDER + static final RegularStop AIRPORT_STOP = SITE_REPOSITORY_BUILDER .regularStop(id("airport")) .withCoordinate(new WgsCoordinate(1, 1)) .addFareZones(AIRPORT_ZONE) .withName(I18NString.of("Airport")) .build(); - static final RegularStop CITY_CENTER_A_STOP = STOP_MODEL_BUILDER + static final RegularStop CITY_CENTER_A_STOP = SITE_REPOSITORY_BUILDER .regularStop(id("city-center-a")) .withCoordinate(new WgsCoordinate(1, 2)) .addFareZones(CITY_CENTER_ZONE) .withName(I18NString.of("City center: stop A")) .build(); - static final RegularStop CITY_CENTER_B_STOP = STOP_MODEL_BUILDER + static final RegularStop CITY_CENTER_B_STOP = SITE_REPOSITORY_BUILDER .regularStop(id("city-center-b")) .withCoordinate(new WgsCoordinate(1, 3)) .addFareZones(CITY_CENTER_ZONE) .withName(I18NString.of("City center: stop B")) .build(); - static final RegularStop CITY_CENTER_C_STOP = STOP_MODEL_BUILDER + static final RegularStop CITY_CENTER_C_STOP = SITE_REPOSITORY_BUILDER .regularStop(id("city-center-c")) .withCoordinate(new WgsCoordinate(1, 4)) .addFareZones(CITY_CENTER_ZONE) .withName(I18NString.of("City center: stop C")) .build(); - static final RegularStop SUBURB_STOP = STOP_MODEL_BUILDER + static final RegularStop SUBURB_STOP = SITE_REPOSITORY_BUILDER .regularStop(id("suburb")) .withCoordinate(new WgsCoordinate(1, 4)) .withName(I18NString.of("Suburb")) .build(); - static final RegularStop OTHER_FEED_STOP = STOP_MODEL_BUILDER + static final RegularStop OTHER_FEED_STOP = SITE_REPOSITORY_BUILDER .regularStop(FeedScopedId.ofNullable("F2", "other-feed-stop")) .withCoordinate(new WgsCoordinate(1, 5)) .withName(I18NString.of("Other feed stop")) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java index 63ed44131fd..d1e3bd4837c 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/fares/impl/OrcaFareServiceTest.java @@ -48,7 +48,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class OrcaFareServiceTest { @@ -662,15 +662,15 @@ private static Itinerary createItinerary( .withTimezone(ZoneIds.NEW_YORK.getId()) .build(); - var stopModelBuilder = StopModel.of(); + var siteRepositoryBuilder = SiteRepository.of(); // Set up stops - RegularStop firstStop = stopModelBuilder + RegularStop firstStop = siteRepositoryBuilder .regularStop(new FeedScopedId(agencyId, "1")) .withCoordinate(new WgsCoordinate(1, 1)) .withName(new NonLocalizedString(firstStopName)) .build(); - RegularStop lastStop = stopModelBuilder + RegularStop lastStop = siteRepositoryBuilder .regularStop(new FeedScopedId(agencyId, "2")) .withCoordinate(new WgsCoordinate(1, 2)) .withName(new NonLocalizedString(lastStopName)) diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java index 1e7ff64c5dd..979db157268 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapperTest.java @@ -22,7 +22,7 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; class AreaStopsToVerticesMapperTest { @@ -33,13 +33,13 @@ class AreaStopsToVerticesMapperTest { .areaStop("berlin") .withGeometry(Polygons.BERLIN) .build(); - public static final StopModel STOP_MODEL = TEST_MODEL - .stopModelBuilder() + public static final SiteRepository SITE_REPOSITORY = TEST_MODEL + .siteRepositoryBuilder() .withAreaStop(AreaStopsToVerticesMapperTest.BERLIN_AREA_STOP) .build(); public static final TimetableRepository TRANSIT_MODEL = new TimetableRepository( - STOP_MODEL, + SITE_REPOSITORY, new Deduplicator() ); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java index cac0707af92..fb19f1dff36 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTest.java @@ -211,7 +211,7 @@ private static void addGtfsToGraph( .buildGraph(); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); } private Itinerary getItinerary(GenericLocation from, GenericLocation to, int index) { diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java index a1d41cdebb5..87106394708 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/FlexIntegrationTestData.java @@ -15,7 +15,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public final class FlexIntegrationTestData { @@ -43,7 +43,7 @@ public static TestOtpModel cobbOsm() { private static TestOtpModel buildFlexGraph(File file) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); GtfsBundle gtfsBundle = new GtfsBundle(file); GtfsModule module = new GtfsModule( List.of(gtfsBundle), @@ -54,7 +54,7 @@ private static TestOtpModel buildFlexGraph(File file) { OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, true)); module.buildGraph(); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); OTPFeature.enableFeatures(Map.of(OTPFeature.FlexRouting, false)); assertTrue(timetableRepository.hasFlexTrips()); return new TestOtpModel(graph, timetableRepository); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java index 73364caccf1..664bd5ed4bc 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/flex/trip/FlexTripsMapperTest.java @@ -12,13 +12,13 @@ import org.opentripplanner.model.StopTime; import org.opentripplanner.model.impl.OtpTransitServiceBuilder; import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class FlexTripsMapperTest { @Test void defaultTimePenalty() { - var builder = new OtpTransitServiceBuilder(StopModel.of().build(), NOOP); + var builder = new OtpTransitServiceBuilder(SiteRepository.of().build(), NOOP); var stopTimes = List.of(stopTime(0), stopTime(1)); builder.getStopTimesSortedByTrip().addAll(stopTimes); var trips = FlexTripsMapper.createFlexTrips(builder, NOOP); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java index 9d90cbb5f26..18d61a3db42 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/LuceneIndexTest.java @@ -108,7 +108,7 @@ class LuceneIndexTest { @BeforeAll static void setup() { - var stopModel = TEST_MODEL.stopModelBuilder(); + var siteRepository = TEST_MODEL.siteRepositoryBuilder(); List .of( ALEXANDERPLATZ_BUS, @@ -122,11 +122,11 @@ static void setup() { MERIDIAN_N2, MERIDIAN_AVE ) - .forEach(stopModel::withRegularStop); + .forEach(siteRepository::withRegularStop); List .of(ALEXANDERPLATZ_STATION, BERLIN_HAUPTBAHNHOF_STATION, FIVE_POINTS_STATION) - .forEach(stopModel::withStation); - var timetableRepository = new TimetableRepository(stopModel.build(), new Deduplicator()); + .forEach(siteRepository::withStation); + var timetableRepository = new TimetableRepository(siteRepository.build(), new Deduplicator()); timetableRepository.index(); var transitService = new DefaultTransitService(timetableRepository) { private final Multimap modes = ImmutableMultimap diff --git a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java index b98de173817..fdff7787fb5 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/geocoder/StopClusterMapperTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; class StopClusterMapperTest { @@ -22,12 +22,12 @@ class StopClusterMapperTest { private static final RegularStop STOP_B = TEST_MODEL.stop("B").build(); private static final RegularStop STOP_C = TEST_MODEL.stop("C").build(); private static final List STOPS = List.of(STOP_A, STOP_B, STOP_C); - private static final StopModel STOP_MODEL = TEST_MODEL - .stopModelBuilder() + private static final SiteRepository SITE_REPOSITORY = TEST_MODEL + .siteRepositoryBuilder() .withRegularStops(STOPS) .build(); private static final TimetableRepository TRANSIT_MODEL = new TimetableRepository( - STOP_MODEL, + SITE_REPOSITORY, new Deduplicator() ); private static final List LOCATIONS = STOPS diff --git a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java index 193eddf9690..f763b520f5b 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/stopconsolidation/TestStopConsolidationModel.java @@ -46,8 +46,8 @@ class TestStopConsolidationModel { .build(); static TimetableRepository buildTimetableRepository() { - var stopModelBuilder = testModel.stopModelBuilder(); - List.of(STOP_A, STOP_B, STOP_C, STOP_D).forEach(stopModelBuilder::withRegularStop); - return new TimetableRepository(stopModelBuilder.build(), new Deduplicator()); + var siteRepositoryBuilder = testModel.siteRepositoryBuilder(); + List.of(STOP_A, STOP_B, STOP_C, STOP_D).forEach(siteRepositoryBuilder::withRegularStop); + return new TimetableRepository(siteRepositoryBuilder.build(), new Deduplicator()); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java index 7d14d11785c..a33a8b55286 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopPropertyMapperTest.java @@ -9,12 +9,12 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class AreaStopPropertyMapperTest { private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( - StopModel.of() + SiteRepository.of() ); private static final AreaStop STOP = MODEL.areaStop("123").build(); private static final Route ROUTE_WITH_COLOR = TimetableRepositoryForTest diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java index 7cfab197cf1..cf5683b49b5 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/areastops/AreaStopsLayerBuilderTest.java @@ -15,8 +15,8 @@ import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.opentripplanner.transit.service.TimetableRepository; class AreaStopsLayerBuilderTest { @@ -46,16 +46,16 @@ class AreaStopsLayerBuilderTest { .layers() .getFirst(); - private final StopModelBuilder stopModelBuilder = StopModel.of(); + private final SiteRepositoryBuilder siteRepositoryBuilder = SiteRepository.of(); - private final AreaStop AREA_STOP = stopModelBuilder + private final AreaStop AREA_STOP = siteRepositoryBuilder .areaStop(ID) .withName(NAME) .withGeometry(Polygons.BERLIN) .build(); private final TimetableRepository timetableRepository = new TimetableRepository( - stopModelBuilder.withAreaStop(AREA_STOP).build(), + siteRepositoryBuilder.withAreaStop(AREA_STOP).build(), new Deduplicator() ); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java index 2f37afc76be..f3b1c9e2126 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stations/DigitransitStationPropertyMapperTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class DigitransitStationPropertyMapperTest { @@ -20,7 +20,7 @@ public class DigitransitStationPropertyMapperTest { @Test void map() { var deduplicator = new Deduplicator(); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); timetableRepository.index(); var transitService = new TestTransitService(timetableRepository); diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java index 867903c410a..6723034f2a7 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/RealtimeStopsLayerTest.java @@ -27,7 +27,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class RealtimeStopsLayerTest { @@ -40,7 +40,7 @@ public void setUp() { var name = I18NString.of("name"); var desc = I18NString.of("desc"); stop = - StopModel + SiteRepository .of() .regularStop(new FeedScopedId("F", "name")) .withName(name) @@ -49,7 +49,7 @@ public void setUp() { .withTimeZone(ZoneIds.HELSINKI) .build(); stop2 = - StopModel + SiteRepository .of() .regularStop(new FeedScopedId("F", "name")) .withName(name) @@ -62,7 +62,7 @@ public void setUp() { @Test void realtimeStopLayer() { var deduplicator = new Deduplicator(); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); timetableRepository.initTimeZone(ZoneIds.HELSINKI); timetableRepository.index(); var transitService = new DefaultTransitService(timetableRepository) { diff --git a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java index 046c5839db0..d5d12576a1a 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/vectortiles/layers/stops/StopsLayerTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class StopsLayerTest { @@ -47,7 +47,7 @@ public class StopsLayerTest { .withCoordinate(WgsCoordinate.GREENWICH) .withName(I18NString.of("A Station")) .build(); - private static final RegularStop STOP = StopModel + private static final RegularStop STOP = SiteRepository .of() .regularStop(new FeedScopedId("F", "name")) .withName(NAME_TRANSLATIONS) @@ -59,7 +59,7 @@ public class StopsLayerTest { @Test public void digitransitStopPropertyMapperTest() { var deduplicator = new Deduplicator(); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); timetableRepository.index(); var transitService = new TestTransitService(timetableRepository); @@ -81,7 +81,7 @@ public void digitransitStopPropertyMapperTest() { @Test public void digitransitStopPropertyMapperTranslationTest() { var deduplicator = new Deduplicator(); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); timetableRepository.index(); var transitService = new DefaultTransitService(timetableRepository); diff --git a/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java index be237236700..796971a43b5 100644 --- a/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/flex/AreaStopsToVerticesMapper.java @@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory; /** - * Iterates over all area stops in the stop model and adds them to vertices that are suitable for + * Iterates over all area stops in the stop and adds them to vertices that are suitable for * boarding flex trips. */ public class AreaStopsToVerticesMapper implements GraphBuilderModule { @@ -36,21 +36,21 @@ public AreaStopsToVerticesMapper(Graph graph, TimetableRepository timetableRepos @Override @SuppressWarnings("Convert2MethodRef") public void buildGraph() { - if (!timetableRepository.getStopModel().hasAreaStops()) { + if (!timetableRepository.getSiteRepository().hasAreaStops()) { return; } - StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getSiteRepository()); ProgressTracker progress = ProgressTracker.track( "Add flex locations to street vertices", 1, - timetableRepository.getStopModel().listAreaStops().size() + timetableRepository.getSiteRepository().listAreaStops().size() ); LOG.info(progress.startMessage()); var results = timetableRepository - .getStopModel() + .getSiteRepository() .listAreaStops() .parallelStream() .flatMap(areaStop -> { diff --git a/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java b/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java index 4a577433bfe..6529fc4234d 100644 --- a/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java +++ b/application/src/ext/java/org/opentripplanner/ext/parkAndRideApi/ParkAndRideResource.java @@ -40,7 +40,7 @@ public ParkAndRideResource( // TODO OTP2 - Why are we using the DirectGraphFinder here, not just // - serverContext.graphFinder(). This needs at least a comment! - // - This can be replaced with a search done with the StopModel + // - This can be replaced with a search done with the SiteRepository // - if we have a radius search there. this.graphFinder = new DirectGraphFinder(serverContext.transitService()::findRegularStops); } diff --git a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java index d4f148d9ec6..8e6f31fb6fe 100644 --- a/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java +++ b/application/src/ext/java/org/opentripplanner/ext/stopconsolidation/internal/DefaultStopConsolidationService.java @@ -37,7 +37,7 @@ public List replacements() { .groups() .stream() .flatMap(group -> { - var primaryStop = timetableRepository.getStopModel().getRegularStop(group.primary()); + var primaryStop = timetableRepository.getSiteRepository().getRegularStop(group.primary()); if (primaryStop == null) { LOG.error( "Could not find primary stop with id {}. Ignoring stop group {}.", @@ -98,7 +98,7 @@ private Optional findAgencySpecificStop(StopLocation stop, Agency .flatMap(g -> g.secondaries().stream()) .filter(secondary -> secondary.getFeedId().equals(agency.getId().getFeedId())) .findAny() - .map(id -> timetableRepository.getStopModel().getRegularStop(id)); + .map(id -> timetableRepository.getSiteRepository().getRegularStop(id)); } @Override @@ -110,6 +110,6 @@ public Optional primaryStop(FeedScopedId id) { .map(ConsolidatedStopGroup::primary) .findAny() .orElse(id); - return Optional.ofNullable(timetableRepository.getStopModel().getRegularStop(primaryId)); + return Optional.ofNullable(timetableRepository.getSiteRepository().getRegularStop(primaryId)); } } diff --git a/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java index 701ff702a32..61cd9a0789b 100644 --- a/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java +++ b/application/src/ext/java/org/opentripplanner/ext/transferanalyzer/DirectTransferAnalyzer.java @@ -68,7 +68,7 @@ public void buildGraph() { List directTransfersNotFound = new ArrayList<>(); DirectGraphFinder nearbyStopFinderEuclidian = new DirectGraphFinder( - timetableRepository.getStopModel()::findRegularStops + timetableRepository.getSiteRepository()::findRegularStops ); StreetGraphFinder nearbyStopFinderStreets = new StreetGraphFinder(graph); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java index bd629da9468..f88cc6ea937 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/GraphBuilder.java @@ -244,7 +244,7 @@ private static void logGraphBuilderCompleteStatus( long endTime = System.currentTimeMillis(); String time = DurationUtils.durationToStr(Duration.ofMillis(endTime - startTime)); var f = new OtpNumberFormat(); - var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nStops = f.formatNumber(timetableRepository.getSiteRepository().stopIndexSize()); var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); var nVertices = f.formatNumber(graph.countVertices()); diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java index 7aa5d65bef1..1d335d7ff4f 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/AddTransitEntitiesToGraph.java @@ -83,7 +83,7 @@ public static void addToGraph( } private void applyToGraph(TimetableRepository timetableRepository) { - timetableRepository.mergeStopModels(otpTransitService.stopModel()); + timetableRepository.mergeSiteRepositories(otpTransitService.siteRepository()); addStopsToGraphAndGenerateStopVertexes(timetableRepository); addEntrancesToGraph(); @@ -122,7 +122,7 @@ private void addStopsToGraphAndGenerateStopVertexes(TimetableRepository timetabl // Add a vertex representing the stop. // It is now possible for these vertices to not be connected to any edges. - for (RegularStop stop : otpTransitService.stopModel().listRegularStops()) { + for (RegularStop stop : otpTransitService.siteRepository().listRegularStops()) { Set modes = stopModeMap.get(stop); TransitStopVertex stopVertex = vertexFactory.transitStop( TransitStopVertex.of().withStop(stop).withModes(modes) @@ -145,7 +145,7 @@ private void addEntrancesToGraph() { } private void addStationCentroidsToGraph() { - for (Station station : otpTransitService.stopModel().listStations()) { + for (Station station : otpTransitService.siteRepository().listStations()) { if (station.shouldRouteToCentroid()) { vertexFactory.stationCentroid(station); } diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java index ba847b96eb9..c4acabefd6c 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModule.java @@ -71,7 +71,7 @@ public OsmBoardingLocationsModule(Graph graph, TimetableRepository timetableRepo public void buildGraph() { LOG.info("Improving boarding locations by checking OSM entities..."); - StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); + StreetIndex streetIndex = graph.getStreetIndexSafe(timetableRepository.getSiteRepository()); this.linker = streetIndex.getVertexLinker(); int successes = 0; diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java index 2b4a38da58a..f7d8664e590 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java @@ -26,7 +26,7 @@ public RouteToCentroidStationIdsValidator( private void validate() { var stationIds = timetableRepository - .getStopModel() + .getSiteRepository() .listStations() .stream() .map(AbstractTransitEntity::getId) diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java index 59b6a8b48a0..32495617db9 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/StreetLinkerModule.java @@ -67,7 +67,7 @@ public StreetLinkerModule( @Override public void buildGraph() { timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); graph.getLinker().setAddExtraEdgesToAreas(this.addExtraEdgesToAreas); if (graph.hasStreets) { diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java index 151470e0c11..e114eb612e3 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/geometry/CalculateWorldEnvelopeModule.java @@ -45,7 +45,7 @@ public CalculateWorldEnvelopeModule( @Override public void buildGraph() { var vertices = graph.getVertices(); - var stops = timetableRepository.getStopModel().listStopLocations(); + var stops = timetableRepository.getSiteRepository().listStopLocations(); WorldEnvelope envelope = build(vertices, stops); worldEnvelopeRepository.saveEnvelope(envelope); } diff --git a/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java index 6bb2bc83719..8bb3b3fbcd5 100644 --- a/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java +++ b/application/src/main/java/org/opentripplanner/graph_builder/module/islandpruning/PruneIslands.java @@ -81,8 +81,8 @@ public void buildGraph() { adaptivePruningDistance ); - this.vertexLinker = graph.getLinkerSafe(timetableRepository.getStopModel()); - this.streetIndex = graph.getStreetIndexSafe(timetableRepository.getStopModel()); + this.vertexLinker = graph.getLinkerSafe(timetableRepository.getSiteRepository()); + this.streetIndex = graph.getStreetIndexSafe(timetableRepository.getSiteRepository()); pruneIslands(TraverseMode.BICYCLE); pruneIslands(TraverseMode.WALK); diff --git a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java index 59acabee819..39f88f13281 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java +++ b/application/src/main/java/org/opentripplanner/gtfs/graphbuilder/GtfsModule.java @@ -132,7 +132,7 @@ public void buildGraph() { feedIdsEncountered.put(feedId, gtfsBundle); GTFSToOtpTransitServiceMapper mapper = new GTFSToOtpTransitServiceMapper( - new OtpTransitServiceBuilder(timetableRepository.getStopModel(), issueStore), + new OtpTransitServiceBuilder(timetableRepository.getSiteRepository(), issueStore), feedId, issueStore, gtfsBundle.discardMinTransferTimes(), diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java index b7aea1c2e2f..8e3718be4c6 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/GTFSToOtpTransitServiceMapper.java @@ -105,12 +105,13 @@ public GTFSToOtpTransitServiceMapper( feedInfoMapper = new FeedInfoMapper(feedId); agencyMapper = new AgencyMapper(feedId); stationMapper = new StationMapper(translationHelper, stationTransferPreference); - stopMapper = new StopMapper(translationHelper, stationLookup, builder.stopModel()); + stopMapper = new StopMapper(translationHelper, stationLookup, builder.siteRepository()); entranceMapper = new EntranceMapper(translationHelper, stationLookup); pathwayNodeMapper = new PathwayNodeMapper(translationHelper, stationLookup); boardingAreaMapper = new BoardingAreaMapper(translationHelper, stopLookup); - locationMapper = new LocationMapper(builder.stopModel(), issueStore); - locationGroupMapper = new LocationGroupMapper(stopMapper, locationMapper, builder.stopModel()); + locationMapper = new LocationMapper(builder.siteRepository(), issueStore); + locationGroupMapper = + new LocationGroupMapper(stopMapper, locationMapper, builder.siteRepository()); pathwayMapper = new PathwayMapper(stopMapper, entranceMapper, pathwayNodeMapper, boardingAreaMapper); routeMapper = new RouteMapper(agencyMapper, issueStore, translationHelper); @@ -142,7 +143,7 @@ public FareRulesData getFareRulesService() { } public void mapStopTripAndRouteDataIntoBuilder() { - var stopModel = builder.stopModel(); + var siteRepository = builder.siteRepository(); translationHelper.importTranslations(data.getAllTranslations(), data.getAllFeedInfos()); builder.getAgenciesById().addAll(agencyMapper.map(data.getAllAgencies())); @@ -159,8 +160,8 @@ public void mapStopTripAndRouteDataIntoBuilder() { if (OTPFeature.FlexRouting.isOn()) { // Stop areas and Stop groups are only used in FLEX routes - builder.stopModel().withAreaStops(locationMapper.map(data.getAllLocations())); - builder.stopModel().withGroupStops(locationGroupMapper.map(data.getAllLocationGroups())); + builder.siteRepository().withAreaStops(locationMapper.map(data.getAllLocations())); + builder.siteRepository().withGroupStops(locationGroupMapper.map(data.getAllLocationGroups())); } builder.getPathways().addAll(pathwayMapper.map(data.getAllPathways())); @@ -184,14 +185,14 @@ private void mapGtfsStopsToOtpTypes(Collection s // Map station first, so we can link to them for (org.onebusaway.gtfs.model.Stop it : stops) { if (it.getLocationType() == LOCATION_TYPE_STATION) { - builder.stopModel().withStation(stationMapper.map(it)); + builder.siteRepository().withStation(stationMapper.map(it)); } } // Map Stop, Entrance and PathwayNode, link to station for (org.onebusaway.gtfs.model.Stop it : stops) { if (it.getLocationType() == LOCATION_TYPE_STOP) { - builder.stopModel().withRegularStop(stopMapper.map(it)); + builder.siteRepository().withRegularStop(stopMapper.map(it)); } else if (it.getLocationType() == LOCATION_TYPE_ENTRANCE_EXIT) { builder.getEntrances().add(entranceMapper.map(it)); } else if (it.getLocationType() == LOCATION_TYPE_NODE) { diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java index 591a59c492e..b4ba6d3cc27 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationGroupMapper.java @@ -13,24 +13,24 @@ import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.GroupStopBuilder; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; public class LocationGroupMapper { private final StopMapper stopMapper; private final LocationMapper locationMapper; - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; private final Map mappedLocationGroups = new HashMap<>(); public LocationGroupMapper( StopMapper stopMapper, LocationMapper locationMapper, - StopModelBuilder stopModelBuilder + SiteRepositoryBuilder siteRepositoryBuilder ) { this.stopMapper = stopMapper; this.locationMapper = locationMapper; - this.stopModelBuilder = stopModelBuilder; + this.siteRepositoryBuilder = siteRepositoryBuilder; } Collection map(Collection allLocationGroups) { @@ -43,7 +43,7 @@ GroupStop map(LocationGroup original) { } private GroupStop doMap(LocationGroup element) { - GroupStopBuilder groupStopBuilder = stopModelBuilder + GroupStopBuilder groupStopBuilder = siteRepositoryBuilder .groupStop(mapAgencyAndId(element.getId())) .withName(new NonLocalizedString(element.getName())); diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java index 79a28ac0f61..5a845b8bfe8 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/LocationMapper.java @@ -15,17 +15,20 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.issue.api.Issue; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; /** Responsible for mapping GTFS Location into the OTP model. */ public class LocationMapper { private final Map mappedLocations = new HashMap<>(); - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; private final DataImportIssueStore issueStore; - public LocationMapper(StopModelBuilder stopModelBuilder, DataImportIssueStore issueStore) { - this.stopModelBuilder = stopModelBuilder; + public LocationMapper( + SiteRepositoryBuilder siteRepositoryBuilder, + DataImportIssueStore issueStore + ) { + this.siteRepositoryBuilder = siteRepositoryBuilder; this.issueStore = issueStore; } @@ -57,7 +60,7 @@ private AreaStop doMap(Location gtfsLocation) { ) ); } - return stopModelBuilder + return siteRepositoryBuilder .areaStop(id) .withName(name) .withUrl(NonLocalizedString.ofNullable(gtfsLocation.getUrl())) diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java index 2f7aef34312..4cbe252d68f 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/StopMapper.java @@ -12,24 +12,24 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.RegularStopBuilder; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; /** Responsible for mapping GTFS Stop into the OTP model. */ class StopMapper { private final Map mappedStops = new HashMap<>(); - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; private final TranslationHelper translationHelper; private final Function stationLookUp; StopMapper( TranslationHelper translationHelper, Function stationLookUp, - StopModelBuilder stopModelBuilder + SiteRepositoryBuilder siteRepositoryBuilder ) { this.translationHelper = translationHelper; this.stationLookUp = stationLookUp; - this.stopModelBuilder = stopModelBuilder; + this.siteRepositoryBuilder = siteRepositoryBuilder; } Collection map(Collection allStops) { @@ -44,7 +44,7 @@ RegularStop map(org.onebusaway.gtfs.model.Stop original) { private RegularStop doMap(org.onebusaway.gtfs.model.Stop gtfsStop) { assertLocationTypeIsStop(gtfsStop); StopMappingWrapper base = new StopMappingWrapper(gtfsStop); - RegularStopBuilder builder = stopModelBuilder + RegularStopBuilder builder = siteRepositoryBuilder .regularStop(base.getId()) .withCode(base.getCode()) .withCoordinate(base.getCoordinate()) diff --git a/application/src/main/java/org/opentripplanner/model/OtpTransitService.java b/application/src/main/java/org/opentripplanner/model/OtpTransitService.java index 91351af383d..748c44fa788 100644 --- a/application/src/main/java/org/opentripplanner/model/OtpTransitService.java +++ b/application/src/main/java/org/opentripplanner/model/OtpTransitService.java @@ -16,7 +16,7 @@ import org.opentripplanner.transit.model.site.Pathway; import org.opentripplanner.transit.model.site.PathwayNode; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * Methods for accessing imported entities. @@ -35,7 +35,7 @@ public interface OtpTransitService { Collection getAllFeedInfos(); - StopModel stopModel(); + SiteRepository siteRepository(); /** * This is equivalent to a Transmodel Notice Assignments. The map key may reference entity ids of diff --git a/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java index d62d0331a34..3dd4a3db992 100644 --- a/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java +++ b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceBuilder.java @@ -54,8 +54,8 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimes; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -78,7 +78,7 @@ public class OtpTransitServiceBuilder { private final List frequencies = new ArrayList<>(); - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; private final Multimap noticeAssignments = ArrayListMultimap.create(); @@ -124,8 +124,8 @@ public class OtpTransitServiceBuilder { private final DataImportIssueStore issueStore; - public OtpTransitServiceBuilder(StopModel stopModel, DataImportIssueStore issueStore) { - this.stopModelBuilder = stopModel.withContext(); + public OtpTransitServiceBuilder(SiteRepository siteRepository, DataImportIssueStore issueStore) { + this.siteRepositoryBuilder = siteRepository.withContext(); this.issueStore = issueStore; } @@ -151,16 +151,16 @@ public List getFrequencies() { return frequencies; } - public StopModelBuilder stopModel() { - return stopModelBuilder; + public SiteRepositoryBuilder siteRepository() { + return siteRepositoryBuilder; } public ImmutableEntityById getGroupsOfStationsById() { - return stopModelBuilder.groupOfStationById(); + return siteRepositoryBuilder.groupOfStationById(); } public ImmutableEntityById getMultiModalStationsById() { - return stopModelBuilder.multiModalStationById(); + return siteRepositoryBuilder.multiModalStationById(); } /** @@ -188,11 +188,11 @@ public Multimap getShapePoints() { } public ImmutableEntityById getStations() { - return stopModelBuilder.stationById(); + return siteRepositoryBuilder.stationById(); } public ImmutableEntityById getStops() { - return stopModelBuilder.regularStopsById(); + return siteRepositoryBuilder.regularStopsById(); } public EntityById getEntrances() { @@ -208,11 +208,11 @@ public EntityById getBoardingAreas() { } public ImmutableEntityById getAreaStops() { - return stopModelBuilder.areaStopById(); + return siteRepositoryBuilder.areaStopById(); } public ImmutableEntityById getGroupStops() { - return stopModelBuilder.groupStopById(); + return siteRepositoryBuilder.groupStopById(); } public TripStopTimes getStopTimesSortedByTrip() { diff --git a/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java index 9ca549f1631..2f735f36435 100644 --- a/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/model/impl/OtpTransitServiceImpl.java @@ -26,7 +26,7 @@ import org.opentripplanner.transit.model.site.Pathway; import org.opentripplanner.transit.model.site.PathwayNode; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * A in-memory implementation of {@link OtpTransitService}. It's super fast for most methods, but @@ -45,7 +45,7 @@ class OtpTransitServiceImpl implements OtpTransitService { private final Collection feedInfos; - private final StopModel stopModel; + private final SiteRepository siteRepository; private final ImmutableListMultimap noticeAssignments; @@ -77,7 +77,7 @@ class OtpTransitServiceImpl implements OtpTransitService { OtpTransitServiceImpl(OtpTransitServiceBuilder builder) { this.agencies = immutableList(builder.getAgenciesById().values()); this.feedInfos = immutableList(builder.getFeedInfos()); - this.stopModel = builder.stopModel().build(); + this.siteRepository = builder.siteRepository().build(); this.noticeAssignments = ImmutableListMultimap.copyOf(builder.getNoticeAssignments()); this.operators = immutableList(builder.getOperatorsById().values()); this.pathways = immutableList(builder.getPathways()); @@ -109,8 +109,8 @@ public Collection getAllFeedInfos() { } @Override - public StopModel stopModel() { - return stopModel; + public SiteRepository siteRepository() { + return siteRepository; } /** diff --git a/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java index 5d824f833db..9ca6dc27b04 100644 --- a/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java +++ b/application/src/main/java/org/opentripplanner/netex/configure/NetexConfigure.java @@ -43,7 +43,7 @@ public NetexModule createNetexModule( for (ConfiguredDataSource it : netexSources) { var transitServiceBuilder = new OtpTransitServiceBuilder( - timetableRepository.getStopModel(), + timetableRepository.getSiteRepository(), issueStore ); netexBundles.add(netexBundle(transitServiceBuilder, it)); diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java index 7e06db882f1..1bbe76c0e7c 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/FlexStopsMapper.java @@ -15,7 +15,7 @@ import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.FlexibleArea; import org.rutebanken.netex.model.FlexibleStopPlace; import org.rutebanken.netex.model.KeyListStructure; @@ -34,14 +34,14 @@ class FlexStopsMapper { "UnrestrictedPublicTransportAreas"; private final FeedScopedIdFactory idFactory; private final HashGridSpatialIndex stopsSpatialIndex; - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; private final DataImportIssueStore issueStore; private final TransportModeMapper transportModeMapper = new TransportModeMapper(); FlexStopsMapper( FeedScopedIdFactory idFactory, Collection stops, - StopModelBuilder stopModelBuilder, + SiteRepositoryBuilder siteRepositoryBuilder, DataImportIssueStore issueStore ) { this.idFactory = idFactory; @@ -50,7 +50,7 @@ class FlexStopsMapper { Envelope env = new Envelope(stop.getCoordinate().asJtsCoordinate()); this.stopsSpatialIndex.insert(env, stop); } - this.stopModelBuilder = stopModelBuilder; + this.siteRepositoryBuilder = siteRepositoryBuilder; this.issueStore = issueStore; } @@ -100,7 +100,7 @@ StopLocation map(FlexibleStopPlace flexibleStopPlace) { } else { // We create a new GroupStop, even if the stop place consists of a single area, in order to // get the ids for the area and stop place correct - var builder = stopModelBuilder + var builder = siteRepositoryBuilder .groupStop(idFactory.createId(flexibleStopPlace.getId())) .withName(new NonLocalizedString(flexibleStopPlace.getName().getValue())) .withEncompassingAreaGeometries(areaGeometries); @@ -118,7 +118,7 @@ AreaStop mapFlexArea(FlexibleArea area, Geometry geometry, String backupName) { } var areaName = area.getName(); - return stopModelBuilder + return siteRepositoryBuilder .areaStop(idFactory.createId(area.getId())) .withName(new NonLocalizedString(areaName != null ? areaName.getValue() : backupName)) .withGeometry(geometry) diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java index 909d7b1c69f..c8d4f80af63 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/NetexMapper.java @@ -309,7 +309,7 @@ private void mapStopPlaceAndQuays(TariffZoneMapper tariffZoneMapper) { idFactory, currentNetexIndex.getQuayById(), tariffZoneMapper, - transitBuilder.stopModel(), + transitBuilder.siteRepository(), zoneId, issueStore, noTransfersOnIsolatedStops, @@ -321,8 +321,8 @@ private void mapStopPlaceAndQuays(TariffZoneMapper tariffZoneMapper) { .lookup(stopPlaceId); stopMapper.mapParentAndChildStops(stopPlaceAllVersions); } - transitBuilder.stopModel().withRegularStops(stopMapper.resultStops); - transitBuilder.stopModel().withStations(stopMapper.resultStations); + transitBuilder.siteRepository().withRegularStops(stopMapper.resultStops); + transitBuilder.siteRepository().withStations(stopMapper.resultStations); currentMapperIndexes.addStationByMultiModalStationRfs( stopMapper.resultStationByMultiModalStationRfs ); @@ -339,7 +339,7 @@ private void mapMultiModalStopPlaces() { .get(multiModalStopPlace.getId()); var multiModalStation = mapper.map(multiModalStopPlace, stations); if (multiModalStation != null) { - transitBuilder.stopModel().withMultiModalStation(multiModalStation); + transitBuilder.siteRepository().withMultiModalStation(multiModalStation); } } } @@ -354,7 +354,9 @@ private void mapGroupsOfStopPlaces() { for (GroupOfStopPlaces groupOfStopPlaces : currentNetexIndex .getGroupOfStopPlacesById() .localValues()) { - transitBuilder.stopModel().withGroupOfStation(groupOfStationsMapper.map(groupOfStopPlaces)); + transitBuilder + .siteRepository() + .withGroupOfStation(groupOfStationsMapper.map(groupOfStopPlaces)); } } @@ -371,19 +373,19 @@ private void mapFlexibleStopPlaces() { FlexStopsMapper flexStopsMapper = new FlexStopsMapper( idFactory, transitBuilder.getStops().values(), - transitBuilder.stopModel(), + transitBuilder.siteRepository(), issueStore ); for (FlexibleStopPlace flexibleStopPlace : flexibleStopPlaces) { StopLocation stopLocation = flexStopsMapper.map(flexibleStopPlace); if (stopLocation instanceof AreaStop areaStop) { - transitBuilder.stopModel().withAreaStop(areaStop); + transitBuilder.siteRepository().withAreaStop(areaStop); } else if (stopLocation instanceof GroupStop groupStop) { - transitBuilder.stopModel().withGroupStop(groupStop); + transitBuilder.siteRepository().withGroupStop(groupStop); for (var child : groupStop.getChildLocations()) { if (child instanceof AreaStop areaStop) { - transitBuilder.stopModel().withAreaStop(areaStop); + transitBuilder.siteRepository().withAreaStop(areaStop); } } } @@ -444,9 +446,9 @@ private void mapTripPatterns(Map serviceIds) { issueStore, idFactory, transitBuilder.getOperatorsById(), - transitBuilder.stopModel().regularStopsById(), - transitBuilder.stopModel().areaStopById(), - transitBuilder.stopModel().groupStopById(), + transitBuilder.siteRepository().regularStopsById(), + transitBuilder.siteRepository().areaStopById(), + transitBuilder.siteRepository().groupStopById(), transitBuilder.getRoutes(), currentNetexIndex.getRouteById(), currentNetexIndex.getJourneyPatternsById(), diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java index a304ca32f72..db67941e323 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/QuayMapper.java @@ -11,7 +11,7 @@ import org.opentripplanner.transit.model.site.FareZone; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.MultilingualString; import org.rutebanken.netex.model.Quay; @@ -21,16 +21,16 @@ class QuayMapper { private final FeedScopedIdFactory idFactory; - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; QuayMapper( FeedScopedIdFactory idFactory, DataImportIssueStore issueStore, - StopModelBuilder stopModelBuilder + SiteRepositoryBuilder siteRepositoryBuilder ) { this.idFactory = idFactory; this.issueStore = issueStore; - this.stopModelBuilder = stopModelBuilder; + this.siteRepositoryBuilder = siteRepositoryBuilder; } /** @@ -45,7 +45,7 @@ RegularStop mapQuayToStop( Accessibility wheelchair ) { var id = idFactory.createId(quay.getId()); - return stopModelBuilder.computeRegularStopIfAbsent( + return siteRepositoryBuilder.computeRegularStopIfAbsent( id, it -> map(it, quay, parentStation, fareZones, transitMode, wheelchair) ); @@ -70,7 +70,7 @@ private RegularStop map( return null; } - var builder = stopModelBuilder + var builder = siteRepositoryBuilder .regularStop(id) .withParentStation(parentStation) .withName(parentStation.getName()) diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java index 8840f7e4bdf..27773a9f66c 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/StationMapper.java @@ -17,7 +17,7 @@ import org.opentripplanner.netex.support.JAXBUtils; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.LimitedUseTypeEnumeration; import org.rutebanken.netex.model.LocaleStructure; import org.rutebanken.netex.model.MultilingualString; @@ -38,7 +38,7 @@ class StationMapper { private final Set routeToCentroidStopPlaceIds; - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; StationMapper( DataImportIssueStore issueStore, @@ -46,19 +46,22 @@ class StationMapper { ZoneId defaultTimeZone, boolean noTransfersOnIsolatedStops, Set routeToCentroidStopPlaceIds, - StopModelBuilder stopModelBuilder + SiteRepositoryBuilder siteRepositoryBuilder ) { this.issueStore = issueStore; this.idFactory = idFactory; this.defaultTimeZone = defaultTimeZone; this.noTransfersOnIsolatedStops = noTransfersOnIsolatedStops; this.routeToCentroidStopPlaceIds = routeToCentroidStopPlaceIds; - this.stopModelBuilder = stopModelBuilder; + this.siteRepositoryBuilder = siteRepositoryBuilder; } Station map(StopPlace stopPlace) { var id = idFactory.createId(stopPlace.getId()); - return stopModelBuilder.computeStationIfAbsent(id, it -> mapStopPlaceToStation(it, stopPlace)); + return siteRepositoryBuilder.computeStationIfAbsent( + id, + it -> mapStopPlaceToStation(it, stopPlace) + ); } Station mapStopPlaceToStation(FeedScopedId id, StopPlace stopPlace) { diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java index c5618a03a1a..0a5ab4ba16c 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/StopAndStationMapper.java @@ -26,7 +26,7 @@ import org.opentripplanner.transit.model.site.FareZone; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.Quay; import org.rutebanken.netex.model.Quays_RelStructure; import org.rutebanken.netex.model.StopPlace; @@ -68,7 +68,7 @@ class StopAndStationMapper { FeedScopedIdFactory idFactory, ReadOnlyHierarchicalVersionMapById quayIndex, TariffZoneMapper tariffZoneMapper, - StopModelBuilder stopModelBuilder, + SiteRepositoryBuilder siteRepositoryBuilder, ZoneId defaultTimeZone, DataImportIssueStore issueStore, boolean noTransfersOnIsolatedStops, @@ -81,9 +81,9 @@ class StopAndStationMapper { defaultTimeZone, noTransfersOnIsolatedStops, routeToCentroidStopPlaceIds, - stopModelBuilder + siteRepositoryBuilder ); - this.quayMapper = new QuayMapper(idFactory, issueStore, stopModelBuilder); + this.quayMapper = new QuayMapper(idFactory, issueStore, siteRepositoryBuilder); this.tariffZoneMapper = tariffZoneMapper; this.quayIndex = quayIndex; this.issueStore = issueStore; diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java index 9e07c57ede7..c7d6a7809ed 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/TransitLayer.java @@ -14,7 +14,7 @@ import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.RaptorRequestTransferCache; import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * This is a replica of public transportation data already present in TimetableRepository, but rearranged @@ -48,7 +48,7 @@ public class TransitLayer { */ private final TransferService transferService; - private final StopModel stopModel; + private final SiteRepository siteRepository; private final RaptorRequestTransferCache transferCache; @@ -69,7 +69,7 @@ public TransitLayer(TransitLayer transitLayer) { transitLayer.tripPatternsRunningOnDate, transitLayer.transfersByStopIndex, transitLayer.transferService, - transitLayer.stopModel, + transitLayer.siteRepository, transitLayer.transferCache, transitLayer.constrainedTransfers, transitLayer.transferIndexGenerator, @@ -81,7 +81,7 @@ public TransitLayer( Map> tripPatternsRunningOnDate, List> transfersByStopIndex, TransferService transferService, - StopModel stopModel, + SiteRepository siteRepository, RaptorRequestTransferCache transferCache, ConstrainedTransfersForPatterns constrainedTransfers, TransferIndexGenerator transferIndexGenerator, @@ -90,7 +90,7 @@ public TransitLayer( this.tripPatternsRunningOnDate = new HashMap<>(tripPatternsRunningOnDate); this.transfersByStopIndex = transfersByStopIndex; this.transferService = transferService; - this.stopModel = stopModel; + this.siteRepository = siteRepository; this.transferCache = transferCache; this.constrainedTransfers = constrainedTransfers; this.transferIndexGenerator = transferIndexGenerator; @@ -99,7 +99,7 @@ public TransitLayer( @Nullable public StopLocation getStopByIndex(int stop) { - return stop == -1 ? null : this.stopModel.stopByIndex(stop); + return stop == -1 ? null : this.siteRepository.stopByIndex(stop); } /** @@ -112,7 +112,7 @@ public Collection getTripPatternsForRunningDate(LocalDate da } public int getStopCount() { - return stopModel.stopIndexSize(); + return siteRepository.stopIndexSize(); } /** diff --git a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java index c7e9ea05320..5f4e40708ef 100644 --- a/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java +++ b/application/src/main/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransfersMapper.java @@ -5,7 +5,7 @@ import org.opentripplanner.model.PathTransfer; import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TransitService; class TransfersMapper { @@ -14,11 +14,14 @@ class TransfersMapper { * Copy pre-calculated transfers from the original graph * @return a list where each element is a list of transfers for the corresponding stop index */ - static List> mapTransfers(StopModel stopModel, TransitService transitService) { + static List> mapTransfers( + SiteRepository siteRepository, + TransitService transitService + ) { List> transferByStopIndex = new ArrayList<>(); - for (int i = 0; i < stopModel.stopIndexSize(); ++i) { - var stop = stopModel.stopByIndex(i); + for (int i = 0; i < siteRepository.stopIndexSize(); ++i) { + var stop = siteRepository.stopByIndex(i); if (stop == null) { continue; 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 a9da73200cc..b0d2b009a0f 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 @@ -24,7 +24,7 @@ import org.opentripplanner.transit.model.network.TripPattern; import org.opentripplanner.transit.model.site.StopTransferPriority; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; import org.slf4j.Logger; @@ -46,11 +46,11 @@ public class TransitLayerMapper { private static final Logger LOG = LoggerFactory.getLogger(TransitLayerMapper.class); private final TransitService transitService; - private final StopModel stopModel; + private final SiteRepository siteRepository; private TransitLayerMapper(TimetableRepository timetableRepository) { this.transitService = new DefaultTransitService(timetableRepository); - this.stopModel = timetableRepository.getStopModel(); + this.siteRepository = timetableRepository.getSiteRepository(); } public static TransitLayer map( @@ -71,7 +71,7 @@ private TransitLayer map(TransitTuningParameters tuningParameters) { tripPatternsByStopByDate = mapTripPatterns(allTripPatterns); - transferByStopIndex = mapTransfers(stopModel, transitService); + transferByStopIndex = mapTransfers(siteRepository, transitService); TransferIndexGenerator transferIndexGenerator = null; if (OTPFeature.TransferConstraints.isOn()) { @@ -88,11 +88,11 @@ private TransitLayer map(TransitTuningParameters tuningParameters) { tripPatternsByStopByDate, transferByStopIndex, transitService.getTransferService(), - stopModel, + siteRepository, transferCache, constrainedTransfers, transferIndexGenerator, - createStopBoardAlightTransferCosts(stopModel, tuningParameters) + createStopBoardAlightTransferCosts(siteRepository, tuningParameters) ); } @@ -169,7 +169,7 @@ private HashMap> keyByRunningPeriodDates( */ @Nullable static int[] createStopBoardAlightTransferCosts( - StopModel stops, + SiteRepository stops, TransitTuningParameters tuningParams ) { if (!tuningParams.enableStopTransferPriority()) { diff --git a/application/src/main/java/org/opentripplanner/routing/graph/Graph.java b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java index bb1944d0c4b..04266476ae5 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/Graph.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/Graph.java @@ -30,7 +30,7 @@ import org.opentripplanner.street.model.vertex.VertexLabel; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -284,9 +284,9 @@ public int countEdges() { * - graph. This allows a module to index the streetIndex BEFORE another module add * - something that should go into the index; Hence, inconsistent data. */ - public void index(StopModel stopModel) { + public void index(SiteRepository siteRepository) { LOG.info("Index street model..."); - streetIndex = new StreetIndex(this, stopModel); + streetIndex = new StreetIndex(this, siteRepository); LOG.info("Index street model complete."); } @@ -297,7 +297,7 @@ public OpeningHoursCalendarService getOpeningHoursCalendarService() { /** * Get streetIndex, safe to use while routing, but do not use during graph build. - * @see #getStreetIndexSafe(StopModel) + * @see #getStreetIndexSafe(SiteRepository) */ public StreetIndex getStreetIndex() { return this.streetIndex; @@ -307,14 +307,14 @@ public StreetIndex getStreetIndex() { * Get streetIndex during graph build, both OSM street data and transit data must be loaded * before calling this. */ - public StreetIndex getStreetIndexSafe(StopModel stopModel) { - indexIfNotIndexed(stopModel); + public StreetIndex getStreetIndexSafe(SiteRepository siteRepository) { + indexIfNotIndexed(siteRepository); return this.streetIndex; } /** * Get VertexLinker, safe to use while routing, but do not use during graph build. - * @see #getLinkerSafe(StopModel) + * @see #getLinkerSafe(SiteRepository) */ public VertexLinker getLinker() { return streetIndex.getVertexLinker(); @@ -324,8 +324,8 @@ public VertexLinker getLinker() { * Get VertexLinker during graph build, both OSM street data and transit data must be loaded * before calling this. */ - public VertexLinker getLinkerSafe(StopModel stopModel) { - indexIfNotIndexed(stopModel); + public VertexLinker getLinkerSafe(SiteRepository siteRepository) { + indexIfNotIndexed(siteRepository); return streetIndex.getVertexLinker(); } @@ -374,9 +374,9 @@ public void setFareService(FareService fareService) { this.fareService = fareService; } - private void indexIfNotIndexed(StopModel stopModel) { + private void indexIfNotIndexed(SiteRepository siteRepository) { if (streetIndex == null) { - index(stopModel); + index(siteRepository); } } } diff --git a/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java index 327428cfccb..e7e0c3248e8 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/SerializedGraphObject.java @@ -184,7 +184,7 @@ private static SerializedGraphObject load(InputStream inputStream, String source ); LOG.debug("Graph read."); serObj.reconstructEdgeLists(); - serObj.timetableRepository.getStopModel().reindexAfterDeserialization(); + serObj.timetableRepository.getSiteRepository().reindexAfterDeserialization(); serObj.timetableRepository.index(); logSerializationCompleteStatus(serObj.graph, serObj.timetableRepository); return serObj; @@ -261,7 +261,7 @@ private static void logSerializationCompleteStatus( TimetableRepository timetableRepository ) { var f = new OtpNumberFormat(); - var nStops = f.formatNumber(timetableRepository.getStopModel().stopIndexSize()); + var nStops = f.formatNumber(timetableRepository.getSiteRepository().stopIndexSize()); var nTransfers = f.formatNumber(timetableRepository.getTransferService().listAll().size()); var nPatterns = f.formatNumber(timetableRepository.getAllTripPatterns().size()); var nVertices = f.formatNumber(graph.countVertices()); diff --git a/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java b/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java index 362c87bff7d..90294d554cc 100644 --- a/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java +++ b/application/src/main/java/org/opentripplanner/routing/graph/index/StreetIndex.java @@ -41,7 +41,7 @@ import org.opentripplanner.street.search.TraverseModeSet; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +57,7 @@ public class StreetIndex { private static final Logger LOG = LoggerFactory.getLogger(StreetIndex.class); - private final StopModel stopModel; + private final SiteRepository siteRepository; private final VertexLinker vertexLinker; @@ -74,11 +74,11 @@ public class StreetIndex { /** * Should only be called by the graph. */ - public StreetIndex(Graph graph, StopModel stopModel) { - this.stopModel = stopModel; + public StreetIndex(Graph graph, SiteRepository siteRepository) { + this.siteRepository = siteRepository; this.edgeSpatialIndex = new EdgeSpatialIndex(); this.verticesTree = new HashGridSpatialIndex<>(); - this.vertexLinker = new VertexLinker(graph, stopModel, edgeSpatialIndex); + this.vertexLinker = new VertexLinker(graph, siteRepository, edgeSpatialIndex); this.transitStopVertices = toImmutableMap(graph.getVerticesOfType(TransitStopVertex.class)); this.stationCentroidVertices = createStationCentroidVertexMap(graph); postSetup(graph.getVertices()); @@ -195,7 +195,7 @@ public Set getStreetVerticesForLocation( if (nonTransitMode.isInCar()) { // Fetch coordinate from stop, if not given in request if (location.stopId != null && location.getCoordinate() == null) { - var coordinate = stopModel.getCoordinateById(location.stopId); + var coordinate = siteRepository.getCoordinateById(location.stopId); if (coordinate != null) { location = new GenericLocation( @@ -262,7 +262,7 @@ public Vertex createVertexForCoordinateForTest( * @return The associated TransitStopVertex or all underlying TransitStopVertices */ public Set getStopOrChildStopsVertices(FeedScopedId id) { - return stopModel + return siteRepository .findStopOrChildStops(id) .stream() .filter(RegularStop.class::isInstance) diff --git a/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java index 2662eb7d3e5..04b58d050ee 100644 --- a/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java +++ b/application/src/main/java/org/opentripplanner/routing/impl/TransitAlertServiceImpl.java @@ -86,7 +86,7 @@ public Collection getStopAlerts( if (result.isEmpty()) { // Search for alerts on parent-stop if (timetableRepository != null) { - var quay = timetableRepository.getStopModel().getRegularStop(stopId); + var quay = timetableRepository.getSiteRepository().getRegularStop(stopId); if (quay != null) { // TODO - SIRI: Add alerts from parent- and multimodal-stops /* diff --git a/application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java b/application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java index 047e44f229a..e9d29f596c7 100644 --- a/application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java +++ b/application/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java @@ -8,15 +8,19 @@ import org.opentripplanner.street.model.edge.StreetEdge; import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class FlexLocationAdder { - static void addFlexLocations(StreetEdge edge, IntersectionVertex v0, StopModel stopModel) { + static void addFlexLocations( + StreetEdge edge, + IntersectionVertex v0, + SiteRepository siteRepository + ) { if (edge.getPermission().allows(StreetTraversalPermission.PEDESTRIAN_AND_CAR)) { Point p = GeometryUtils.getGeometryFactory().createPoint(v0.getCoordinate()); Envelope env = p.getEnvelopeInternal(); - for (AreaStop areaStop : stopModel.findAreaStops(env)) { + for (AreaStop areaStop : siteRepository.findAreaStops(env)) { if (!areaStop.getGeometry().disjoint(p)) { v0.addAreaStops(Set.of(areaStop)); } diff --git a/application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java b/application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java index 9616fbab792..48f5ff997c8 100644 --- a/application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java +++ b/application/src/main/java/org/opentripplanner/routing/linking/VertexLinker.java @@ -34,7 +34,7 @@ import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.street.search.TraverseMode; import org.opentripplanner.street.search.TraverseModeSet; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * This class links transit stops to streets by splitting the streets (unless the stop is extremely @@ -71,7 +71,7 @@ public class VertexLinker { private final Graph graph; - private final StopModel stopModel; + private final SiteRepository siteRepository; private final VertexFactory vertexFactory; // TODO Temporary code until we refactor WalkableAreaBuilder (#3152) @@ -81,11 +81,15 @@ public class VertexLinker { * Construct a new VertexLinker. NOTE: Only one VertexLinker should be active on a graph at any * given time. */ - public VertexLinker(Graph graph, StopModel stopModel, EdgeSpatialIndex edgeSpatialIndex) { + public VertexLinker( + Graph graph, + SiteRepository siteRepository, + EdgeSpatialIndex edgeSpatialIndex + ) { this.edgeSpatialIndex = edgeSpatialIndex; this.graph = graph; this.vertexFactory = new VertexFactory(graph); - this.stopModel = stopModel; + this.siteRepository = siteRepository; } public void linkVertexPermanently( @@ -397,7 +401,7 @@ else if ( } // TODO Consider moving this code if (OTPFeature.FlexRouting.isOn()) { - FlexLocationAdder.addFlexLocations(edge, start, stopModel); + FlexLocationAdder.addFlexLocations(edge, start, siteRepository); } return start; diff --git a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java index 915b7091ba6..a8096d806ba 100644 --- a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java +++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java @@ -188,7 +188,7 @@ private static void detectUnusedConfigParams(CommandLineParameters cli, ConfigMo private static void startOtpWebServer(CommandLineParameters params, ConstructApplication app) { // Index graph for travel search app.timetableRepository().index(); - app.graph().index(app.timetableRepository().getStopModel()); + app.graph().index(app.timetableRepository().getSiteRepository()); // publishing the config version info make it available to the APIs setOtpConfigVersionsOnServerInfo(app); diff --git a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java index 62d8a727615..2ce99e7809b 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java +++ b/application/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java @@ -146,18 +146,18 @@ public Collection getNotices() { @Override public Station getStationById(FeedScopedId id) { - return this.timetableRepository.getStopModel().getStationById(id); + return this.timetableRepository.getSiteRepository().getStationById(id); } @Override public MultiModalStation getMultiModalStation(FeedScopedId id) { - return this.timetableRepository.getStopModel().getMultiModalStation(id); + return this.timetableRepository.getSiteRepository().getMultiModalStation(id); } @Override public Collection getStations() { OTPRequestTimeoutException.checkForTimeout(); - return this.timetableRepository.getStopModel().listStations(); + return this.timetableRepository.getSiteRepository().listStations(); } @Override @@ -174,7 +174,7 @@ public TIntSet getServiceCodesRunningForDate(LocalDate serviceDate) { @Override public AreaStop getAreaStop(FeedScopedId id) { - return this.timetableRepository.getStopModel().getAreaStop(id); + return this.timetableRepository.getSiteRepository().getAreaStop(id); } @Override @@ -184,7 +184,7 @@ public Agency getAgencyForId(FeedScopedId id) { @Override public RegularStop getRegularStop(FeedScopedId id) { - return this.timetableRepository.getStopModel().getRegularStop(id); + return this.timetableRepository.getSiteRepository().getRegularStop(id); } @Override @@ -240,40 +240,40 @@ public Operator getOperatorForId(FeedScopedId id) { @Override public Collection listStopLocations() { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().listStopLocations(); + return timetableRepository.getSiteRepository().listStopLocations(); } @Override public Collection listRegularStops() { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().listRegularStops(); + return timetableRepository.getSiteRepository().listRegularStops(); } @Override public Collection listGroupStops() { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().listGroupStops(); + return timetableRepository.getSiteRepository().listGroupStops(); } @Override public StopLocation getStopLocation(FeedScopedId id) { - return timetableRepository.getStopModel().getStopLocation(id); + return timetableRepository.getSiteRepository().getStopLocation(id); } @Override public Collection getStopOrChildStops(FeedScopedId id) { - return timetableRepository.getStopModel().findStopOrChildStops(id); + return timetableRepository.getSiteRepository().findStopOrChildStops(id); } @Override public Collection listStopLocationGroups() { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().listStopLocationGroups(); + return timetableRepository.getSiteRepository().listStopLocationGroups(); } @Override public StopLocationsGroup getStopLocationsGroup(FeedScopedId id) { - return timetableRepository.getStopModel().getStopLocationsGroup(id); + return timetableRepository.getSiteRepository().getStopLocationsGroup(id); } @Override @@ -359,7 +359,7 @@ public Collection getPatternsForRoute(Route route) { @Override public MultiModalStation getMultiModalStationForStation(Station station) { - return this.timetableRepository.getStopModel().getMultiModalStationForStation(station); + return this.timetableRepository.getSiteRepository().getMultiModalStationForStation(station); } /** @@ -683,13 +683,13 @@ public ZonedDateTime getTransitServiceStarts() { @Override public Collection findRegularStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().findRegularStops(envelope); + return timetableRepository.getSiteRepository().findRegularStops(envelope); } @Override public Collection findAreaStops(Envelope envelope) { OTPRequestTimeoutException.checkForTimeout(); - return timetableRepository.getStopModel().findAreaStops(envelope); + return timetableRepository.getSiteRepository().findAreaStops(envelope); } @Override diff --git a/application/src/main/java/org/opentripplanner/transit/service/StopModel.java b/application/src/main/java/org/opentripplanner/transit/service/SiteRepository.java similarity index 88% rename from application/src/main/java/org/opentripplanner/transit/service/StopModel.java rename to application/src/main/java/org/opentripplanner/transit/service/SiteRepository.java index 4f55ca25b5b..6c9d591933a 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/StopModel.java +++ b/application/src/main/java/org/opentripplanner/transit/service/SiteRepository.java @@ -26,9 +26,9 @@ /** * Repository for Stop entities. */ -public class StopModel implements Serializable { +public class SiteRepository implements Serializable { - private static final Logger LOG = LoggerFactory.getLogger(StopModel.class); + private static final Logger LOG = LoggerFactory.getLogger(SiteRepository.class); private final AtomicInteger stopIndexCounter; private final Map regularStopById; @@ -37,10 +37,10 @@ public class StopModel implements Serializable { private final Map groupOfStationsById; private final Map areaStopById; private final Map groupStopById; - private transient StopModelIndex index; + private transient SiteRepositoryIndex index; @Inject - public StopModel() { + public SiteRepository() { this.stopIndexCounter = new AtomicInteger(0); this.regularStopById = Map.of(); this.stationById = Map.of(); @@ -51,7 +51,7 @@ public StopModel() { this.index = createIndex(); } - StopModel(StopModelBuilder builder) { + SiteRepository(SiteRepositoryBuilder builder) { this.stopIndexCounter = builder.stopIndexCounter(); this.regularStopById = builder.regularStopsById().asImmutableMap(); this.stationById = builder.stationById().asImmutableMap(); @@ -67,7 +67,7 @@ public StopModel() { * method, if not this method will fail! If a duplicate key exist, then child value is kept - * this feature is normally not allowed, but not enforced here. */ - private StopModel(StopModel main, StopModel child) { + private SiteRepository(SiteRepository main, SiteRepository child) { this.stopIndexCounter = assertSameStopIndexCounterIsUsedToCreateBothModels(main, child); this.areaStopById = MapUtils.combine(main.areaStopById, child.areaStopById); this.regularStopById = MapUtils.combine(main.regularStopById, child.regularStopById); @@ -83,28 +83,28 @@ private StopModel(StopModel main, StopModel child) { /** * Create a new builder based on an empty model. This is useful in unit-tests, but should * NOT be used in the main code. It is not possible to merge the result with another - * {@link StopModel}, because they do not share the same context(stopIndexCounter). + * {@link SiteRepository}, because they do not share the same context(stopIndexCounter). *

* In the application code the correct way is to retrieve a model instance and then use the * {@link #withContext()} method to create a builder. */ - public static StopModelBuilder of() { - return new StopModelBuilder(new AtomicInteger(0)); + public static SiteRepositoryBuilder of() { + return new SiteRepositoryBuilder(new AtomicInteger(0)); } /** * Create a new builder attached to the existing model. The entities of the existing model are * NOT copied into the builder, but the builder has access to the model - allowing it to check * for duplicates and injecting information from the model(indexing). The changes in the - * StopModelBuilder can then be merged into the original model - this is for now left to the + * SiteRepositoryBuilder can then be merged into the original model - this is for now left to the * caller. *

* USE THIS TO CREATE A SAFE BUILDER IN PRODUCTION CODE. You MAY use this method in unit-tests, * the alternative is the {@link #of()} method. This method should be used if the test have a - * StopModel and the {@link #of()} method should be used if a stop-model in not needed. + * SiteRepository and the {@link #of()} method should be used if a stop-model in not needed. */ - public StopModelBuilder withContext() { - return new StopModelBuilder(this.stopIndexCounter); + public SiteRepositoryBuilder withContext() { + return new SiteRepositoryBuilder(this.stopIndexCounter); } /** @@ -282,24 +282,24 @@ public Collection findStopOrChildStops(FeedScopedId id) { } /** - * Call this method after deserializing this class. This will reindex the StopModel. + * Call this method after deserializing this class. This will reindex the SiteRepository. */ public void reindexAfterDeserialization() { reindex(); } - public StopModel merge(StopModel child) { - return new StopModel(this, child); + public SiteRepository merge(SiteRepository child) { + return new SiteRepository(this, child); } private void reindex() { - LOG.info("Index stop model..."); + LOG.info("Index site repository..."); index = createIndex(); - LOG.info("Index stop model complete."); + LOG.info("Index site repository complete."); } - private StopModelIndex createIndex() { - return new StopModelIndex( + private SiteRepositoryIndex createIndex() { + return new SiteRepositoryIndex( regularStopById.values(), areaStopById.values(), groupStopById.values(), @@ -328,13 +328,13 @@ private static V getById(FeedScopedId id, Map... */ @SuppressWarnings("NumberEquality") private static AtomicInteger assertSameStopIndexCounterIsUsedToCreateBothModels( - StopModel main, - StopModel child + SiteRepository main, + SiteRepository child ) { if (main.stopIndexCounter != child.stopIndexCounter) { throw new IllegalArgumentException( - "Two Stop models can only be merged if they are created with the same stopIndexCounter. " + - "This is archived by using the 'StopModel.withContext()' method. We do this to avoid " + + "Two Stop repositories can only be merged if they are created with the same stopIndexCounter. " + + "This is archived by using the 'SiteRepository.withContext()' method. We do this to avoid " + "duplicates/gaps in the stopIndex." ); } diff --git a/application/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java b/application/src/main/java/org/opentripplanner/transit/service/SiteRepositoryBuilder.java similarity index 78% rename from application/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java rename to application/src/main/java/org/opentripplanner/transit/service/SiteRepositoryBuilder.java index 52ac778c559..a5c89c2a741 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/StopModelBuilder.java +++ b/application/src/main/java/org/opentripplanner/transit/service/SiteRepositoryBuilder.java @@ -17,7 +17,7 @@ import org.opentripplanner.transit.model.site.RegularStopBuilder; import org.opentripplanner.transit.model.site.Station; -public class StopModelBuilder { +public class SiteRepositoryBuilder { private final AtomicInteger stopIndexCounter; @@ -28,7 +28,7 @@ public class StopModelBuilder { private final EntityById multiModalStationById = new DefaultEntityById<>(); private final EntityById groupOfStationById = new DefaultEntityById<>(); - StopModelBuilder(AtomicInteger stopIndexCounter) { + SiteRepositoryBuilder(AtomicInteger stopIndexCounter) { this.stopIndexCounter = stopIndexCounter; } @@ -47,12 +47,12 @@ public RegularStop computeRegularStopIfAbsent( return regularStopById.computeIfAbsent(id, factory); } - public StopModelBuilder withRegularStop(RegularStop stop) { + public SiteRepositoryBuilder withRegularStop(RegularStop stop) { regularStopById.add(stop); return this; } - public StopModelBuilder withRegularStops(Collection stops) { + public SiteRepositoryBuilder withRegularStops(Collection stops) { regularStopById.addAll(stops); return this; } @@ -61,7 +61,7 @@ public ImmutableEntityById stationById() { return stationById; } - public StopModelBuilder withStation(Station station) { + public SiteRepositoryBuilder withStation(Station station) { stationById.add(station); return this; } @@ -70,7 +70,7 @@ public Station computeStationIfAbsent(FeedScopedId id, Function stations) { + public SiteRepositoryBuilder withStations(Collection stations) { stationById.addAll(stations); return this; } @@ -79,7 +79,7 @@ public ImmutableEntityById multiModalStationById() { return multiModalStationById; } - public StopModelBuilder withMultiModalStation(MultiModalStation station) { + public SiteRepositoryBuilder withMultiModalStation(MultiModalStation station) { multiModalStationById.add(station); return this; } @@ -88,7 +88,7 @@ public ImmutableEntityById groupOfStationById() { return groupOfStationById; } - public StopModelBuilder withGroupOfStation(GroupOfStations station) { + public SiteRepositoryBuilder withGroupOfStation(GroupOfStations station) { groupOfStationById.add(station); return this; } @@ -101,12 +101,12 @@ public ImmutableEntityById areaStopById() { return areaStopById; } - public StopModelBuilder withAreaStop(AreaStop stop) { + public SiteRepositoryBuilder withAreaStop(AreaStop stop) { areaStopById.add(stop); return this; } - public StopModelBuilder withAreaStops(Collection stops) { + public SiteRepositoryBuilder withAreaStops(Collection stops) { areaStopById.addAll(stops); return this; } @@ -119,21 +119,21 @@ public ImmutableEntityById groupStopById() { return groupStopById; } - public StopModelBuilder withGroupStop(GroupStop group) { + public SiteRepositoryBuilder withGroupStop(GroupStop group) { groupStopById.add(group); return this; } - public StopModelBuilder withGroupStops(Collection groups) { + public SiteRepositoryBuilder withGroupStops(Collection groups) { groupStopById.addAll(groups); return this; } /** - * Add the content of another stop model. There are no collision check, entities in the given + * Add the content of another site repository. There are no collision check, entities in the given * {@code other} model, will replace existing entities. */ - public StopModelBuilder addAll(StopModel other) { + public SiteRepositoryBuilder addAll(SiteRepository other) { regularStopById.addAll(other.listRegularStops()); stationById.addAll(other.listStations()); multiModalStationById.addAll(other.listMultiModalStations()); @@ -143,8 +143,8 @@ public StopModelBuilder addAll(StopModel other) { return this; } - public StopModel build() { - return new StopModel(this); + public SiteRepository build() { + return new SiteRepository(this); } AtomicInteger stopIndexCounter() { diff --git a/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java b/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java index c12c6f715f7..48048101b3d 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java +++ b/application/src/main/java/org/opentripplanner/transit/service/StopModelIndex.java @@ -24,9 +24,9 @@ * For performance reasons these indexes are not part of the serialized state of the graph. * They are rebuilt at runtime after graph deserialization. */ -class StopModelIndex { +class SiteRepositoryIndex { - private static final Logger LOG = LoggerFactory.getLogger(StopModelIndex.class); + private static final Logger LOG = LoggerFactory.getLogger(SiteRepositoryIndex.class); private final HashGridSpatialIndex regularStopSpatialIndex = new HashGridSpatialIndex<>(); private final Map multiModalStationForStations = new HashMap<>(); @@ -36,7 +36,7 @@ class StopModelIndex { /** * @param stops All stops including regular transit and flex */ - StopModelIndex( + SiteRepositoryIndex( Collection stops, Collection flexStops, Collection groupStops, diff --git a/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java index dc092cc26c2..6dec0c09eb6 100644 --- a/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java +++ b/application/src/main/java/org/opentripplanner/transit/service/TimetableRepository.java @@ -96,7 +96,7 @@ public class TimetableRepository implements Serializable { private final Multimap transfersByStop = HashMultimap.create(); - private StopModel stopModel; + private SiteRepository siteRepository; private ZonedDateTime transitServiceStarts = LocalDate.MAX.atStartOfDay(ZoneId.systemDefault()); private ZonedDateTime transitServiceEnds = LocalDate.MIN.atStartOfDay(ZoneId.systemDefault()); @@ -145,14 +145,14 @@ public class TimetableRepository implements Serializable { private transient TransitAlertService transitAlertService; @Inject - public TimetableRepository(StopModel stopModel, Deduplicator deduplicator) { - this.stopModel = Objects.requireNonNull(stopModel); + public TimetableRepository(SiteRepository siteRepository, Deduplicator deduplicator) { + this.siteRepository = Objects.requireNonNull(siteRepository); this.deduplicator = deduplicator; } /** No-argument constructor, required for deserialization. */ public TimetableRepository() { - this(new StopModel(), new Deduplicator()); + this(new SiteRepository(), new Deduplicator()); } /** @@ -163,7 +163,7 @@ public TimetableRepository() { public void index() { if (index == null) { LOG.info("Index transit model..."); - // the transit model indexing updates the stop model index (flex stops added to the stop index) + // the transit model indexing updates the site repository index (flex stops added to the stop index) this.index = new TimetableRepositoryIndex(this); LOG.info("Index transit model complete."); } @@ -430,8 +430,8 @@ public Collection getTransfersByStop(StopLocation stop) { return transfersByStop.get(stop); } - public StopModel getStopModel() { - return stopModel; + public SiteRepository getSiteRepository() { + return siteRepository; } public void addTripPattern(FeedScopedId id, TripPattern tripPattern) { @@ -499,11 +499,11 @@ public void setTransitLayerUpdater(TransitLayerUpdater transitLayerUpdater) { } /** - * Updating the stop model is only allowed during graph build + * Updating the site repository is only allowed during graph build */ - public void mergeStopModels(StopModel childStopModel) { + public void mergeSiteRepositories(SiteRepository childSiteRepository) { invalidateIndex(); - this.stopModel = this.stopModel.merge(childStopModel); + this.siteRepository = this.siteRepository.merge(childSiteRepository); } public void addFlexTrip(FeedScopedId id, FlexTrip flexTrip) { diff --git a/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java index c3bb31ed068..3be1bcbc4a2 100644 --- a/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java +++ b/application/src/main/java/org/opentripplanner/updater/siri/AddedTripBuilder.java @@ -199,7 +199,7 @@ Result build() { stopSequence == (calls.size() - 1) ); - // Drop this update if the call refers to an unknown stop (not present in the stop model). + // Drop this update if the call refers to an unknown stop (not present in the site repository). if (stopTime == null) { return UpdateError.result(tripId, NO_VALID_STOPS); } @@ -335,7 +335,7 @@ private Trip createTrip(Route route, FeedScopedId calServiceId) { } /** - * Map the call to a StopTime or return null if the stop cannot be found in the stop model. + * Map the call to a StopTime or return null if the stop cannot be found in the site repository. */ private StopTime createStopTime( Trip trip, diff --git a/application/src/test/java/org/opentripplanner/ConstantsForTests.java b/application/src/test/java/org/opentripplanner/ConstantsForTests.java index 241cc245da1..aeacc11eca4 100644 --- a/application/src/test/java/org/opentripplanner/ConstantsForTests.java +++ b/application/src/test/java/org/opentripplanner/ConstantsForTests.java @@ -43,7 +43,7 @@ import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class ConstantsForTests { @@ -100,7 +100,10 @@ public static NetexBundle createMinimalNetexNordicBundle() { var dataSource = new ZipFileDataSource(netexZipFile, FileType.NETEX); var configuredDataSource = new ConfiguredDataSource<>(dataSource, buildConfig.netexDefaults); - var transitService = new OtpTransitServiceBuilder(new StopModel(), DataImportIssueStore.NOOP); + var transitService = new OtpTransitServiceBuilder( + new SiteRepository(), + DataImportIssueStore.NOOP + ); return new NetexConfigure(buildConfig).netexBundle(transitService, configuredDataSource); } @@ -112,7 +115,10 @@ public static NetexBundle createMinimalNetexEpipBundle() { var dataSource = new DirectoryDataSource(netexZipFile, FileType.NETEX); var configuredDataSource = new ConfiguredDataSource<>(dataSource, buildConfig.netexDefaults); - var transitService = new OtpTransitServiceBuilder(new StopModel(), DataImportIssueStore.NOOP); + var transitService = new OtpTransitServiceBuilder( + new SiteRepository(), + DataImportIssueStore.NOOP + ); return new NetexConfigure(buildConfig).netexBundle(transitService, configuredDataSource); } @@ -124,7 +130,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(PORTLAND_CENTRAL_OSM, false); @@ -162,7 +168,7 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { addPortlandVehicleRentals(graph); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); return new TestOtpModel(graph, timetableRepository); } catch (Exception e) { @@ -173,9 +179,9 @@ public static TestOtpModel buildNewPortlandGraph(boolean withElevation) { public static TestOtpModel buildOsmGraph(File osmFile) { try { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).build(); @@ -209,9 +215,9 @@ public static TestOtpModel buildGtfsGraph(File gtfsPath) { public static TestOtpModel buildGtfsGraph(File gtfsFile, FareServiceFactory fareServiceFactory) { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); addGtfsToGraph(graph, timetableRepository, gtfsFile, fareServiceFactory, null); return new TestOtpModel(graph, timetableRepository); } @@ -219,9 +225,9 @@ public static TestOtpModel buildGtfsGraph(File gtfsFile, FareServiceFactory fare public static TestOtpModel buildNewMinimalNetexGraph() { try { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); // Add street data from OSM { OsmProvider osmProvider = new OsmProvider(OSLO_EAST_OSM, false); @@ -292,7 +298,7 @@ public static void addGtfsToGraph( module.buildGraph(); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); } private static void addPortlandVehicleRentals(Graph graph) { diff --git a/application/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java index 0e862c38901..8f5f7c96afa 100644 --- a/application/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -39,7 +39,7 @@ import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.framework.FeedScopedId; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.TimetableSnapshotSourceParameters; import org.opentripplanner.updater.alert.AlertsUpdateHandler; @@ -194,7 +194,7 @@ protected void setUp() throws Exception { alertsUpdateHandler = new AlertsUpdateHandler(false); var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); GtfsModule gtfsGraphBuilderImpl = new GtfsModule( gtfsBundleList, @@ -205,7 +205,7 @@ protected void setUp() throws Exception { gtfsGraphBuilderImpl.buildGraph(); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); serverContext = TestServerContext.createServerContext(graph, timetableRepository); timetableSnapshotSource = new TimetableSnapshotSource( diff --git a/application/src/test/java/org/opentripplanner/TestOtpModel.java b/application/src/test/java/org/opentripplanner/TestOtpModel.java index 36caf1dec43..62b5fce3416 100644 --- a/application/src/test/java/org/opentripplanner/TestOtpModel.java +++ b/application/src/test/java/org/opentripplanner/TestOtpModel.java @@ -6,7 +6,7 @@ public record TestOtpModel(Graph graph, TimetableRepository timetableRepository) { public TestOtpModel index() { timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); return this; } } diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java index 663ce2d5f3f..406217e6604 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java @@ -157,9 +157,9 @@ static void setup() { List.of() ); - var stopModel = TEST_MODEL.stopModelBuilder(); - STOP_LOCATIONS.forEach(stopModel::withRegularStop); - var model = stopModel.build(); + var siteRepository = TEST_MODEL.siteRepositoryBuilder(); + STOP_LOCATIONS.forEach(siteRepository::withRegularStop); + var model = siteRepository.build(); var timetableRepository = new TimetableRepository(model, DEDUPLICATOR); var trip = TimetableRepositoryForTest diff --git a/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java index b8eeb2d13d9..593fb622adc 100644 --- a/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java @@ -89,14 +89,14 @@ public class TripRequestMapperTest implements PlanTestConstants { .bus(route2, 2, time("11:20"), time("11:40"), Place.forStop(stop3)) .build(); var patterns = itineraryPatterns(itinerary); - var stopModel = TEST_MODEL - .stopModelBuilder() + var siteRepository = TEST_MODEL + .siteRepositoryBuilder() .withRegularStop(stop1) .withRegularStop(stop2) .withRegularStop(stop3) .build(); - var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + var timetableRepository = new TimetableRepository(siteRepository, new Deduplicator()); timetableRepository.initTimeZone(ZoneIds.STOCKHOLM); var calendarServiceData = new CalendarServiceData(); LocalDate serviceDate = itinerary.startTime().toLocalDate(); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java index 650282d6e7d..75f7077eb7d 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/GtfsModuleTest.java @@ -18,7 +18,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; class GtfsModuleTest { @@ -70,9 +70,9 @@ void duplicateFeedId() { private static TestModels buildTestModel() { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); return new TestModels(graph, timetableRepository); } diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java index f411bf6757c..a2e7ebef402 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/OsmBoardingLocationsModuleTest.java @@ -28,7 +28,7 @@ import org.opentripplanner.transit.model.basic.TransitMode; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; /** @@ -69,7 +69,7 @@ static Stream testCases() { void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVertices) { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); var factory = new VertexFactory(graph); var provider = new OsmProvider(file, false); @@ -98,7 +98,7 @@ void addAndLinkBoardingLocations(boolean areaVisibility, Set linkedVerti ); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); assertEquals(0, busVertex.getIncoming().size()); assertEquals(0, busVertex.getOutgoing().size()); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java index f9957a09b95..d04d1a33058 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/StreetLinkerModuleTest.java @@ -24,7 +24,7 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; class StreetLinkerModuleTest { @@ -115,7 +115,7 @@ public TestModel() { var walkableEdge = StreetModelForTest.streetEdge(from, to, PEDESTRIAN); var drivableEdge = StreetModelForTest.streetEdge(from, to, CAR); - var builder = StopModel.of(); + var builder = SiteRepository.of(); stop = builder .regularStop(id("platform-1")) diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java index bb15be82d9e..c59adad6fd5 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/islandpruning/IslandPruningUtils.java @@ -6,7 +6,7 @@ import org.opentripplanner.osm.OsmProvider; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; class IslandPruningUtils { @@ -21,7 +21,7 @@ static Graph buildOsmGraph( try { var deduplicator = new Deduplicator(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + var timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); // Add street data from OSM OsmProvider osmProvider = new OsmProvider(osmFile, true); OsmModule osmModule = OsmModule.of(osmProvider, graph).withEdgeNamer(new TestNamer()).build(); @@ -29,7 +29,7 @@ static Graph buildOsmGraph( osmModule.buildGraph(); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); // Prune floating islands and set noThru where necessary PruneIslands pruneIslands = new PruneIslands( diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java index adef7774936..6bda39e5058 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/LinkingTest.java @@ -32,7 +32,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class LinkingTest { @@ -150,9 +150,9 @@ public void testStopsLinkedIdentically() { /** Build a graph in Columbus, OH with no transit */ public static TestOtpModel buildGraphNoTransit() { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var gg = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); File file = ResourceLoader.of(LinkingTest.class).file("columbus.osm.pbf"); OsmProvider provider = new OsmProvider(file, false); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java index 4c8b6a176d3..a21b7aff55a 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/linking/TestGraph.java @@ -62,7 +62,7 @@ public static void addExtraStops(Graph graph) { /** link the stops in the graph */ public static void link(Graph graph, TimetableRepository timetableRepository) { timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); VertexLinker linker = graph.getLinker(); diff --git a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java index 75c56dd2fb3..492d04a0007 100644 --- a/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java +++ b/application/src/test/java/org/opentripplanner/graph_builder/module/osm/UnconnectedAreasTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.street.model.vertex.VertexLabel; import org.opentripplanner.test.support.ResourceLoader; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class UnconnectedAreasTest { @@ -157,9 +157,9 @@ private Graph buildOsmGraph(String osmFileName) { private Graph buildOsmGraph(String osmFileName, DataImportIssueStore issueStore) { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); OsmProvider provider = new OsmProvider(RESOURCE_LOADER.file(osmFileName), false); OsmModule loader = OsmModule .of(provider, graph) diff --git a/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java index 8b91e3c3d08..d0968adf7e9 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/GenerateTripPatternsOperationTest.java @@ -26,11 +26,11 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.Direction; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class GenerateTripPatternsOperationTest { - private static StopModel stopModel; + private static SiteRepository siteRepository; private static RegularStop stopA; private static RegularStop stopB; private static RegularStop stopC; @@ -54,9 +54,9 @@ static void setupClass() { stopA = timetableRepositoryForTest.stop("stopA").build(); stopB = timetableRepositoryForTest.stop("stopB").build(); stopC = timetableRepositoryForTest.stop("stopC").build(); - stopModel = + siteRepository = timetableRepositoryForTest - .stopModelBuilder() + .siteRepositoryBuilder() .withRegularStop(stopA) .withRegularStop(stopB) .withRegularStop(stopC) @@ -126,7 +126,7 @@ static void setupClass() { void setup() { deduplicator = new Deduplicator(); issueStore = new DefaultDataImportIssueStore(); - transitServiceBuilder = new OtpTransitServiceBuilder(stopModel, issueStore); + transitServiceBuilder = new OtpTransitServiceBuilder(siteRepository, issueStore); double maxStopToShapeSnapDistance = 100; geometryProcessor = new GeometryProcessor(transitServiceBuilder, maxStopToShapeSnapDistance, issueStore); diff --git a/application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java b/application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java index d74903495b3..80f66caf98e 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java +++ b/application/src/test/java/org/opentripplanner/gtfs/GtfsContextBuilder.java @@ -17,7 +17,7 @@ import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.StopTransferPriority; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * This class helps building GtfsContext and post process the GtfsDao by repairing @@ -44,7 +44,10 @@ public static GtfsContextBuilder contextBuilder(File file) throws IOException { public static GtfsContextBuilder contextBuilder(@Nullable String defaultFeedId, File path) throws IOException { - var transitBuilder = new OtpTransitServiceBuilder(new StopModel(), DataImportIssueStore.NOOP); + var transitBuilder = new OtpTransitServiceBuilder( + new SiteRepository(), + DataImportIssueStore.NOOP + ); GtfsImport gtfsImport = gtfsImport(defaultFeedId, path); GtfsFeedId feedId = gtfsImport.getFeedId(); var mapper = new GTFSToOtpTransitServiceMapper( diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java index 67b18ead0c5..99d7c4f3fce 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationGroupMapperTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class LocationGroupMapperTest { @@ -19,7 +19,7 @@ class LocationGroupMapperTest { @Test void map() { - var builder = StopModel.of(); + var builder = SiteRepository.of(); var mapper = new LocationGroupMapper( new StopMapper(new TranslationHelper(), id -> null, builder), new LocationMapper(builder, DataImportIssueStore.NOOP), diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java index ab8bd66a810..fb910765f1b 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/LocationMapperTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; import org.opentripplanner.graph_builder.issue.api.Issue; import org.opentripplanner.graph_builder.issue.service.DefaultDataImportIssueStore; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class LocationMapperTest { @@ -29,7 +29,7 @@ static Stream testCases() { void testMapping(String name, boolean isBogusName) { var gtfsLocation = getLocation(name, Polygons.OSLO); - var mapper = new LocationMapper(StopModel.of(), DataImportIssueStore.NOOP); + var mapper = new LocationMapper(SiteRepository.of(), DataImportIssueStore.NOOP); var flexLocation = mapper.map(gtfsLocation); assertEquals(isBogusName, flexLocation.hasFallbackName()); @@ -43,7 +43,7 @@ void invalidPolygon() { var gtfsLocation = getLocation("invalid", selfIntersecting); var issueStore = new DefaultDataImportIssueStore(); - var mapper = new LocationMapper(StopModel.of(), issueStore); + var mapper = new LocationMapper(SiteRepository.of(), issueStore); mapper.map(gtfsLocation); diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java index 1e321216305..ba913965c2d 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/PathwayMapperTest.java @@ -13,7 +13,7 @@ import org.onebusaway.gtfs.model.Pathway; import org.onebusaway.gtfs.model.Stop; import org.opentripplanner.transit.model.site.PathwayMode; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class PathwayMapperTest { @@ -30,7 +30,7 @@ public class PathwayMapperTest { private static final Stop TO_STOP = new Stop(); private final PathwayMapper subject = new PathwayMapper( - new StopMapper(TRANSLATION_HELPER, stationId -> null, new StopModel().withContext()), + new StopMapper(TRANSLATION_HELPER, stationId -> null, new SiteRepository().withContext()), new EntranceMapper(TRANSLATION_HELPER, stationId -> null), new PathwayNodeMapper(TRANSLATION_HELPER, stationId -> null), new BoardingAreaMapper(TRANSLATION_HELPER, stationId -> null) diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java index d15ad9d75cf..51d4ec2605f 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopAndStationMapperTest.java @@ -14,7 +14,7 @@ import org.onebusaway.gtfs.model.Stop; import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class StopAndStationMapperTest { @@ -51,7 +51,7 @@ public class StopAndStationMapperTest { private final StopMapper subject = new StopMapper( new TranslationHelper(), stationId -> null, - new StopModel().withContext() + new SiteRepository().withContext() ); static { diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java index d17c22c4abe..2bbed14334e 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/StopTimeMapperTest.java @@ -27,8 +27,8 @@ import org.opentripplanner.model.PickDrop; import org.opentripplanner.transit.model.site.AreaStop; import org.opentripplanner.transit.model.site.GroupStop; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; public class StopTimeMapperTest { @@ -68,22 +68,22 @@ public class StopTimeMapperTest { .map(c -> new LngLatAlt(c.x, c.y)) .toList(); - private final StopModelBuilder stopModelBuilder = StopModel.of(); + private final SiteRepositoryBuilder siteRepositoryBuilder = SiteRepository.of(); private final StopMapper stopMapper = new StopMapper( new TranslationHelper(), stationId -> null, - stopModelBuilder + siteRepositoryBuilder ); private final BookingRuleMapper bookingRuleMapper = new BookingRuleMapper(); private final LocationMapper locationMapper = new LocationMapper( - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); private final LocationGroupMapper locationGroupMapper = new LocationGroupMapper( stopMapper, locationMapper, - stopModelBuilder + siteRepositoryBuilder ); private final TranslationHelper translationHelper = new TranslationHelper(); private final StopTimeMapper subject = new StopTimeMapper( diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java index 3c5a1eff42a..0273c3055b9 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransferMapperTest.java @@ -19,8 +19,8 @@ import org.opentripplanner.model.transfer.ConstrainedTransfer; import org.opentripplanner.model.transfer.TransferPriority; import org.opentripplanner.transit.model.site.StopTransferPriority; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; public class TransferMapperTest { @@ -37,24 +37,24 @@ public class TransferMapperTest { private static StationMapper STATION_MAPPER; - private static final StopModelBuilder STOP_MODEL_BUILDER = StopModel.of(); + private static final SiteRepositoryBuilder SITE_REPOSITORY_BUILDER = SiteRepository.of(); private static final StopMapper STOP_MAPPER = new StopMapper( TRANSLATION_HELPER, stationId -> null, - STOP_MODEL_BUILDER + SITE_REPOSITORY_BUILDER ); private static final BookingRuleMapper BOOKING_RULE_MAPPER = new BookingRuleMapper(); private static final LocationMapper LOCATION_MAPPER = new LocationMapper( - STOP_MODEL_BUILDER, + SITE_REPOSITORY_BUILDER, ISSUE_STORE ); private static final LocationGroupMapper LOCATION_GROUP_MAPPER = new LocationGroupMapper( STOP_MAPPER, LOCATION_MAPPER, - STOP_MODEL_BUILDER + SITE_REPOSITORY_BUILDER ); private static StopTimeMapper STOP_TIME_MAPPER; diff --git a/application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java b/application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java index a1c01ca2e99..23a9ce972d0 100644 --- a/application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/inspector/vector/stop/AreaStopLayerBuilderTest.java @@ -9,17 +9,17 @@ import org.opentripplanner.inspector.vector.KeyValue; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.AreaStop; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; class AreaStopLayerBuilderTest { private static final FeedScopedId ID = new FeedScopedId("FEED", "ID"); private static final I18NString NAME = I18NString.of("Test stop"); - private final StopModelBuilder stopModelBuilder = StopModel.of(); + private final SiteRepositoryBuilder siteRepositoryBuilder = SiteRepository.of(); - private final AreaStop areaStop = stopModelBuilder + private final AreaStop areaStop = siteRepositoryBuilder .areaStop(ID) .withName(NAME) .withGeometry(Polygons.BERLIN) diff --git a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java index b37a0f55703..ae44e7239f5 100644 --- a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceBuilderLimitPeriodTest.java @@ -28,7 +28,7 @@ import org.opentripplanner.transit.model.timetable.Direction; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimesFactory; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; /** * This test will create a Transit service builder and then limit the service period. The services @@ -70,7 +70,7 @@ public class OtpTransitServiceBuilderLimitPeriodTest { @BeforeEach public void setUp() { - subject = new OtpTransitServiceBuilder(new StopModel(), DataImportIssueStore.NOOP); + subject = new OtpTransitServiceBuilder(new SiteRepository(), DataImportIssueStore.NOOP); // Add a service calendar that overlap with the period limit subject.getCalendars().add(createServiceCalendar(SERVICE_C_IN, D1, D3)); @@ -85,8 +85,8 @@ public void setUp() { subject.getCalendarDates().add(new ServiceCalendarDate(SERVICE_D_OUT, D1, 1)); // Add 2 stops - subject.stopModel().withRegularStop(STOP_1); - subject.stopModel().withRegularStop(STOP_2); + subject.siteRepository().withRegularStop(STOP_1); + subject.siteRepository().withRegularStop(STOP_2); // Add Route subject.getRoutes().add(route); diff --git a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java index 48bff78273f..728208438a8 100644 --- a/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java +++ b/application/src/test/java/org/opentripplanner/model/impl/OtpTransitServiceImplTest.java @@ -94,7 +94,7 @@ public void testGetAllTransfers() { @Test public void testGetAllStations() { - Collection stations = subject.stopModel().listStations(); + Collection stations = subject.siteRepository().listStations(); assertEquals(1, stations.size()); assertEquals("Station{F:station station}", first(stations).toString()); @@ -102,7 +102,7 @@ public void testGetAllStations() { @Test public void testGetAllStops() { - Collection stops = subject.stopModel().listRegularStops(); + Collection stops = subject.siteRepository().listRegularStops(); assertEquals(25, stops.size()); assertEquals("RegularStop{F:A A}", first(stops).toString()); @@ -132,14 +132,14 @@ public void testGetAllTrips() { @Test public void testGetStopForId() { - RegularStop stop = subject.stopModel().getRegularStop(TimetableRepositoryForTest.id("P")); + RegularStop stop = subject.siteRepository().getRegularStop(TimetableRepositoryForTest.id("P")); assertEquals("RegularStop{F:P P}", stop.toString()); } @Test public void testGetStopsForStation() { List stops = new ArrayList<>( - subject.stopModel().getStationById(STATION_ID).getChildStops() + subject.siteRepository().getStationById(STATION_ID).getChildStops() ); assertEquals("[RegularStop{F:A A}]", stops.toString()); } diff --git a/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java index 3062d71facd..4d7375b7c89 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/PlaceTest.java @@ -19,7 +19,7 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class PlaceTest { @@ -79,7 +79,7 @@ static Stream flexStopCases() { @ParameterizedTest(name = "Flex stop name of {0} should lead to a place name of {1}") @MethodSource("flexStopCases") public void flexStop(I18NString stopName, String expectedPlaceName) { - var stop = StopModel + var stop = SiteRepository .of() .areaStop(new FeedScopedId("1", "stop_id")) .withGeometry(GEOMETRY) diff --git a/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java index d663e7bed2f..556cfc1ca90 100644 --- a/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java +++ b/application/src/test/java/org/opentripplanner/model/plan/legreference/ScheduledTransitLegReferenceTest.java @@ -24,7 +24,7 @@ import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitService; @@ -72,15 +72,15 @@ static void buildTransitService() { stopIdAtPosition2 = tripPattern.getStop(2).getId(); // build transit model - StopModel stopModel = TEST_MODEL - .stopModelBuilder() + SiteRepository siteRepository = TEST_MODEL + .siteRepositoryBuilder() .withRegularStop(stop1) .withRegularStop(stop2) .withRegularStop(stop3) .withRegularStop(stop4) .build(); TimetableRepository timetableRepository = new TimetableRepository( - stopModel, + siteRepository, new Deduplicator() ); timetableRepository.addTripPattern(tripPattern.getId(), tripPattern); diff --git a/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java b/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java index 72e750c055f..f5d3f4d21a3 100644 --- a/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java +++ b/application/src/test/java/org/opentripplanner/netex/NetexEpipBundleSmokeTest.java @@ -62,8 +62,8 @@ void smokeTestOfNetexEpipLoadData() { assertAgencies(otpModel.getAllAgencies()); assertOperators(otpModel.getAllOperators()); - assertStops(otpModel.stopModel().listRegularStops()); - assertStations(otpModel.stopModel().listStations()); + assertStops(otpModel.siteRepository().listRegularStops()); + assertStations(otpModel.siteRepository().listStations()); assertTripPatterns(otpModel.getTripPatterns()); assertTrips(otpModel.getAllTrips()); assertServiceIds(otpModel.getAllTrips(), otpModel.getAllServiceIds()); diff --git a/application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java b/application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java index 6b5e9b60098..c91195c1ab5 100644 --- a/application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java +++ b/application/src/test/java/org/opentripplanner/netex/NetexNordicBundleSmokeTest.java @@ -67,10 +67,10 @@ public void smokeTestOfNetexNordicLoadData() { OtpTransitService otpModel = transitBuilder.build(); assertAgencies(otpModel.getAllAgencies()); - assertMultiModalStations(otpModel.stopModel().listMultiModalStations()); + assertMultiModalStations(otpModel.siteRepository().listMultiModalStations()); assertOperators(otpModel.getAllOperators()); - assertStops(otpModel.stopModel().listRegularStops()); - assertStations(otpModel.stopModel().listStations()); + assertStops(otpModel.siteRepository().listRegularStops()); + assertStations(otpModel.siteRepository().listStations()); assertTripPatterns(otpModel.getTripPatterns()); assertTrips(otpModel.getAllTrips()); assertServiceIds(otpModel.getAllTrips(), otpModel.getAllServiceIds()); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java index 4721ef03bf3..272db6b62f0 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/FlexStopsMapperTest.java @@ -23,7 +23,7 @@ import org.opentripplanner.transit.model.site.GroupStop; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.StopLocation; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.AllVehicleModesOfTransportEnumeration; import org.rutebanken.netex.model.FlexibleArea; import org.rutebanken.netex.model.FlexibleStopPlace; @@ -127,14 +127,14 @@ class FlexStopsMapperTest { ); private final TimetableRepositoryForTest testModel = TimetableRepositoryForTest.of(); - private final StopModelBuilder stopModelBuilder = testModel.stopModelBuilder(); + private final SiteRepositoryBuilder siteRepositoryBuilder = testModel.siteRepositoryBuilder(); @Test void testMapAreaStop() { FlexStopsMapper flexStopsMapper = new FlexStopsMapper( ID_FACTORY, List.of(), - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); @@ -195,7 +195,7 @@ void testMapFlexibleStopPlaceMissingStops() { FlexStopsMapper subject = new FlexStopsMapper( ID_FACTORY, List.of(), - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); @@ -216,7 +216,7 @@ void testMapFlexibleStopPlaceWithInvalidGeometryOnUnrestrictedPublicTransportAre FlexStopsMapper subject = new FlexStopsMapper( ID_FACTORY, List.of(stop1, stop2), - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); @@ -248,7 +248,7 @@ private void assertGroupStopMapping(FlexibleStopPlace flexibleStopPlace) { FlexStopsMapper subject = new FlexStopsMapper( ID_FACTORY, List.of(stop1, stop2, stop3), - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); @@ -292,7 +292,7 @@ private AreaStop createAreaStop(Collection polygonCoordinates) { FlexStopsMapper flexStopsMapper = new FlexStopsMapper( ID_FACTORY, List.of(), - stopModelBuilder, + siteRepositoryBuilder, DataImportIssueStore.NOOP ); FlexibleStopPlace flexibleStopPlace = getFlexibleStopPlace(polygonCoordinates); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java index 955a3fec34a..b2187af4216 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/RouteMapperTest.java @@ -22,7 +22,7 @@ import org.opentripplanner.transit.model.network.Route; import org.opentripplanner.transit.model.organization.Agency; import org.opentripplanner.transit.model.organization.Branding; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.rutebanken.netex.model.AllVehicleModesOfTransportEnumeration; import org.rutebanken.netex.model.Authority; import org.rutebanken.netex.model.BrandingRefStructure; @@ -76,7 +76,7 @@ void mapRouteWithDefaultAgency() { void mapRouteWithAgencySpecified() { NetexEntityIndex netexIndex = new NetexEntityIndex(); OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder( - new StopModel(), + new SiteRepository(), DataImportIssueStore.NOOP ); @@ -191,7 +191,7 @@ void mapRouteWithoutBranding() { void mapRouteWithBranding() { NetexEntityIndex netexIndex = new NetexEntityIndex(); OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder( - new StopModel(), + new SiteRepository(), DataImportIssueStore.NOOP ); @@ -225,7 +225,7 @@ void mapRouteWithBranding() { void mapRouteWithGroupOfRoutes() { NetexEntityIndex netexIndex = new NetexEntityIndex(); OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder( - new StopModel(), + new SiteRepository(), DataImportIssueStore.NOOP ); diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java index aa19a436112..52c1564f025 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/ServiceLinkMapperTest.java @@ -25,7 +25,7 @@ import org.opentripplanner.transit.model.network.StopPattern; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.rutebanken.netex.model.JourneyPattern; import org.rutebanken.netex.model.LinkSequenceProjection; import org.rutebanken.netex.model.LinkSequenceProjection_VersionStructure; @@ -107,7 +107,11 @@ void setUpTestData() { EntityById stopsById = new DefaultEntityById<>(); issueStore = new DefaultDataImportIssueStore(); - QuayMapper quayMapper = new QuayMapper(ID_FACTORY, issueStore, new StopModel().withContext()); + QuayMapper quayMapper = new QuayMapper( + ID_FACTORY, + issueStore, + new SiteRepository().withContext() + ); stopPatternBuilder = StopPattern.create(3); Station parentStation = Station diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java index 8b09fe41b2a..6f0524d92d7 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StationMapperTest.java @@ -12,7 +12,7 @@ import org.opentripplanner.netex.NetexTestDataSupport; import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.rutebanken.netex.model.Quay; import org.rutebanken.netex.model.StopPlace; @@ -29,7 +29,7 @@ void setUp() { ZoneId.of("UTC"), false, Set.of(), - StopModel.of() + SiteRepository.of() ); } diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java index f61bef86a19..2d710224661 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/StopAndStationMapperTest.java @@ -23,8 +23,8 @@ import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; import org.rutebanken.netex.model.AccessibilityAssessment; import org.rutebanken.netex.model.AccessibilityLimitation; import org.rutebanken.netex.model.AccessibilityLimitations_RelStructure; @@ -78,7 +78,7 @@ void testWheelChairBoarding() { var stopPlaceById = new HierarchicalVersionMapById(); stopPlaceById.add(stopPlace); - StopAndStationMapper stopAndStationMapper = createStopAndStationMapper(StopModel.of()); + StopAndStationMapper stopAndStationMapper = createStopAndStationMapper(SiteRepository.of()); stopAndStationMapper.mapParentAndChildStops(List.of(stopPlace)); @@ -159,7 +159,7 @@ void mapStopPlaceAndQuays() { MappingSupport.ID_FACTORY, quaysById, null, - StopModel.of(), + SiteRepository.of(), DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, false, @@ -230,7 +230,7 @@ void testMapIsolatedStopPlace(boolean isolated) { MappingSupport.ID_FACTORY, new HierarchicalVersionMapById<>(), null, - StopModel.of(), + SiteRepository.of(), DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, isolated, @@ -264,20 +264,20 @@ void testDuplicateStopIndices() { stopPlace.setQuays(new Quays_RelStructure().withQuayRefOrQuay(objectFactory.createQuay(quay1))); - StopModelBuilder stopModelBuilder = StopModel.of(); + SiteRepositoryBuilder siteRepositoryBuilder = SiteRepository.of(); - StopAndStationMapper stopAndStationMapper = createStopAndStationMapper(stopModelBuilder); + StopAndStationMapper stopAndStationMapper = createStopAndStationMapper(siteRepositoryBuilder); stopAndStationMapper.mapParentAndChildStops(List.of(stopPlace)); - stopModelBuilder.withRegularStops(stopAndStationMapper.resultStops); + siteRepositoryBuilder.withRegularStops(stopAndStationMapper.resultStops); - StopAndStationMapper stopAndStationMapper2 = createStopAndStationMapper(stopModelBuilder); + StopAndStationMapper stopAndStationMapper2 = createStopAndStationMapper(siteRepositoryBuilder); stopAndStationMapper2.mapParentAndChildStops(List.of(stopPlace)); - stopModelBuilder.withRegularStops(stopAndStationMapper2.resultStops); + siteRepositoryBuilder.withRegularStops(stopAndStationMapper2.resultStops); - assertEquals(1, stopModelBuilder.regularStopsById().size()); + assertEquals(1, siteRepositoryBuilder.regularStopsById().size()); assertEquals( 0, - stopModelBuilder + siteRepositoryBuilder .regularStopsById() .get(MappingSupport.ID_FACTORY.createId("ST:Quay:1")) .getIndex() @@ -291,7 +291,7 @@ void testRouteToCentroid() { MappingSupport.ID_FACTORY, new HierarchicalVersionMapById<>(), null, - StopModel.of(), + SiteRepository.of(), DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, false, @@ -312,13 +312,13 @@ void testRouteToCentroid() { } private static StopAndStationMapper createStopAndStationMapper( - StopModelBuilder stopModelBuilder + SiteRepositoryBuilder siteRepositoryBuilder ) { return new StopAndStationMapper( MappingSupport.ID_FACTORY, new HierarchicalVersionMapById<>(), null, - stopModelBuilder, + siteRepositoryBuilder, DEFAULT_TIME_ZONE, DataImportIssueStore.NOOP, false, diff --git a/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java index a4684fdba8f..6c4973329d3 100644 --- a/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java +++ b/application/src/test/java/org/opentripplanner/netex/mapping/TripMapperTest.java @@ -16,7 +16,7 @@ import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.framework.FeedScopedId; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.rutebanken.netex.model.AccessibilityAssessment; import org.rutebanken.netex.model.AccessibilityLimitation; import org.rutebanken.netex.model.AccessibilityLimitations_RelStructure; @@ -49,7 +49,7 @@ public void mapTripWithWheelchairAccess() { var limitations = new AccessibilityLimitations_RelStructure(); var access = new AccessibilityAssessment(); - var transitBuilder = new OtpTransitServiceBuilder(new StopModel(), issueStore); + var transitBuilder = new OtpTransitServiceBuilder(new SiteRepository(), issueStore); transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); TripMapper tripMapper = new TripMapper( @@ -79,7 +79,7 @@ public void mapTripWithWheelchairAccess() { @Test public void mapTrip() { OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder( - new StopModel(), + new SiteRepository(), issueStore ); transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); @@ -106,7 +106,7 @@ public void mapTrip() { @Test public void mapTripWithRouteRefViaJourneyPattern() { OtpTransitServiceBuilder transitBuilder = new OtpTransitServiceBuilder( - new StopModel(), + new SiteRepository(), issueStore ); transitBuilder.getRoutes().add(TimetableRepositoryForTest.route(ROUTE_ID).build()); diff --git a/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java index 2411444db49..dc473276c7b 100644 --- a/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java +++ b/application/src/test/java/org/opentripplanner/routing/TestHalfEdges.java @@ -68,7 +68,7 @@ public class TestHalfEdges { public void setUp() { var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - var stopModelBuilder = testModel.stopModelBuilder(); + var siteRepositoryBuilder = testModel.siteRepositoryBuilder(); var factory = new VertexFactory(graph); // a 0.1 degree x 0.1 degree square tl = factory.intersection("tl", -74.01, 40.01); @@ -161,8 +161,8 @@ public void setUp() { var s1 = testModel.stop("fleem station", 40.0099999, -74.005).build(); var s2 = testModel.stop("morx station", 40.0099999, -74.002).build(); - stopModelBuilder.withRegularStop(s1).withRegularStop(s2); - timetableRepository = new TimetableRepository(stopModelBuilder.build(), deduplicator); + siteRepositoryBuilder.withRegularStop(s1).withRegularStop(s2); + timetableRepository = new TimetableRepository(siteRepositoryBuilder.build(), deduplicator); station1 = factory.transitStop(TransitStopVertex.of().withStop(s1)); station2 = factory.transitStop(TransitStopVertex.of().withStop(s2)); @@ -173,7 +173,7 @@ public void setUp() { graph.hasStreets = true; timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); } @Test @@ -596,7 +596,7 @@ public void testStreetSplittingAlerts() { public void testStreetLocationFinder() { StreetIndex finder = graph.getStreetIndex(); GraphFinder graphFinder = new DirectGraphFinder( - timetableRepository.getStopModel()::findRegularStops + timetableRepository.getSiteRepository()::findRegularStops ); Set tempEdges = new HashSet<>(); // test that the local stop finder finds stops diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java index 8108274c318..b9f9d7acb56 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/GraphRoutingTest.java @@ -61,7 +61,7 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StationBuilder; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public abstract class GraphRoutingTest { @@ -85,7 +85,7 @@ public abstract static class Builder { protected Builder() { var deduplicator = new Deduplicator(); graph = new Graph(deduplicator); - timetableRepository = new TimetableRepository(new StopModel(), deduplicator); + timetableRepository = new TimetableRepository(new SiteRepository(), deduplicator); vertexFactory = new VertexFactory(graph); vehicleParkingHelper = new VehicleParkingHelper(graph); } @@ -242,8 +242,8 @@ RegularStop stopEntity( double longitude, @Nullable Station parentStation ) { - var stopModelBuilder = timetableRepository.getStopModel().withContext(); - var testModel = new TimetableRepositoryForTest(stopModelBuilder); + var siteRepositoryBuilder = timetableRepository.getSiteRepository().withContext(); + var testModel = new TimetableRepositoryForTest(siteRepositoryBuilder); var stopBuilder = testModel.stop(id).withCoordinate(latitude, longitude); if (parentStation != null) { @@ -251,19 +251,21 @@ RegularStop stopEntity( } var stop = stopBuilder.build(); - timetableRepository.mergeStopModels(stopModelBuilder.withRegularStop(stop).build()); + timetableRepository.mergeSiteRepositories( + siteRepositoryBuilder.withRegularStop(stop).build() + ); return stop; } public Station stationEntity(String id, Consumer stationBuilder) { - var stopModelBuilder = timetableRepository.getStopModel().withContext(); - var testModel = new TimetableRepositoryForTest(stopModelBuilder); + var siteRepositoryBuilder = timetableRepository.getSiteRepository().withContext(); + var testModel = new TimetableRepositoryForTest(siteRepositoryBuilder); var builder = testModel.station(id); stationBuilder.accept(builder); var station = builder.build(); - timetableRepository.mergeStopModels(stopModelBuilder.withStation(station).build()); + timetableRepository.mergeSiteRepositories(siteRepositoryBuilder.withStation(station).build()); return station; } 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 d1940119655..4887b1e6f03 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 @@ -262,11 +262,11 @@ void isSearchWindowAware() { } private TripPattern getOriginalPattern(TestTripPattern pattern) { - var stopModelBuilder = TEST_MODEL.stopModelBuilder(); + var siteRepositoryBuilder = TEST_MODEL.siteRepositoryBuilder(); ArrayList stopTimes = new ArrayList<>(); for (int i = 0; i < pattern.numberOfStopsInPattern(); i++) { - var stop = stopModelBuilder + var stop = siteRepositoryBuilder .regularStop(new FeedScopedId("TestFeed", i + "")) .withCoordinate(0.0, 0.0) .build(); @@ -311,7 +311,7 @@ private static TransitLayer getTransitLayer() { null, null, TEST_MODEL - .stopModelBuilder() + .siteRepositoryBuilder() .withRegularStop(S1) .withRegularStop(S2) .withRegularStop(S3) diff --git a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java index 1301eea3844..b7e441e4bf2 100644 --- a/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java +++ b/application/src/test/java/org/opentripplanner/routing/algorithm/raptoradapter/transit/mappers/TransitLayerMapperTest.java @@ -11,7 +11,7 @@ import org.opentripplanner.transit.model.site.Station; import org.opentripplanner.transit.model.site.StopLocation; import org.opentripplanner.transit.model.site.StopTransferPriority; -import org.opentripplanner.transit.service.StopModelMock; +import org.opentripplanner.transit.service.SiteRepositoryMock; class TransitLayerMapperTest { @@ -44,7 +44,7 @@ class TransitLayerMapperTest { @Test public void createStopBoardAlightTransferCosts() { int[] result = TransitLayerMapper.createStopBoardAlightTransferCosts( - new StopModelMock(STOPS), + new SiteRepositoryMock(STOPS), TransitTuningParameters.FOR_TEST ); diff --git a/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java b/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java index 1af45763b60..03359143f54 100644 --- a/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java +++ b/application/src/test/java/org/opentripplanner/routing/core/TemporaryVerticesContainerTest.java @@ -16,7 +16,6 @@ import org.opentripplanner.framework.geometry.GeometryUtils; import org.opentripplanner.framework.geometry.SphericalDistanceLibrary; import org.opentripplanner.model.GenericLocation; -import org.opentripplanner.routing.api.request.RouteRequest; import org.opentripplanner.routing.api.request.StreetMode; import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.street.model.StreetTraversalPermission; @@ -29,7 +28,7 @@ import org.opentripplanner.street.model.vertex.Vertex; import org.opentripplanner.street.search.TemporaryVerticesContainer; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class TemporaryVerticesContainerTest { @@ -55,7 +54,7 @@ public void setup() { createStreetEdge(a, b, "a -> b"); createStreetEdge(b, a, "b -> a"); createStreetEdge(a, c, "a -> c"); - g.index(new StopModel()); + g.index(new SiteRepository()); } @Test diff --git a/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java index 03bd2d2b5cc..47568fa1252 100644 --- a/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graph/GraphSerializationTest.java @@ -207,10 +207,10 @@ private void testRoundTrip( // might be indexed by other tests. originalTimetableRepository.index(); - originalGraph.index(originalTimetableRepository.getStopModel()); + originalGraph.index(originalTimetableRepository.getSiteRepository()); copiedTimetableRepository1.index(); - copiedGraph1.index(copiedTimetableRepository1.getStopModel()); + copiedGraph1.index(copiedTimetableRepository1.getSiteRepository()); assertNoDifferences(originalGraph, copiedGraph1); @@ -218,7 +218,7 @@ private void testRoundTrip( Graph copiedGraph2 = deserializedGraph2.graph; TimetableRepository copiedTimetableRepository2 = deserializedGraph2.timetableRepository; copiedTimetableRepository2.index(); - copiedGraph2.index(copiedTimetableRepository2.getStopModel()); + copiedGraph2.index(copiedTimetableRepository2.getSiteRepository()); assertNoDifferences(copiedGraph1, copiedGraph2); } } diff --git a/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java index c407fa08098..215bd317335 100644 --- a/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java +++ b/application/src/test/java/org/opentripplanner/routing/graphfinder/DirectGraphFinderTest.java @@ -9,11 +9,11 @@ import org.opentripplanner.TestOtpModel; import org.opentripplanner.routing.algorithm.GraphRoutingTest; import org.opentripplanner.street.model.vertex.TransitStopVertex; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class DirectGraphFinderTest extends GraphRoutingTest { - private StopModel stopModel; + private SiteRepository siteRepository; private TransitStopVertex S1, S2, S3; @@ -29,7 +29,7 @@ public void build() { } } ); - stopModel = model.timetableRepository().getStopModel(); + siteRepository = model.timetableRepository().getSiteRepository(); } @Test @@ -37,7 +37,7 @@ void findClosestStops() { var ns1 = new NearbyStop(S1.getStop(), 0, null, null); var ns2 = new NearbyStop(S2.getStop(), 1112, null, null); - var subject = new DirectGraphFinder(stopModel::findRegularStops); + var subject = new DirectGraphFinder(siteRepository::findRegularStops); var coordinate = new Coordinate(19.000, 47.500); assertEquals(List.of(ns1), subject.findClosestStops(coordinate, 100)); diff --git a/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java index f0ddc08087e..e37ced70721 100644 --- a/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java +++ b/application/src/test/java/org/opentripplanner/routing/linking/LinkStopToPlatformTest.java @@ -32,7 +32,7 @@ import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; import org.opentripplanner.transit.model.framework.Deduplicator; import org.opentripplanner.transit.model.site.RegularStop; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,9 +45,9 @@ public class LinkStopToPlatformTest { private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] stops) { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); Graph graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); ArrayList vertices = new ArrayList<>(); Coordinate[] closedGeom = new Coordinate[platform.length + 1]; @@ -107,7 +107,7 @@ private Graph prepareTest(Coordinate[] platform, int[] visible, Coordinate[] sto } timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); for (RegularStop s : transitStops) { var v = TransitStopVertex.of().withStop(s).build(); diff --git a/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java index 7dee554efdd..03c4981f181 100644 --- a/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java +++ b/application/src/test/java/org/opentripplanner/routing/vehicle_parking/VehicleParkingTestGraphData.java @@ -6,7 +6,7 @@ import org.opentripplanner.street.model.vertex.IntersectionVertex; import org.opentripplanner.street.model.vertex.VertexFactory; import org.opentripplanner.transit.model.framework.Deduplicator; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; public class VehicleParkingTestGraphData { @@ -19,9 +19,9 @@ public class VehicleParkingTestGraphData { public void initGraph() { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); graph = new Graph(deduplicator); - timetableRepository = new TimetableRepository(stopModel, deduplicator); + timetableRepository = new TimetableRepository(siteRepository, deduplicator); graph.hasStreets = true; var factory = new VertexFactory(graph); diff --git a/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java index 60daef889b0..8092ab62bc3 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BarrierRoutingTest.java @@ -45,7 +45,7 @@ public static void createGraph() { ResourceLoader.of(BarrierRoutingTest.class).file("herrenberg-barrier-gates.osm.pbf") ); graph = model.graph(); - graph.index(model.timetableRepository().getStopModel()); + graph.index(model.timetableRepository().getSiteRepository()); } /** diff --git a/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java index d5d6f7452db..60dc43aa3f9 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/BicycleRoutingTest.java @@ -35,7 +35,7 @@ public class BicycleRoutingTest { herrenbergGraph = model.graph(); model.timetableRepository().index(); - herrenbergGraph.index(model.timetableRepository().getStopModel()); + herrenbergGraph.index(model.timetableRepository().getSiteRepository()); } /** diff --git a/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java index 50ab7d5ea55..6f3f47ba6e6 100644 --- a/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java +++ b/application/src/test/java/org/opentripplanner/street/integration/WalkRoutingTest.java @@ -30,7 +30,7 @@ class WalkRoutingTest { roundabout = model.graph(); model.timetableRepository().index(); - roundabout.index(model.timetableRepository().getStopModel()); + roundabout.index(model.timetableRepository().getSiteRepository()); } /** diff --git a/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java index 5b3883005de..e046ea42247 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/PatternTestModel.java @@ -9,7 +9,7 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.timetable.ScheduledTripTimes; import org.opentripplanner.transit.model.timetable.Trip; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public class PatternTestModel { @@ -22,7 +22,7 @@ public class PatternTestModel { .withServiceId(SERVICE_ID) .build(); private static final TimetableRepositoryForTest MODEL = new TimetableRepositoryForTest( - StopModel.of() + SiteRepository.of() ); private static final RegularStop STOP_1 = MODEL.stop("1").build(); private static final StopPattern STOP_PATTERN = TimetableRepositoryForTest.stopPattern( diff --git a/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java index 1da4b5b06e0..7d7652b52e6 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/_data/TimetableRepositoryForTest.java @@ -38,17 +38,17 @@ import org.opentripplanner.transit.model.site.StopTransferPriority; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripBuilder; -import org.opentripplanner.transit.service.StopModel; -import org.opentripplanner.transit.service.StopModelBuilder; +import org.opentripplanner.transit.service.SiteRepository; +import org.opentripplanner.transit.service.SiteRepositoryBuilder; /** * Test utility class to help construct valid transit model objects. *

* TODO: This need cleanup - it has static factory methods. This is not safe, since * all objects created will be created in the same context. All stops are created - * withing the context of a StopModel, mixing more than one model in a test is sharing + * withing the context of a SiteRepository, mixing more than one model in a test is sharing * state between tests. For now, it is just the stop index - but we want to - * use this to encapsulate the StopModel completely. + * use this to encapsulate the SiteRepository completely. */ public class TimetableRepositoryForTest { @@ -89,14 +89,14 @@ public class TimetableRepositoryForTest { .withUrl("https:/www.otherfeedagency.com") .build(); - private final StopModelBuilder stopModelBuilder; + private final SiteRepositoryBuilder siteRepositoryBuilder; - public TimetableRepositoryForTest(StopModelBuilder stopModelBuilder) { - this.stopModelBuilder = stopModelBuilder; + public TimetableRepositoryForTest(SiteRepositoryBuilder siteRepositoryBuilder) { + this.siteRepositoryBuilder = siteRepositoryBuilder; } public static TimetableRepositoryForTest of() { - return new TimetableRepositoryForTest(StopModel.of()); + return new TimetableRepositoryForTest(SiteRepository.of()); } public static FeedScopedId id(String id) { @@ -137,15 +137,15 @@ public static TripBuilder trip(String feedId, String tripId) { return Trip.of(FeedScopedId.ofNullable(feedId, tripId)).withRoute(route("R" + tripId).build()); } - public StopModelBuilder stopModelBuilder() { - return stopModelBuilder; + public SiteRepositoryBuilder siteRepositoryBuilder() { + return siteRepositoryBuilder; } /** * Create a stop with all required fields set. */ public RegularStopBuilder stop(String idAndName) { - return stopModelBuilder + return siteRepositoryBuilder .regularStop(id(idAndName)) .withName(new NonLocalizedString(idAndName)) .withCode(idAndName) @@ -167,7 +167,7 @@ public StationBuilder station(String idAndName) { } public GroupStop groupStop(String idAndName, RegularStop... stops) { - var builder = stopModelBuilder + var builder = siteRepositoryBuilder .groupStop(id(idAndName)) .withName(new NonLocalizedString(idAndName)); @@ -177,7 +177,7 @@ public GroupStop groupStop(String idAndName, RegularStop... stops) { } public AreaStopBuilder areaStop(String idAndName) { - return stopModelBuilder + return siteRepositoryBuilder .areaStop(id(idAndName)) .withName(new NonLocalizedString(idAndName)) .withGeometry(ANY_POLYGON); diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java index 542dcaadc36..cf68a51ae5a 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/AreaStopTest.java @@ -14,7 +14,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class AreaStopTest { @@ -33,7 +33,7 @@ class AreaStopTest { private static final AreaStop subject = areaStopBuilder().withGeometry(GEOMETRY).build(); private static AreaStopBuilder areaStopBuilder() { - return StopModel + return SiteRepository .of() .areaStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java index 654ec304792..06c7a7dff1c 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.framework.i18n.I18NString; import org.opentripplanner.framework.i18n.NonLocalizedString; import org.opentripplanner.transit.model._data.TimetableRepositoryForTest; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class GroupStopTest { @@ -27,7 +27,7 @@ class GroupStopTest { private static final StopLocation STOP_LOCATION = TEST_MODEL .stop("1:stop", Coordinates.BERLIN.getX(), Coordinates.BERLIN.getY()) .build(); - private static final GroupStop subject = StopModel + private static final GroupStop subject = SiteRepository .of() .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) @@ -43,7 +43,7 @@ void testGroupStopGeometry() { .stop("2:stop", Coordinates.HAMBURG.getX(), Coordinates.HAMBURG.getY()) .build(); - GroupStop groupStop = StopModel + GroupStop groupStop = SiteRepository .of() .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) @@ -64,7 +64,7 @@ void testGroupStopEncompassingAreaGeometry() { .stop("1:stop", Coordinates.BERLIN.getX(), Coordinates.BERLIN.getY()) .build(); - GroupStop groupStop = StopModel + GroupStop groupStop = SiteRepository .of() .groupStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) diff --git a/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java index 028a8b0b218..c2c50b24c9e 100644 --- a/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java +++ b/application/src/test/java/org/opentripplanner/transit/model/site/RegularStopTest.java @@ -15,7 +15,7 @@ import org.opentripplanner.transit.model.basic.Accessibility; import org.opentripplanner.transit.model.basic.SubMode; import org.opentripplanner.transit.model.basic.TransitMode; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; class RegularStopTest { @@ -35,7 +35,7 @@ class RegularStopTest { public static final ZoneId TIME_ZONE = ZoneId.of(TimetableRepositoryForTest.TIME_ZONE_ID); private static final String PLATFORM_CODE = "platformCode"; - private static final RegularStop subject = StopModel + private static final RegularStop subject = SiteRepository .of() .regularStop(TimetableRepositoryForTest.id(ID)) .withName(NAME) diff --git a/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java index ec95c91a3f7..1c0d2a03a0f 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java @@ -52,14 +52,14 @@ class DefaultTransitServiceTest { @BeforeAll static void setup() { - var stopModel = TEST_MODEL - .stopModelBuilder() + var siteRepository = TEST_MODEL + .siteRepositoryBuilder() .withRegularStop(STOP_A) .withRegularStop(STOP_B) .withStation(STATION) .build(); - var timetableRepository = new TimetableRepository(stopModel, new Deduplicator()); + var timetableRepository = new TimetableRepository(siteRepository, new Deduplicator()); timetableRepository.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN); timetableRepository.index(); diff --git a/application/src/test/java/org/opentripplanner/transit/service/StopModelMock.java b/application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryMock.java similarity index 76% rename from application/src/test/java/org/opentripplanner/transit/service/StopModelMock.java rename to application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryMock.java index 8677f7b9dec..34884664b6d 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/StopModelMock.java +++ b/application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryMock.java @@ -3,11 +3,11 @@ import java.util.List; import org.opentripplanner.transit.model.site.StopLocation; -public class StopModelMock extends StopModel { +public class SiteRepositoryMock extends SiteRepository { private final List stops; - public StopModelMock(List stops) { + public SiteRepositoryMock(List stops) { this.stops = stops; } diff --git a/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java b/application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryTest.java similarity index 86% rename from application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java rename to application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryTest.java index aa98a85b0a7..8e7b4e6f78f 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/StopModelTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/SiteRepositoryTest.java @@ -20,7 +20,7 @@ import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -class StopModelTest { +class SiteRepositoryTest { private static final WgsCoordinate COOR_A = new WgsCoordinate(60.0, 11.0); private static final WgsCoordinate COOR_B = new WgsCoordinate(62.0, 12.0); @@ -36,20 +36,20 @@ class StopModelTest { .build(); private static final String EXP_STATIONS = List.of(STATION).toString(); - private final StopModelBuilder stopModelBuilder = StopModel.of(); - private final RegularStop stop = stopModelBuilder + private final SiteRepositoryBuilder siteRepositoryBuilder = SiteRepository.of(); + private final RegularStop stop = siteRepositoryBuilder .regularStop(ID) .withCoordinate(COOR_A) .withName(NAME) .withParentStation(STATION) .build(); private final String expStops = List.of(stop).toString(); - private final AreaStop STOP_AREA = stopModelBuilder + private final AreaStop STOP_AREA = siteRepositoryBuilder .areaStop(ID) .withName(NAME) .withGeometry(GEOMETRY) .build(); - private final GroupStop stopGroup = stopModelBuilder.groupStop(ID).addLocation(stop).build(); + private final GroupStop stopGroup = siteRepositoryBuilder.groupStop(ID).addLocation(stop).build(); private final MultiModalStation mmStation = MultiModalStation .of(ID) .withName(NAME) @@ -67,7 +67,7 @@ class StopModelTest { @Test void testStop() { - var m = stopModelBuilder.withRegularStop(stop).build(); + var m = siteRepositoryBuilder.withRegularStop(stop).build(); assertEquals(stop, m.getRegularStop(ID)); assertEquals(stop, m.getStopLocation(ID)); assertEquals(expStops, m.listRegularStops().toString()); @@ -79,7 +79,7 @@ void testStop() { @Test void testAreaStop() { - var m = stopModelBuilder.withAreaStop(STOP_AREA).build(); + var m = siteRepositoryBuilder.withAreaStop(STOP_AREA).build(); assertEquals(STOP_AREA, m.getAreaStop(ID)); assertEquals(STOP_AREA, m.getStopLocation(ID)); assertEquals("[AreaStop{F:A Name}]", m.listAreaStops().toString()); @@ -91,7 +91,7 @@ void testAreaStop() { @Test void testStopGroup() { - var m = stopModelBuilder.withGroupStop(stopGroup).build(); + var m = siteRepositoryBuilder.withGroupStop(stopGroup).build(); assertEquals("[GroupStop{F:A}]", m.listGroupStops().toString()); assertEquals("[GroupStop{F:A}]", m.listStopLocations().toString()); assertEquals(stopGroup, m.stopByIndex(stopGroup.getIndex())); @@ -101,7 +101,7 @@ void testStopGroup() { @Test void testStations() { - var m = stopModelBuilder.withStation(STATION).build(); + var m = siteRepositoryBuilder.withStation(STATION).build(); assertEquals(STATION, m.getStationById(ID)); assertEquals(EXP_STATIONS, m.listStations().toString()); assertEquals(STATION, m.getStopLocationsGroup(ID)); @@ -113,7 +113,7 @@ void testStations() { @Test void testMultiModalStation() { - var m = stopModelBuilder.withMultiModalStation(mmStation).build(); + var m = siteRepositoryBuilder.withMultiModalStation(mmStation).build(); assertEquals(mmStation, m.getMultiModalStation(ID)); assertEquals(mmStation, m.getMultiModalStationForStation(STATION)); assertEquals(expMmStations, m.listMultiModalStations().toString()); @@ -126,7 +126,7 @@ void testMultiModalStation() { @Test void testGroupOfStations() { - var m = stopModelBuilder.withGroupOfStation(groupOfStations).build(); + var m = siteRepositoryBuilder.withGroupOfStation(groupOfStations).build(); assertEquals(expGroupOfStation, m.listGroupOfStations().toString()); assertEquals(groupOfStations, m.getStopLocationsGroup(ID)); assertEquals(expStops, m.findStopOrChildStops(ID).toString()); @@ -137,7 +137,7 @@ void testGroupOfStations() { @Test void testNullStopLocationId() { - var m = StopModel.of().build(); + var m = SiteRepository.of().build(); assertNull(m.getStopLocation(null)); } } diff --git a/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java index 04740f655e3..94af8e20a95 100644 --- a/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java +++ b/application/src/test/java/org/opentripplanner/transit/service/TimetableRepositoryTest.java @@ -28,9 +28,9 @@ class TimetableRepositoryTest { void validateTimeZones() { // First GTFS bundle should be added successfully var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); ConstantsForTests.addGtfsToGraph( graph, timetableRepository, @@ -70,9 +70,9 @@ void validateTimeZones() { @Test void validateTimeZonesWithExplicitTimeZone() { var deduplicator = new Deduplicator(); - var stopModel = new StopModel(); + var siteRepository = new SiteRepository(); var graph = new Graph(deduplicator); - var timetableRepository = new TimetableRepository(stopModel, deduplicator); + var timetableRepository = new TimetableRepository(siteRepository, deduplicator); // Whit explicit time zone timetableRepository.initTimeZone(ZoneIds.CHICAGO); diff --git a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java index 38fb11712b8..9e66b5b2ebc 100644 --- a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java +++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java @@ -274,7 +274,7 @@ private static LoadModel loadGraph(File baseDir, URI path) { TimetableRepository timetableRepository = serializedGraphObject.timetableRepository; timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); return new LoadModel(graph, timetableRepository, serializedGraphObject.buildConfig); } diff --git a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java index d5d8c9e8a74..0c01e847148 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/AddedTripBuilderTest.java @@ -33,7 +33,7 @@ import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripOnServiceDate; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.transit.service.TransitEditorService; import org.opentripplanner.updater.siri.mapper.SiriTransportModeMapper; @@ -68,8 +68,8 @@ class AddedTripBuilderTest { private static final RegularStop STOP_B = MODEL_TEST.stop("B").build(); private static final RegularStop STOP_C = MODEL_TEST.stop("C").build(); private static final RegularStop STOP_D = MODEL_TEST.stop("D").build(); - private final StopModel STOP_MODEL = MODEL_TEST - .stopModelBuilder() + private final SiteRepository SITE_REPOSITORY = MODEL_TEST + .siteRepositoryBuilder() .withRegularStop(STOP_A) .withRegularStop(STOP_B) .withRegularStop(STOP_C) @@ -78,7 +78,7 @@ class AddedTripBuilderTest { private final Deduplicator DEDUPLICATOR = new Deduplicator(); private final TimetableRepository TRANSIT_MODEL = new TimetableRepository( - STOP_MODEL, + SITE_REPOSITORY, DEDUPLICATOR ); private TransitEditorService transitService; diff --git a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java index 17fee84cc56..ad3ed749fb9 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/ModifiedTripBuilderTest.java @@ -31,7 +31,7 @@ import org.opentripplanner.transit.model.timetable.TripTimes; import org.opentripplanner.transit.model.timetable.TripTimesFactory; import org.opentripplanner.transit.service.DefaultTransitService; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import org.opentripplanner.transit.service.TimetableRepository; import org.opentripplanner.updater.spi.UpdateError; import uk.org.siri.siri20.DepartureBoardingActivityEnumeration; @@ -119,8 +119,8 @@ class ModifiedTripBuilderTest { ); private static final LocalDate SERVICE_DATE = LocalDate.of(2023, 2, 17); - private final StopModel stopModel = TEST_MODEL - .stopModelBuilder() + private final SiteRepository siteRepository = TEST_MODEL + .siteRepositoryBuilder() .withRegularStop(STOP_A_1) .withRegularStop(STOP_A_2) .withRegularStop(STOP_B_1) @@ -128,7 +128,7 @@ class ModifiedTripBuilderTest { .withRegularStop(STOP_D) .build(); private final TimetableRepository timetableRepository = new TimetableRepository( - stopModel, + siteRepository, DEDUPLICATOR ); private EntityResolver entityResolver; diff --git a/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java b/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java index c89ef594fdc..daa8b2382bb 100644 --- a/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java +++ b/application/src/test/java/org/opentripplanner/updater/siri/TimetableHelperTest.java @@ -22,7 +22,7 @@ import org.opentripplanner.transit.model.timetable.RealTimeTripTimes; import org.opentripplanner.transit.model.timetable.Trip; import org.opentripplanner.transit.model.timetable.TripTimesFactory; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; import uk.org.siri.siri20.OccupancyEnumeration; public class TimetableHelperTest { @@ -57,7 +57,7 @@ public void setUp() { .build(); var stopTime = new StopTime(); - RegularStop stop = StopModel + RegularStop stop = SiteRepository .of() .regularStop(SCOPED_STOP_ID) .withCoordinate(0.0, 0.0) diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java index 489dfef8956..87a9da83911 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestConstants.java @@ -10,7 +10,7 @@ import org.opentripplanner.transit.model.organization.Operator; import org.opentripplanner.transit.model.site.RegularStop; import org.opentripplanner.transit.model.site.Station; -import org.opentripplanner.transit.service.StopModel; +import org.opentripplanner.transit.service.SiteRepository; public interface RealtimeTestConstants { LocalDate SERVICE_DATE = LocalDate.of(2024, 5, 8); @@ -35,8 +35,8 @@ public interface RealtimeTestConstants { RegularStop STOP_B2 = TEST_MODEL.stop("B2").withParentStation(STATION_B).build(); RegularStop STOP_C1 = TEST_MODEL.stop(STOP_C1_ID).withParentStation(STATION_C).build(); RegularStop STOP_D1 = TEST_MODEL.stop("D1").withParentStation(STATION_D).build(); - StopModel STOP_MODEL = TEST_MODEL - .stopModelBuilder() + SiteRepository SITE_REPOSITORY = TEST_MODEL + .siteRepositoryBuilder() .withRegularStop(STOP_A1) .withRegularStop(STOP_B1) .withRegularStop(STOP_B2) diff --git a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java index 99be7a86a43..eb31a555e1d 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/RealtimeTestEnvironmentBuilder.java @@ -23,7 +23,7 @@ public class RealtimeTestEnvironmentBuilder implements RealtimeTestConstants { private RealtimeTestEnvironment.SourceType sourceType; private final TimetableRepository timetableRepository = new TimetableRepository( - STOP_MODEL, + SITE_REPOSITORY, new Deduplicator() ); diff --git a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java index 77b54c0e962..3a3d7d5e130 100644 --- a/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java +++ b/application/src/test/java/org/opentripplanner/updater/trip/moduletests/addition/AddedTest.java @@ -132,7 +132,7 @@ private TripPattern assertAddedTrip(String tripId, RealtimeTestEnvironment env) assertNotNull(trip); assertNotNull(transitService.getPatternForTrip(trip)); - var stopA = env.timetableRepository.getStopModel().getRegularStop(STOP_A1.getId()); + var stopA = env.timetableRepository.getSiteRepository().getRegularStop(STOP_A1.getId()); // Get the trip pattern of the added trip which goes through stopA var patternsAtA = env.getTimetableSnapshot().getPatternsForStop(stopA); diff --git a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java index f83680f8aff..44a37943d8b 100644 --- a/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java +++ b/application/src/test/java/org/opentripplanner/updater/vehicle_parking/VehicleParkingUpdaterTest.java @@ -49,7 +49,7 @@ public void setup() { when(dataSource.update()).thenReturn(true); timetableRepository.index(); - graph.index(timetableRepository.getStopModel()); + graph.index(timetableRepository.getSiteRepository()); var parameters = new VehicleParkingUpdaterParameters() { @Override