Search in sources :

Example 16 with StateEditor

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();
}
Also used : StateEditor(org.opentripplanner.routing.core.StateEditor) TripTimes(org.opentripplanner.routing.trippattern.TripTimes)

Example 17 with StateEditor

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();
}
Also used : StateEditor(org.opentripplanner.routing.core.StateEditor)

Example 18 with StateEditor

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();
}
Also used : StateEditor(org.opentripplanner.routing.core.StateEditor) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest) PatternStopVertex(org.opentripplanner.routing.vertextype.PatternStopVertex)

Example 19 with StateEditor

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();
}
Also used : StateEditor(org.opentripplanner.routing.core.StateEditor) TripTimes(org.opentripplanner.routing.trippattern.TripTimes) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest) PatternStopVertex(org.opentripplanner.routing.vertextype.PatternStopVertex)

Example 20 with StateEditor

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();
}
Also used : StateEditor(org.opentripplanner.routing.core.StateEditor) RoutingRequest(org.opentripplanner.routing.core.RoutingRequest)

Aggregations

StateEditor (org.opentripplanner.routing.core.StateEditor)38 RoutingRequest (org.opentripplanner.routing.core.RoutingRequest)17 State (org.opentripplanner.routing.core.State)5 TraverseMode (org.opentripplanner.routing.core.TraverseMode)4 TripTimes (org.opentripplanner.routing.trippattern.TripTimes)4 Trip (org.onebusaway.gtfs.model.Trip)2 BikeRentalStationVertex (org.opentripplanner.routing.vertextype.BikeRentalStationVertex)2 PatternStopVertex (org.opentripplanner.routing.vertextype.PatternStopVertex)2 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)2 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)1 RoutingContext (org.opentripplanner.routing.core.RoutingContext)1 ServiceDay (org.opentripplanner.routing.core.ServiceDay)1 TransferTable (org.opentripplanner.routing.core.TransferTable)1 Edge (org.opentripplanner.routing.graph.Edge)1 BikeParkVertex (org.opentripplanner.routing.vertextype.BikeParkVertex)1