use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class PatternInterlineDwell method optimisticTraverse.
@Override
public State optimisticTraverse(State s0) {
StateEditor s1 = s0.edit(this);
// FIXME too optimistic
s1.incrementTimeInSeconds(0);
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class SampleEdge method traverse.
@Override
public /**
* We want to use exactly the same logic here as is used in propagating to samples
*/
State traverse(State s0) {
StateEditor s1 = s0.edit(this);
s1.incrementWalkDistance(this.length);
s1.incrementTimeInMilliseconds((int) (1000 * this.length / s0.getOptions().walkSpeed));
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class SimpleTransfer method traverse.
@Override
public State traverse(State s0) {
// Forbid taking shortcuts composed of two transfers in a row
if (s0.backEdge instanceof SimpleTransfer) {
return null;
}
if (s0.backEdge instanceof StreetTransitLink) {
return null;
}
if (distance > s0.getOptions().maxTransferWalkDistance) {
return null;
}
// Only transfer right after riding a vehicle.
RoutingRequest rr = s0.getOptions();
double walkspeed = rr.walkSpeed;
StateEditor se = s0.edit(this);
se.setBackMode(TraverseMode.WALK);
int time = (int) Math.ceil(distance / walkspeed) + 2 * StreetTransitLink.STL_TRAVERSE_COST;
se.incrementTimeInSeconds(time);
se.incrementWeight(time * rr.walkReluctance);
se.incrementWalkDistance(distance);
return se.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class StationStopEdge method traverse.
@Override
public State traverse(State s0) {
if (s0.backEdge instanceof StationStopEdge) {
return null;
}
StateEditor s1 = s0.edit(this);
s1.setBackMode(TraverseMode.LEG_SWITCH);
s1.incrementWeight(1);
// Increment weight, but not time. See Javadoc on this class.
return s1.makeState();
}
use of org.opentripplanner.routing.core.StateEditor in project OpenTripPlanner by opentripplanner.
the class FreeEdge method traverse.
@Override
public State traverse(State s0) {
StateEditor s1 = s0.edit(this);
s1.incrementWeight(1);
// do not change mode, which means it may be null at the start of a trip
return s1.makeState();
}
Aggregations