Skip to content

Commit

Permalink
Rename transitModel to timetableRepository.
Browse files Browse the repository at this point in the history
  • Loading branch information
VillePihlava committed Oct 17, 2024
1 parent 232eaec commit 9958ffc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public void linkTransitStops(Graph graph, TimetableRepository timetableRepositor

Set<StopLocation> stopLocationsUsedForFlexTrips = Set.of();
if (OTPFeature.FlexRouting.isOn()) {
stopLocationsUsedForFlexTrips = getStopLocationsUsedForFlexTrips(transitModel);
stopLocationsUsedForFlexTrips = getStopLocationsUsedForFlexTrips(timetableRepository);
}

Set<StopLocation> stopLocationsUsedForCarsAllowedTrips = transitModel.getStopLocationsUsedForCarsAllowedTrips();
Set<StopLocation> stopLocationsUsedForCarsAllowedTrips = timetableRepository.getStopLocationsUsedForCarsAllowedTrips();

for (TransitStopVertex tStop : vertices) {
// Stops with pathways do not need to be connected to the street network, since there are explicit entrances defined for that
Expand Down Expand Up @@ -357,8 +357,10 @@ private VehicleParking removeVehicleParkingEntranceVertexFromGraph(
}
}

private Set<StopLocation> getStopLocationsUsedForFlexTrips(TransitModel transitModel) {
Set<StopLocation> stopLocations = transitModel
private Set<StopLocation> getStopLocationsUsedForFlexTrips(
TimetableRepository timetableRepository
) {
Set<StopLocation> stopLocations = timetableRepository
.getAllFlexTrips()
.stream()
.flatMap(t -> t.getStops().stream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void linkFlexStop() {
@Test
void linkCarsAllowedStop() {
var model = new TestModel();
var carsAllowedTrip = TransitModelForTest
var carsAllowedTrip = TimetableRepositoryForTest
.of()
.trip("carsAllowedTrip")
.withCarsAllowed(CarAccess.ALLOWED)
Expand Down Expand Up @@ -198,7 +198,7 @@ public void withFlexTrip(UnscheduledTrip flexTrip) {
}

public void withCarsAllowedTrip(Trip trip, StopLocation... stops) {
Route route = TransitModelForTest.route("carsAllowedRoute").build();
Route route = TimetableRepositoryForTest.route("carsAllowedRoute").build();
var stopTimes = Arrays
.stream(stops)
.map(s -> {
Expand All @@ -214,15 +214,15 @@ public void withCarsAllowedTrip(Trip trip, StopLocation... stops) {
RealTimeTripTimes tripTimes = TripTimesFactory.tripTimes(
trip,
stopTimes,
transitModel.getDeduplicator()
timetableRepository.getDeduplicator()
);
TripPattern tripPattern = TransitModelForTest
TripPattern tripPattern = TimetableRepositoryForTest
.tripPattern("carsAllowedTripPattern", route)
.withStopPattern(stopPattern)
.withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes))
.build();

transitModel.addTripPattern(tripPattern.getId(), tripPattern);
timetableRepository.addTripPattern(tripPattern.getId(), tripPattern);
}
}
}

0 comments on commit 9958ffc

Please sign in to comment.