public interface Network extends Definitions, EventProducerInterface, Identifiable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2019-03-17 22:16:44 +0100 (Sun, 17 Mar 2019) $, @version $Revision: 5158 $, by $Author: averbraeck $,
initial version Jul 22, 2015
Modifier and Type | Field and Description |
---|---|
static EventType |
ANIMATION_GENERATOR_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an GTUGenerator implementing object.
|
static EventType |
ANIMATION_GENERATOR_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an GTUGenerator implementing object.
|
static EventType |
ANIMATION_GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the network.
|
static EventType |
ANIMATION_GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the network.
|
static EventType |
ANIMATION_INVISIBLE_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing
object.
|
static EventType |
ANIMATION_INVISIBLE_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing
object.
|
static EventType |
ANIMATION_LINK_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Link.
|
static EventType |
ANIMATION_LINK_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Link.
|
static EventType |
ANIMATION_NODE_ADD_EVENT
The timed event type for pub/sub indicating the addition of a Node.
|
static EventType |
ANIMATION_NODE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Node.
|
static EventType |
ANIMATION_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.
|
static EventType |
ANIMATION_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.
|
static EventType |
ANIMATION_ROUTE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.
|
static EventType |
ANIMATION_ROUTE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.
|
static EventType |
GENERATOR_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTUGenerator to the network.
|
static EventType |
GENERATOR_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTUGenerator from the network.
|
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 |
INVISIBLE_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing
object.
|
static EventType |
INVISIBLE_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing
object.
|
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 |
OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.
|
static EventType |
OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.
|
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.
|
FIRST_POSITION, LAST_POSITION
Modifier and Type | Method and Description |
---|---|
void |
addInvisibleObject(InvisibleObjectInterface object)
Add an ObjectInterface implementing object to the Network.
|
void |
addLink(Link link)
Register a link in the network.
|
void |
addNode(Node node)
Register a node in the network.
|
void |
addObject(ObjectInterface object)
Add an ObjectInterface implementing object to 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 |
containsInvisibleObject(InvisibleObjectInterface object)
Test whether the invisible object is present in the Network.
|
boolean |
containsInvisibleObject(String objectId)
Test whether an invisible object with the given id is present in the Network.
|
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 |
containsObject(ObjectInterface object)
Test whether the object is present in the Network.
|
boolean |
containsObject(String objectId)
Test whether an object with the 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() |
ImmutableMap<String,InvisibleObjectInterface> |
getInvisibleObjectMap()
Return an immutable map of all InvisibleObject implementing objects in the Network.
|
ImmutableMap<String,InvisibleObjectInterface> |
getInvisibleObjectMap(Class<InvisibleObjectInterface> objectType)
Return an immutable map of all InvisibleObject implementing objects in the network that are of type objectType, or any
sub type thereof.
|
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.
|
<T extends ObjectInterface> |
getObject(Class<T> objectType,
String objectId)
Return object of given type with given id.
|
ImmutableMap<String,ObjectInterface> |
getObjectMap()
Return an immutable map of all ObjectInterface implementing objects in the Network.
|
<T extends ObjectInterface> |
getObjectMap(Class<T> objectType)
Return an immutable map of all ObjectInterface implementing objects in the network that are of type objectType, or any
sub type thereof.
|
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.
|
default 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,
LinkWeight linkWeight)
Calculate the shortest route between two nodes in the network.
|
default 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.
|
CompleteRoute |
getShortestRouteBetween(GTUType gtuType,
Node nodeFrom,
Node nodeTo,
List<Node> nodesVia,
LinkWeight linkWeight)
Calculate the shortest route between two nodes in the network, via a list of intermediate nodes.
|
void |
removeInvisibleObject(InvisibleObjectInterface object)
Remove an ObjectInterface implementing object form the Network.
|
void |
removeLink(Link link)
Unregister a link from the network.
|
void |
removeNode(Node node)
Unregister a node from the network.
|
void |
removeObject(ObjectInterface object)
Remove an ObjectInterface implementing object form the Network.
|
void |
removeRoute(GTUType gtuType,
Route route)
Remove the route from the network, e.g.
|
addDefaultGtuTypes, addDefaultLinkTypes, addGtuType, addLinkType, getGtuType, getGtuType, getGtuTypes, getLinkType, getLinkType, getLinkTypes
addListener, addListener, addListener, addListener, removeListener
static final EventType ANIMATION_NODE_ADD_EVENT
static final EventType ANIMATION_NODE_REMOVE_EVENT
static final EventType ANIMATION_LINK_ADD_EVENT
static final EventType ANIMATION_LINK_REMOVE_EVENT
static final EventType ANIMATION_OBJECT_ADD_EVENT
static final EventType ANIMATION_OBJECT_REMOVE_EVENT
static final EventType ANIMATION_INVISIBLE_OBJECT_ADD_EVENT
static final EventType ANIMATION_INVISIBLE_OBJECT_REMOVE_EVENT
static final EventType ANIMATION_ROUTE_ADD_EVENT
static final EventType ANIMATION_ROUTE_REMOVE_EVENT
static final EventType ANIMATION_GTU_ADD_EVENT
static final EventType ANIMATION_GTU_REMOVE_EVENT
static final EventType ANIMATION_GENERATOR_ADD_EVENT
static final EventType ANIMATION_GENERATOR_REMOVE_EVENT
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 OBJECT_ADD_EVENT
static final EventType OBJECT_REMOVE_EVENT
static final EventType INVISIBLE_OBJECT_ADD_EVENT
static final EventType INVISIBLE_OBJECT_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
static final EventType GENERATOR_ADD_EVENT
static final EventType GENERATOR_REMOVE_EVENT
String getId()
getId
in interface Identifiable
ImmutableMap<String,Node> getNodeMap()
void addNode(Node node) throws NetworkException
node
- 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
- Node; the node to remove from the network.NetworkException
- if node does not exist in the network.boolean containsNode(Node node)
node
- Node; the node to search for in the network.boolean containsNode(String nodeId)
nodeId
- String; the id of the node to search for in the network.Node getNode(String nodeId)
nodeId
- String; the id of the node to search for in the network.ImmutableMap<String,Link> getLinkMap()
void addLink(Link link) throws NetworkException
link
- 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
- Link; the link to remove from the network.NetworkException
- if link does not exist in the network.boolean containsLink(Link link)
link
- Link; the link to search for in the network.boolean containsLink(String link)
link
- String; the id of the link to search for in the network.Link getLink(String linkId)
linkId
- String; the id of the link to search for in the network.Link getLink(Node node1, Node node2)
node1
- Node; first nodenode2
- Node; second nodeLink getLink(String nodeId1, String nodeId2) throws NetworkException
nodeId1
- String; id of the first nodenodeId2
- String; id of the second nodeNetworkException
- if the node(s) cannot be found by their idImmutableMap<String,ObjectInterface> getObjectMap()
<T extends ObjectInterface> ImmutableMap<String,T> getObjectMap(Class<T> objectType)
T
- type of objectobjectType
- Class<T>; the (sub-)type of ObjectInterface that the returned map is reduced to<T extends ObjectInterface> T getObject(Class<T> objectType, String objectId)
T
- object typeobjectType
- T; object type classobjectId
- String; id of objectnull
if no such objectvoid addObject(ObjectInterface object) throws NetworkException
object
- ObjectInterface; the object that implements ObjectInterfaceNetworkException
- if link already exists in the network, if name of the object is not unique.void removeObject(ObjectInterface object) throws NetworkException
object
- ObjectInterface; the object that implements ObjectInterfaceNetworkException
- if the object does not exist in the network.boolean containsObject(ObjectInterface object)
object
- ObjectInterface; the object that is tested for presenceboolean containsObject(String objectId)
objectId
- String; the id that is tested for presenceImmutableMap<String,InvisibleObjectInterface> getInvisibleObjectMap()
ImmutableMap<String,InvisibleObjectInterface> getInvisibleObjectMap(Class<InvisibleObjectInterface> objectType)
objectType
- Class<InvisibleObjectInterface>; the (sub-)type of InvisibleObject that the returned map is
reduced tovoid addInvisibleObject(InvisibleObjectInterface object) throws NetworkException
object
- InvisibleObjectInterface; the object that implements ObjectInterfaceNetworkException
- if link already exists in the network, if name of the object is not unique.void removeInvisibleObject(InvisibleObjectInterface object) throws NetworkException
object
- InvisibleObjectInterface; the object that implements ObjectInterfaceNetworkException
- if the object does not exist in the network.boolean containsInvisibleObject(InvisibleObjectInterface object)
object
- InvisibleObjectInterface; the object that is tested for presenceboolean containsInvisibleObject(String objectId)
objectId
- String; the id that is tested for presenceImmutableMap<String,Route> getDefinedRouteMap(GTUType gtuType)
gtuType
- GTUType; the GTUType for which to retrieve the defined routesvoid addRoute(GTUType gtuType, Route route) throws NetworkException
gtuType
- GTUType; the GTUType for which to add a routeroute
- Route; 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
- GTUType; the GTUType for which to remove a routeroute
- Route; the route to remove from the network.NetworkException
- if route does not exist in the network.Route getRoute(GTUType gtuType, String routeId)
gtuType
- GTUType; the GTUType for which to retrieve a route based on its id.routeId
- String; the route to search for in the network.boolean containsRoute(GTUType gtuType, Route route)
gtuType
- GTUType; the GTUType for which to check whether the route existsroute
- Route; the route to check forboolean containsRoute(GTUType gtuType, String routeId)
gtuType
- GTUType; the GTUType for which to check whether the route existsrouteId
- String; the id of the route to check forSet<Route> getRoutesBetween(GTUType gtuType, Node nodeFrom, Node nodeTo)
gtuType
- GTUType; the GTUType for which to retrieve the defined routesnodeFrom
- Node; the start node.nodeTo
- Node; the end node.void buildGraph(GTUType gtuType)
gtuType
- GTUType; the GTUType for which to (re)build the graphdefault CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo) throws NetworkException
gtuType
- GTUType; the GTUType for which to calculate the shortest routenodeFrom
- Node; the start node.nodeTo
- Node; 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, LinkWeight linkWeight) throws NetworkException
gtuType
- GTUType; the GTUType for which to calculate the shortest routenodeFrom
- Node; the start node.nodeTo
- Node; the end node.linkWeight
- LinkWeight; link weight.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.default CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, List<Node> nodesVia) throws NetworkException
gtuType
- GTUType; the GTUType for which to calculate the shortest routenodeFrom
- Node; the start node.nodeTo
- Node; the end node.nodesVia
- List<Node>; 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.CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, List<Node> nodesVia, LinkWeight linkWeight) throws NetworkException
gtuType
- GTUType; the GTUType for which to calculate the shortest routenodeFrom
- Node; the start node.nodeTo
- Node; the end node.nodesVia
- List<Node>; a number of nodes that the GTU has to pass between nodeFrom and nodeTo in the given
order.linkWeight
- LinkWeight; link weight.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–2019 Delft University of Technology. All rights reserved.