use of org.opentripplanner.routing.api.request.RoutingRequest in project OpenTripPlanner by opentripplanner.
the class TestHopFactory method testDwell.
public void testDwell() throws Exception {
Vertex stop_a = graph.getVertex(feedId + ":A_depart");
Vertex stop_c = graph.getVertex(feedId + ":C_arrive");
RoutingRequest options = new RoutingRequest();
options.dateTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 8, 0, 0);
options.setRoutingContext(graph, stop_a, stop_c);
ShortestPathTree spt = aStar.getShortestPathTree(options);
GraphPath path = spt.getPath(stop_c, false);
assertNotNull(path);
assertEquals(6, path.states.size());
long endTime = TestUtils.dateInSeconds("America/New_York", 2009, 8, 7, 8, 30, 0);
assertEquals(endTime, path.getEndTime());
}
use of org.opentripplanner.routing.api.request.RoutingRequest in project OpenTripPlanner by opentripplanner.
the class RoutingRequestTest method testRequest.
@Test
public void testRequest() {
RoutingRequest request = new RoutingRequest();
request.addMode(CAR);
assertTrue(request.streetSubRequestModes.getCar());
request.removeMode(CAR);
assertFalse(request.streetSubRequestModes.getCar());
request.setStreetSubRequestModes(new TraverseModeSet(TraverseMode.BICYCLE, TraverseMode.WALK));
assertFalse(request.streetSubRequestModes.getCar());
assertTrue(request.streetSubRequestModes.getBicycle());
assertTrue(request.streetSubRequestModes.getWalk());
}
use of org.opentripplanner.routing.api.request.RoutingRequest in project OpenTripPlanner by opentripplanner.
the class RoutingRequestTest method testIntermediatePlaces.
@Test
public void testIntermediatePlaces() {
RoutingRequest req = new RoutingRequest();
assertFalse(req.hasIntermediatePlaces());
req.clearIntermediatePlaces();
assertFalse(req.hasIntermediatePlaces());
req.addIntermediatePlace(randomLocation());
assertTrue(req.hasIntermediatePlaces());
req.clearIntermediatePlaces();
assertFalse(req.hasIntermediatePlaces());
req.addIntermediatePlace(randomLocation());
req.addIntermediatePlace(randomLocation());
assertTrue(req.hasIntermediatePlaces());
}
use of org.opentripplanner.routing.api.request.RoutingRequest in project OpenTripPlanner by opentripplanner.
the class StateEditorTest method testIncrementTimeInSeconds.
@Test
public final void testIncrementTimeInSeconds() {
RoutingRequest routingRequest = new RoutingRequest();
StateEditor stateEditor = new StateEditor(routingRequest, null);
stateEditor.setTimeSeconds(0);
stateEditor.incrementTimeInSeconds(999999999);
assertEquals(999999999, stateEditor.child.getTimeSeconds());
}
use of org.opentripplanner.routing.api.request.RoutingRequest in project OpenTripPlanner by opentripplanner.
the class StateEditorTest method testSetNonTransitOptionsFromState.
/**
* Test update of non transit options.
*/
@Test
public final void testSetNonTransitOptionsFromState() {
RoutingRequest request = new RoutingRequest();
request.setMode(TraverseMode.CAR);
request.parkAndRide = true;
Graph graph = new Graph();
graph.index = new GraphIndex(graph);
graph.streetIndex = new StreetVertexIndex(graph);
request.rctx = new RoutingContext(request, graph);
State state = new State(request);
state.stateData.carParked = true;
state.stateData.bikeParked = true;
state.stateData.usingRentedBike = false;
state.stateData.nonTransitMode = TraverseMode.WALK;
StateEditor se = new StateEditor(request, null);
se.setNonTransitOptionsFromState(state);
State updatedState = se.makeState();
assertEquals(TraverseMode.WALK, updatedState.getNonTransitMode());
assertEquals(true, updatedState.isCarParked());
assertEquals(true, updatedState.isBikeParked());
assertEquals(false, updatedState.isBikeRenting());
}
Aggregations