Search in sources :

Example 1 with StopIndexForRaptor

use of org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor in project OpenTripPlanner by opentripplanner.

the class TransitLayerMapper method map.

private TransitLayer map(TransitTuningParameters tuningParameters) {
    StopIndexForRaptor stopIndex;
    HashMap<LocalDate, List<TripPatternForDate>> tripPatternsByStopByDate;
    List<List<Transfer>> transferByStopIndex;
    LOG.info("Mapping transitLayer from Graph...");
    stopIndex = new StopIndexForRaptor(graph.index.getAllStops(), tuningParameters);
    tripPatternsByStopByDate = mapTripPatterns(stopIndex);
    transferByStopIndex = mapTransfers(stopIndex, graph.transfersByStop);
    LOG.info("Mapping complete.");
    return new TransitLayer(tripPatternsByStopByDate, transferByStopIndex, stopIndex, graph.getTimeZone().toZoneId());
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) StopIndexForRaptor(org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor) LocalDate(java.time.LocalDate) TransitLayer(org.opentripplanner.routing.algorithm.raptor.transit.TransitLayer)

Example 2 with StopIndexForRaptor

use of org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor in project OpenTripPlanner by opentripplanner.

the class StopIndexForRaptorTest method listStopIndexesForTripPattern.

@Test
public void listStopIndexesForTripPattern() {
    Stop[] input = new Stop[] { STOP_0, STOP_2, STOP_4 };
    StopIndexForRaptor stopIndex = new StopIndexForRaptor(STOPS, TransitTuningParameters.FOR_TEST);
    int[] result = stopIndex.listStopIndexesForStops(input);
    assertEquals("[0, 2, 4]", Arrays.toString(result));
}
Also used : Stop(org.opentripplanner.model.Stop) StopIndexForRaptor(org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor) Test(org.junit.Test)

Example 3 with StopIndexForRaptor

use of org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor in project OpenTripPlanner by opentripplanner.

the class StopIndexForRaptorTest method stopBoardAlightCosts.

@Test
public void stopBoardAlightCosts() {
    STOP_1.setParentStation(createStation("A", TransferPriority.DISCOURAGED));
    STOP_2.setParentStation(createStation("B", TransferPriority.ALLOWED));
    STOP_3.setParentStation(createStation("C", TransferPriority.RECOMMENDED));
    STOP_4.setParentStation(createStation("D", TransferPriority.PREFERRED));
    StopIndexForRaptor stopIndex = new StopIndexForRaptor(STOPS, TransitTuningParameters.FOR_TEST);
    int[] result = stopIndex.stopBoardAlightCosts;
    // Expect cost with Raptor precision
    assertEquals("[6000, 360000, 6000, 2000, 0]", Arrays.toString(result));
}
Also used : StopIndexForRaptor(org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor) Test(org.junit.Test)

Example 4 with StopIndexForRaptor

use of org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor in project OpenTripPlanner by opentripplanner.

the class StopIndexForRaptorTest method listStopIndexesForEmptyTripPattern.

@Test
public void listStopIndexesForEmptyTripPattern() {
    StopIndexForRaptor stopIndex = new StopIndexForRaptor(STOPS, TransitTuningParameters.FOR_TEST);
    int[] result = stopIndex.listStopIndexesForStops(new Stop[0]);
    assertEquals(result.length, 0);
}
Also used : StopIndexForRaptor(org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor) Test(org.junit.Test)

Aggregations

StopIndexForRaptor (org.opentripplanner.routing.algorithm.raptor.transit.StopIndexForRaptor)4 Test (org.junit.Test)3 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Stop (org.opentripplanner.model.Stop)1 TransitLayer (org.opentripplanner.routing.algorithm.raptor.transit.TransitLayer)1