Search in sources :

Example 1 with AddTripPattern

use of org.opentripplanner.analyst.scenario.AddTripPattern in project OpenTripPlanner by opentripplanner.

the class RepeatedRaptorProfileRouter method getRaptorWorkerData.

/**
 * Create RAPTOR worker data from a graph, profile request and sample set (the last of which may be null
 */
public static RaptorWorkerData getRaptorWorkerData(ProfileRequest request, Graph graph, SampleSet sampleSet, TaskStatistics ts) {
    LOG.info("Make data...");
    long startData = System.currentTimeMillis();
    // but they will not be transit stops.
    if (request.scenario != null && request.scenario.modifications != null) {
        for (AddTripPattern atp : Iterables.filter(request.scenario.modifications, AddTripPattern.class)) {
            atp.materialize(graph);
        }
    }
    // convert from joda to java - ISO day of week with monday == 1
    DayOfWeek dayOfWeek = DayOfWeek.of(request.date.getDayOfWeek());
    TimeWindow window = new TimeWindow(request.fromTime, request.toTime + RaptorWorker.MAX_DURATION, graph.index.servicesRunning(request.date), dayOfWeek);
    RaptorWorkerData raptorWorkerData;
    if (sampleSet == null)
        raptorWorkerData = new RaptorWorkerData(graph, window, request, ts);
    else
        raptorWorkerData = new RaptorWorkerData(graph, window, request, sampleSet, ts);
    ts.raptorData = (int) (System.currentTimeMillis() - startData);
    LOG.info("done");
    return raptorWorkerData;
}
Also used : DayOfWeek(java.time.DayOfWeek) AddTripPattern(org.opentripplanner.analyst.scenario.AddTripPattern)

Aggregations

DayOfWeek (java.time.DayOfWeek)1 AddTripPattern (org.opentripplanner.analyst.scenario.AddTripPattern)1