@Override public <T extends ConnectionData> boolean hasConnection( Connection<T> connection) { return delegate.hasConnection(connection); }
@Override public boolean hasConnection(Point from, Point to) { return delegate.hasConnection(from, to); }
@Override public <T extends ConnectionData> boolean hasConnection( Connection<T> connection) { return delegate.hasConnection(connection); }
@Override public boolean hasConnection(Point from, Point to) { return delegate.hasConnection(from, to); }
void checkConnectionsExists(Point from, Point to) { checkArgument(graph.hasConnection(from, to), "There is no connection between %s and %s.", from, to); }
@Nullable MultiAttributeData getData(Graph<?> graph, Point from, Point to) { if (graph.hasConnection(from, to)) { final Connection<?> conn = graph.getConnection(from, to); safeToCast = lastGraph == graph && safeToCast; lastGraph = graph; if (conn.data().isPresent() && (safeToCast || conn.data().get() instanceof MultiAttributeData)) { safeToCast = true; return (MultiAttributeData) conn.data().get(); } } return null; }
@Nullable MultiAttributeData getData(Graph<?> graph, Point from, Point to) { if (graph.hasConnection(from, to)) { final Connection<?> conn = graph.getConnection(from, to); safeToCast = lastGraph == graph && safeToCast; lastGraph = graph; if (conn.data().isPresent() && (safeToCast || conn.data().get() instanceof MultiAttributeData)) { safeToCast = true; return (MultiAttributeData) conn.data().get(); } } return null; }
} else { checkArgument( graph.hasConnection(from, to), "The specified points (%s and %s) must be part of an existing " + "connection in the graph.",
private void checkAssertions(Point A, Point B, Point C, Point D) { // contain nodes assertTrue("contains A", graph.containsNode(A)); assertTrue("contains B", graph.containsNode(B)); assertTrue("contains C", graph.containsNode(C)); assertTrue("contains D", graph.containsNode(D)); assertTrue("connection A->B", graph.hasConnection(A, B)); assertTrue("connection B->C", graph.hasConnection(B, C)); assertTrue("connection B->D", graph.hasConnection(B, D)); assertFalse("!connection B->A", graph.hasConnection(B, A)); assertFalse("!connection C->B", graph.hasConnection(A, C)); assertFalse("!connection D->B", graph.hasConnection(A, D)); assertFalse("!connection A->C", graph.hasConnection(A, C)); assertFalse("!connection A->D", graph.hasConnection(A, D)); }
&& !graph.hasConnection(objLoc, nextHop)) { final Connection<?> nextConn = registry().getConnection(nextHop); checkArgument( graph.hasConnection(objLoc, nextConn.to()), "Illegal path, first point is on an connection not connected to " + "object location. ");
@Override protected void checkMoveValidity(Point objLoc, Point nextHop) { super.checkMoveValidity(objLoc, nextHop); // check if there is a vehicle driving in the opposite direction if (!objLoc.equals(nextHop)) { final Connection<?> conn = getConnection(objLoc, nextHop); if (graph.hasConnection(conn.to(), conn.from()) && registry() .hasObjectOn(Connection.create(conn.to(), conn.from()))) { throw new DeadlockException(conn); } } }
assertTrue(graph.hasConnection(n0, n1)); assertTrue(graph.hasConnection(n0, n19663)); assertTrue(graph.hasConnection(n0, n16767)); assertTrue(graph.hasConnection(n1, n0)); assertTrue(graph.hasConnection(n1, n2)); assertTrue(graph.hasConnection(n2, n1)); assertTrue(graph.hasConnection(n2, n3)); assertTrue(graph.hasConnection(n3, n2));
@Override public void handleEvent(Event e) { GraphEvent ge = (GraphEvent) e; if (e.getEventType() == ADD_CONNECTION) { assertTrue(ge.getGraph().hasConnection(ge.getConnection())); assertEquals( ge.getConnection(), ge.getGraph().getConnection(ge.getConnection().from(), ge.getConnection().to())); } else if (e.getEventType() == REMOVE_CONNECTION) { assertFalse(ge.getGraph().hasConnection(ge.getConnection().from(), ge.getConnection().to())); } else if (e.getEventType() == CHANGE_CONNECTION_DATA) { assertTrue(ge.getGraph().hasConnection(ge.getConnection().from(), ge.getConnection().to())); assertEquals( ge.getConnection().data(), ge.getGraph() .getConnection(ge.getConnection().from(), ge.getConnection().to()) .data()); } } }
if (!graph.hasConnection(e.to(), e.from()) && drawOneWayStreetArrows) { if (PointUtil.length(e) > SHORT_CONNECTION_LENGTH * vehicleLength) { final Point start1 = PointUtil.on(e, vehicleLength);