/** * Returns all {@link RoadUser}s that are on the specified node. * @param node A node in the graph. * @return The set of {@link RoadUser}s that are <i>exactly</i> at the * position of the node, or an empty set if there are no * {@link RoadUser}s on the node. * @throws IllegalArgumentException if the specified point is not a node in * the graph. */ @Override public ImmutableSet<RoadUser> getRoadUsersOnNode(Point node) { checkArgument(graph.containsNode(node), "The specified point (%s) is not a node in the graph.", node); return ImmutableSet.copyOf(registry().getObjectsOn(node)); }
/** * Returns all {@link RoadUser}s that are on the connection between * <code>from</code> and <code>to</code> (inclusive). * @param from The start point of a connection. * @param to The end point of a connection. * @return The {@link RoadUser}s that are on the connection, or an empty set * in case {@link #hasRoadUserOn(Point, Point)} returns * <code>false</code>. * @throws IllegalArgumentException if no connection exists between * <code>from</code> and <code>to</code>. */ @Override public ImmutableSet<RoadUser> getRoadUsersOn(Point from, Point to) { checkConnectionsExists(from, to); final Connection<?> conn = graph.getConnection(from, to); return ImmutableSet.<RoadUser>builder() .addAll(registry().getObjectsOn(conn)) .addAll(registry().getObjectsOn(from)) .addAll(registry().getObjectsOn(to)) .build(); }
/** * Checks whether there is a {@link RoadUser} on the connection between * <code>from</code> and <code>to</code> (inclusive). * @param from The start point of a connection. * @param to The end point of a connection. * @return <code>true</code> if a {@link RoadUser} occupies either * <code>from</code>, <code>to</code> or the connection between * <code>from</code> and <code>to</code>, <code>false</code> * otherwise. * @throws IllegalArgumentException if no connection exists between * <code>from</code> and <code>to</code>. */ @Override public boolean hasRoadUserOn(Point from, Point to) { checkConnectionsExists(from, to); return registry().hasObjectOn(graph.getConnection(from, to)) || registry().hasObjectOn(from) || registry().hasObjectOn(to); }
!model.registry().hasObjectOn(conn), "A connection (%s->%s) with an object (%s) on it can not be changed" + " or removed: %s.", conn.from(), conn.to(), model.registry().getObjectsOn(conn), ge.getEventType()); if (model.registry().hasObjectOn(conn.from())) { checkState( ge.getGraph().containsNode(conn.from()), UNMODIFIABLE_MSG, if (model.registry().hasObjectOn(conn.to())) { checkState( ge.getGraph().containsNode(conn.to()), UNMODIFIABLE_MSG,