use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class PatternDwell method traverse.
public State traverse(State state0) {
// int trip = state0.getTrip();
TripTimes tripTimes = state0.getTripTimes();
int dwellTime = tripTimes.getDwellTime(stopIndex);
StateEditor s1 = state0.edit(this);
s1.setBackMode(getMode());
s1.incrementTimeInSeconds(dwellTime);
s1.incrementWeight(dwellTime);
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class PatternDwell method optimisticTraverse.
@Override
public State optimisticTraverse(State s0) {
int dwellTime = getPattern().scheduledTimetable.getBestDwellTime(stopIndex);
StateEditor s1 = s0.edit(this);
s1.incrementTimeInSeconds(dwellTime);
s1.setBackMode(getMode());
s1.incrementWeight(dwellTime);
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class PatternHop method optimisticTraverse.
public State optimisticTraverse(State state0) {
RoutingRequest options = state0.getOptions();
// Ignore this edge if either of its stop is banned hard
if (!options.bannedStopsHard.isEmpty()) {
if (options.bannedStopsHard.matches(((PatternStopVertex) fromv).getStop()) || options.bannedStopsHard.matches(((PatternStopVertex) tov).getStop())) {
return null;
}
}
int runningTime = getPattern().scheduledTimetable.getBestRunningTime(stopIndex);
StateEditor s1 = state0.edit(this);
s1.incrementTimeInSeconds(runningTime);
s1.setBackMode(getMode());
s1.incrementWeight(runningTime);
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class PatternHop method traverse.
public State traverse(State s0) {
RoutingRequest options = s0.getOptions();
// Ignore this edge if either of its stop is banned hard
if (!options.bannedStopsHard.isEmpty()) {
if (options.bannedStopsHard.matches(((PatternStopVertex) fromv).getStop()) || options.bannedStopsHard.matches(((PatternStopVertex) tov).getStop())) {
return null;
}
}
TripTimes tripTimes = s0.getTripTimes();
int runningTime = tripTimes.getRunningTime(stopIndex);
StateEditor s1 = s0.edit(this);
s1.incrementTimeInSeconds(runningTime);
if (s0.getOptions().arriveBy)
s1.setZone(getBeginStop().getZoneId());
else
s1.setZone(getEndStop().getZoneId());
// s1.setRoute(pattern.getExemplar().route.getId());
s1.incrementWeight(runningTime);
s1.setBackMode(getMode());
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class ElevatorBoardEdge method traverse.
@Override
public State traverse(State s0) {
RoutingRequest options = s0.getOptions();
StateEditor s1 = s0.edit(this);
// We always walk in elevators, even when we have a bike with us
s1.setBackMode(TraverseMode.WALK);
s1.incrementWeight(options.elevatorBoardCost);
s1.incrementTimeInSeconds(options.elevatorBoardTime);
return s1.makeState();
}
Aggregations