use of org.opentripplanner.routing.graph.Graph in project OpenTripPlanner by opentripplanner.
the class TestGraph method testGetStreetEdgesSeveral.
public void testGetStreetEdgesSeveral() {
Graph g = new Graph();
StreetVertex a = new IntersectionVertex(g, "A", 5, 5);
StreetVertex b = new IntersectionVertex(g, "B", 6, 6);
StreetVertex c = new IntersectionVertex(g, "C", 3, 2);
Set<Edge> allStreetEdges = new HashSet<Edge>(4);
allStreetEdges.add(edge(a, b, 1.0));
allStreetEdges.add(edge(b, c, 1.0));
allStreetEdges.add(edge(c, b, 1.0));
allStreetEdges.add(edge(c, a, 1.0));
Set<StreetEdge> edges = new HashSet<StreetEdge>(g.getStreetEdges());
assertEquals(4, edges.size());
assertEquals(allStreetEdges, edges);
}
use of org.opentripplanner.routing.graph.Graph in project OpenTripPlanner by opentripplanner.
the class TestGraph method testGetStreetEdgesNone.
public void testGetStreetEdgesNone() {
Graph g = new Graph();
Vertex a = new IntersectionVertex(g, "A", 5, 5);
Vertex b = new IntersectionVertex(g, "B", 6, 6);
Vertex c = new IntersectionVertex(g, "C", 3, 2);
Set<Edge> allEdges = new HashSet<Edge>(4);
allEdges.add(new FreeEdge(a, b));
allEdges.add(new FreeEdge(b, c));
allEdges.add(new FreeEdge(c, b));
allEdges.add(new FreeEdge(c, a));
Set<StreetEdge> edges = new HashSet<StreetEdge>(g.getStreetEdges());
assertEquals(0, edges.size());
}
use of org.opentripplanner.routing.graph.Graph in project OpenTripPlanner by opentripplanner.
the class TestGraph method testBasic.
public void testBasic() throws Exception {
Graph g = new Graph();
assertNotNull(g);
}
use of org.opentripplanner.routing.graph.Graph in project OpenTripPlanner by opentripplanner.
the class SimpleStreetSplitterTest method buildSpy.
@Before
public void buildSpy() {
Graph graph = new Graph();
SimpleStreetSplitter simpleStreetSplitter = new SimpleStreetSplitter(graph, null, null, false);
spySimpleStreetSplitter = spy(simpleStreetSplitter);
}
use of org.opentripplanner.routing.graph.Graph in project OpenTripPlanner by opentripplanner.
the class GtfsGraphBuilderModuleTest method testBikesByDefault.
@Test
public void testBikesByDefault() throws IOException {
// We configure two trip: one with unknown bikes_allowed and the second with no bikes
// allowed.
MockGtfs gtfs = getSimpleGtfs();
gtfs.putTrips(2, "r0", "sid0", "bikes_allowed=0,2");
gtfs.putStopTimes("t0,t1", "s0,s1");
List<GtfsBundle> bundleList = getGtfsAsBundleList(gtfs);
bundleList.get(0).setDefaultBikesAllowed(true);
_builder = new GtfsModule(bundleList);
Graph graph = new Graph();
_builder.buildGraph(graph, _extra);
graph.index(new DefaultStreetVertexIndexFactory());
// Feed id is used instead of the agency id for OBA entities.
GtfsBundle gtfsBundle = bundleList.get(0);
GtfsFeedId feedId = gtfsBundle.getFeedId();
Trip trip = graph.index.tripForId.get(new AgencyAndId(feedId.getId(), "t0"));
TripPattern pattern = graph.index.patternForTrip.get(trip);
List<Trip> trips = pattern.getTrips();
assertEquals(BikeAccess.ALLOWED, BikeAccess.fromTrip(withId(trips, new AgencyAndId(feedId.getId(), "t0"))));
assertEquals(BikeAccess.NOT_ALLOWED, BikeAccess.fromTrip(withId(trips, new AgencyAndId(feedId.getId(), "t1"))));
}
Aggregations