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());
}
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));
}
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));
}
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);
}
Aggregations