use of org.opentripplanner.model.StopTime in project OpenTripPlanner by opentripplanner.
the class NoticeAssignmentMapperTest method createStopTime.
private StopTime createStopTime(int stopSequence, Trip trip) {
StopTime stopTime1 = new StopTime();
stopTime1.setStopSequence(stopSequence);
stopTime1.setTrip(trip);
return stopTime1;
}
use of org.opentripplanner.model.StopTime in project OpenTripPlanner by opentripplanner.
the class StopTimesMapperTest method testMapStopTimes.
@Test
public void testMapStopTimes() {
NetexTestDataSample sample = new NetexTestDataSample();
StopTimesMapper stopTimesMapper = new StopTimesMapper(new DataImportIssueStore(false), MappingSupport.ID_FACTORY, sample.getStopsById(), new EntityById<>(), new EntityById<>(), sample.getDestinationDisplayById(), sample.getQuayIdByStopPointRef(), new HierarchicalMap<>(), new HierarchicalMapById<>(), new HierarchicalMap<>());
StopTimesMapperResult result = stopTimesMapper.mapToStopTimes(sample.getJourneyPattern(), TRIP, sample.getTimetabledPassingTimes(), null);
List<StopTime> stopTimes = result.stopTimes;
assertEquals(4, stopTimes.size());
assertStop(stopTimes.get(0), "NSR:Quay:1", 18000, "Bergen", List.of("Stavanger"));
assertStop(stopTimes.get(1), "NSR:Quay:2", 18240, "Bergen", null);
assertStop(stopTimes.get(2), "NSR:Quay:3", 18600, "Stavanger", List.of("Bergen"));
assertStop(stopTimes.get(3), "NSR:Quay:4", 18900, "Stavanger", null);
Map<String, StopTime> map = result.stopTimeByNetexId;
assertEquals(stopTimes.get(0), map.get("TTPT-1"));
assertEquals(stopTimes.get(1), map.get("TTPT-2"));
assertEquals(stopTimes.get(2), map.get("TTPT-3"));
assertEquals(stopTimes.get(3), map.get("TTPT-4"));
}
use of org.opentripplanner.model.StopTime in project OpenTripPlanner by opentripplanner.
the class StopTimesMapperTest method testMapStopTimes.
@Test
public void testMapStopTimes() {
NetexTestDataSample sample = new NetexTestDataSample();
StopTimesMapper stopTimesMapper = new StopTimesMapper(MappingSupport.ID_FACTORY, sample.getStopsById(), sample.getDestinationDisplayById(), sample.getQuayIdByStopPointRef());
StopTimesMapper.MappedStopTimes result = stopTimesMapper.mapToStopTimes(sample.getJourneyPattern(), new Trip(), sample.getTimetabledPassingTimes());
List<StopTime> stopTimes = result.stopTimes;
assertEquals(4, stopTimes.size());
assertStop(stopTimes.get(0), "NSR:Quay:1", 18000, "Bergen");
assertStop(stopTimes.get(1), "NSR:Quay:2", 18240, "Bergen");
assertStop(stopTimes.get(2), "NSR:Quay:3", 18600, "Stavanger");
assertStop(stopTimes.get(3), "NSR:Quay:4", 18900, "Stavanger");
Map<String, StopTime> map = result.stopTimeByNetexId;
assertEquals(stopTimes.get(0), map.get("TTPT-1"));
assertEquals(stopTimes.get(1), map.get("TTPT-2"));
assertEquals(stopTimes.get(2), map.get("TTPT-3"));
assertEquals(stopTimes.get(3), map.get("TTPT-4"));
}
use of org.opentripplanner.model.StopTime in project OpenTripPlanner by opentripplanner.
the class NoticeAssignmentMapperTest method createStopTime.
private StopTime createStopTime(int stopSequence, Trip trip) {
StopTime stopTime1 = new StopTime();
stopTime1.setStopSequence(stopSequence);
stopTime1.setTrip(trip);
return stopTime1;
}
use of org.opentripplanner.model.StopTime in project OpenTripPlanner by opentripplanner.
the class FlexTripsMapper method createFlexTrips.
public static void createFlexTrips(OtpTransitServiceBuilder builder) {
TripStopTimes stopTimesByTrip = builder.getStopTimesSortedByTrip();
final int tripSize = stopTimesByTrip.size();
ProgressTracker progress = ProgressTracker.track("Create flex trips", 500, tripSize);
for (org.opentripplanner.model.Trip trip : stopTimesByTrip.keys()) {
/* Fetch the stop times for this trip. Copy the list since it's immutable. */
List<StopTime> stopTimes = new ArrayList<>(stopTimesByTrip.get(trip));
if (UnscheduledTrip.isUnscheduledTrip(stopTimes)) {
if (stopTimes.size() == 2) {
// TODO: Drop this restriction after time handling and ride times are defined
builder.getFlexTripsById().add(new UnscheduledTrip(trip, stopTimes));
}
} else if (ScheduledDeviatedTrip.isScheduledFlexTrip(stopTimes)) {
builder.getFlexTripsById().add(new ScheduledDeviatedTrip(trip, stopTimes));
} else if (hasContinuousStops(stopTimes)) {
// builder.getFlexTripsById().add(new ContinuousPickupDropOffTrip(trip, stopTimes));
}
// Keep lambda! A method-ref would causes incorrect class and line number to be logged
progress.step(m -> LOG.info(m));
}
LOG.info(progress.completeMessage());
LOG.info("Done creating flex trips. Created a total of {} trips.", builder.getFlexTripsById().size());
}
Aggregations