use of org.opentripplanner.model.TripStopTimes 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