Search in sources :

Example 16 with StopTime

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;
}
Also used : StopTime(org.opentripplanner.model.StopTime)

Example 17 with StopTime

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"));
}
Also used : DataImportIssueStore(org.opentripplanner.graph_builder.DataImportIssueStore) StopTime(org.opentripplanner.model.StopTime) Test(org.junit.Test)

Example 18 with StopTime

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"));
}
Also used : Trip(org.opentripplanner.model.Trip) StopTime(org.opentripplanner.model.StopTime) Test(org.junit.Test)

Example 19 with StopTime

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;
}
Also used : StopTime(org.opentripplanner.model.StopTime)

Example 20 with StopTime

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());
}
Also used : ProgressTracker(org.opentripplanner.util.ProgressTracker) ArrayList(java.util.ArrayList) UnscheduledTrip(org.opentripplanner.ext.flex.trip.UnscheduledTrip) TripStopTimes(org.opentripplanner.model.TripStopTimes) ScheduledDeviatedTrip(org.opentripplanner.ext.flex.trip.ScheduledDeviatedTrip) StopTime(org.opentripplanner.model.StopTime)

Aggregations

StopTime (org.opentripplanner.model.StopTime)41 Trip (org.opentripplanner.model.Trip)15 ArrayList (java.util.ArrayList)11 TripTimes (org.opentripplanner.routing.trippattern.TripTimes)10 FeedScopedId (org.opentripplanner.model.FeedScopedId)8 Test (org.junit.Test)7 TripPattern (org.opentripplanner.model.TripPattern)7 StopLocation (org.opentripplanner.model.StopLocation)6 StopPattern (org.opentripplanner.model.StopPattern)6 Stop (org.opentripplanner.model.Stop)5 Route (org.opentripplanner.model.Route)4 MultilingualString (org.rutebanken.netex.model.MultilingualString)4 StopPointInJourneyPattern (org.rutebanken.netex.model.StopPointInJourneyPattern)4 TimetabledPassingTime (org.rutebanken.netex.model.TimetabledPassingTime)4 ZonedDateTime (java.time.ZonedDateTime)3 HashSet (java.util.HashSet)3 List (java.util.List)3 DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)3 VersionOfObjectRefStructure (org.rutebanken.netex.model.VersionOfObjectRefStructure)3 EstimatedCall (uk.org.siri.siri20.EstimatedCall)3