org.opentripplanner.transit.raptor.rangeraptor.standard.stoparrivals.StdStopArrivalsState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.transit.raptor.rangeraptor.standard.stoparrivals;
import java.util.Collection;
import org.opentripplanner.transit.raptor.api.path.Path;
import org.opentripplanner.transit.raptor.api.transit.RaptorTransfer;
import org.opentripplanner.transit.raptor.api.transit.RaptorTripSchedule;
import org.opentripplanner.transit.raptor.api.transit.TransitArrival;
import org.opentripplanner.transit.raptor.rangeraptor.path.DestinationArrivalPaths;
import org.opentripplanner.transit.raptor.rangeraptor.standard.StopArrivalsState;
/**
* Tracks the state necessary to construct paths at the end of each iteration.
*
* This class find the pareto optimal paths with respect to: rounds, arrival time and total travel time.
*
* @param The TripSchedule type defined by the user of the raptor API.
*/
public final class StdStopArrivalsState implements StopArrivalsState {
private final StopArrivals stops;
private final DestinationArrivalPaths results;
/**
* Create a Standard Range Raptor state for the given stops and destination arrivals.
*/
public StdStopArrivalsState(StopArrivals stops, DestinationArrivalPaths paths) {
this.stops = stops;
this.results = paths;
}
@Override
public void setAccessTime(int arrivalTime, RaptorTransfer access, boolean bestTime) {
stops.setAccessTime(arrivalTime, access, bestTime);
}
@Override
public int bestTimePreviousRound(int stop) {
return stops.bestTimePreviousRound(stop);
}
@Override
public void setNewBestTransitTime(
int stop,
int alightTime,
T trip,
int boardStop,
int boardTime,
boolean newBestOverall
) {
stops.transitToStop(stop, alightTime, boardStop, boardTime, trip, newBestOverall);
}
@Override
public void setNewBestTransferTime(
int fromStop,
int arrivalTime,
RaptorTransfer transfer
) {
stops.transferToStop(fromStop, transfer, arrivalTime);
}
@Override
public TransitArrival previousTransit(int boardStopIndex) {
return stops.previousTransit(boardStopIndex);
}
@Override
public Collection> extractPaths() {
return results.listPaths();
}
}