public interface Network
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2016-09-23 13:40:04 +0200 (Fri, 23 Sep 2016) $, @version $Revision: 2274 $, by $Author: averbraeck $,
initial version Jul 22, 2015
| Modifier and Type | Field and Description |
|---|---|
static EventType |
GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the network.
|
static EventType |
GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the network.
|
static EventType |
LINK_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Link.
|
static EventType |
LINK_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Link.
|
static EventType |
NODE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Node.
|
static EventType |
NODE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Node.
|
static EventType |
ROUTE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.
|
static EventType |
ROUTE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLink(Link link)
Register a link in the network.
|
void |
addNode(Node node)
Register a node in the network.
|
void |
addRoute(GTUType gtuType,
Route route)
Add a route to the network.
|
void |
buildGraph(GTUType gtuType)
(Re)build the underlying graph for the given GTUType.
|
boolean |
containsLink(Link link)
Test whether a link is present in the network.
|
boolean |
containsLink(String link)
Test whether a link with a given id is present in the network.
|
boolean |
containsNode(Node node)
Test whether a node is present in the network.
|
boolean |
containsNode(String nodeId)
Test whether a node with a given id is present in the network.
|
boolean |
containsRoute(GTUType gtuType,
Route route)
Determine whether the provided route exists in the network for the given GTUType.
|
boolean |
containsRoute(GTUType gtuType,
String routeId)
Determine whether a route with the given id exists in the network for the given GTUType.
|
ImmutableMap<String,Route> |
getDefinedRouteMap(GTUType gtuType)
Return an immutable map of routes that exist in the network for the GTUType.
|
String |
getId() |
Link |
getLink(Node node1,
Node node2)
Find a link between node1 and node2 and return it if it exists in the network.
|
Link |
getLink(String linkId)
Retrieve a node with a given id from the network, or null if the id cannot be found.
|
Link |
getLink(String nodeId1,
String nodeId2)
Find a link between node1 and node2 and return it if it exists in the network.
|
ImmutableMap<String,Link> |
getLinkMap()
Provide an immutable map of link ids to links in the network.
|
Node |
getNode(String nodeId)
Retrieve a node with a given id from the network, or null if the id cannot be found.
|
ImmutableMap<String,Node> |
getNodeMap()
Provide an immutable map of node ids to nodes in the network.
|
Route |
getRoute(GTUType gtuType,
String routeId)
Return the route with the given id in the network for the given GTUType, or null if it the route with the id does not
exist.
|
Set<Route> |
getRoutesBetween(GTUType gtuType,
Node nodeFrom,
Node nodeTo)
Return the the shortest route between two nodes in the network, via a list of intermediate nodes.
|
CompleteRoute |
getShortestRouteBetween(GTUType gtuType,
Node nodeFrom,
Node nodeTo)
Calculate the shortest route between two nodes in the network.
|
CompleteRoute |
getShortestRouteBetween(GTUType gtuType,
Node nodeFrom,
Node nodeTo,
List<Node> nodesVia)
Calculate the shortest route between two nodes in the network, via a list of intermediate nodes.
|
void |
removeLink(Link link)
Unregister a link from the network.
|
void |
removeNode(Node node)
Unregister a node from the network.
|
void |
removeRoute(GTUType gtuType,
Route route)
Remove the route from the network, e.g.
|
static final EventType NODE_ADD_EVENT
static final EventType NODE_REMOVE_EVENT
static final EventType LINK_ADD_EVENT
static final EventType LINK_REMOVE_EVENT
static final EventType ROUTE_ADD_EVENT
static final EventType ROUTE_REMOVE_EVENT
static final EventType GTU_ADD_EVENT
static final EventType GTU_REMOVE_EVENT
String getId()
ImmutableMap<String,Node> getNodeMap()
void addNode(Node node) throws NetworkException
node - the node to add to the network.NetworkException - if node already exists in the network, or if name of the node is not unique.void removeNode(Node node) throws NetworkException
node - the node to remove from the network.NetworkException - if node does not exist in the network.boolean containsNode(Node node)
node - the node to search for in the network.boolean containsNode(String nodeId)
nodeId - the id of the node to search for in the network.Node getNode(String nodeId)
nodeId - the id of the node to search for in the network.ImmutableMap<String,Link> getLinkMap()
void addLink(Link link) throws NetworkException
link - the link to add to the network.NetworkException - if link already exists in the network, if name of the link is not unique, or if the start node
or the end node of the link are not registered in the network.void removeLink(Link link) throws NetworkException
link - the link to remove from the network.NetworkException - if link does not exist in the network.boolean containsLink(Link link)
link - the link to search for in the network.boolean containsLink(String link)
link - the id of the link to search for in the network.Link getLink(String linkId)
linkId - the id of the link to search for in the network.Link getLink(Node node1, Node node2)
node1 - first nodenode2 - second nodeLink getLink(String nodeId1, String nodeId2) throws NetworkException
nodeId1 - id of the first nodenodeId2 - id of the second nodeNetworkException - if the node(s) cannot be found by their idImmutableMap<String,Route> getDefinedRouteMap(GTUType gtuType)
gtuType - the GTUType for which to retrieve the defined routesvoid addRoute(GTUType gtuType, Route route) throws NetworkException
gtuType - the GTUType for which to add a routeroute - the route to add to the network.NetworkException - if route already exists in the network, if name of the route is not unique, if one of the nodes
of the route are not registered in the network.void removeRoute(GTUType gtuType, Route route) throws NetworkException
gtuType - the GTUType for which to remove a routeroute - the route to remove from the network.NetworkException - if route does not exist in the network.Route getRoute(GTUType gtuType, String routeId)
gtuType - the GTUType for which to retrieve a route based on its id.routeId - the route to search for in the network.boolean containsRoute(GTUType gtuType, Route route)
gtuType - the GTUType for which to check whether the route existsroute - the route to check forboolean containsRoute(GTUType gtuType, String routeId)
gtuType - the GTUType for which to check whether the route existsrouteId - the id of the route to check forSet<Route> getRoutesBetween(GTUType gtuType, Node nodeFrom, Node nodeTo)
gtuType - the GTUType for which to retrieve the defined routesnodeFrom - the start node.nodeTo - the end node.void buildGraph(GTUType gtuType)
gtuType - the GTUType for which to (re)build the graphCompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo) throws NetworkException
gtuType - the GTUType for which to calculate the shortest routenodeFrom - the start node.nodeTo - the end node.NetworkException - in case nodes cannot be added to the route, e.g. because they are not directly connected. This
can be the case when the links in the network have changed, but the graph has not been rebuilt.CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, List<Node> nodesVia) throws NetworkException
gtuType - the GTUType for which to calculate the shortest routenodeFrom - the start node.nodeTo - the end node.nodesVia - a number of nodes that the GTU has to pass between nodeFrom and nodeTo in the given order.NetworkException - in case nodes cannot be added to the route, e.g. because they are not directly connected. This
can be the case when the links in the network have changed, but the graph has not been rebuilt.Copyright © 2014–2016 Delft University of Technology. All rights reserved.