NETWORKID - the ID type of the Network, e.g., String.NODEID - the ID type of the Node, e.g., String.LINKID - the ID type of the Link, e.g., String.public class OTSNetwork<NETWORKID,LINKID,NODEID> extends Object implements Network<LINKID,NODEID>, Serializable
Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, @version $Revision: 1155 $, by $Author: averbraeck $,
initial version Jul 22, 2015
| Constructor and Description |
|---|
OTSNetwork(NETWORKID id)
Construction of an empty network.
|
public OTSNetwork(NETWORKID id)
id - the network id.public final void addNode(Node<NODEID> node) throws NetworkException
addNode in interface Network<LINKID,NODEID>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.public final void removeNode(Node<NODEID> node) throws NetworkException
removeNode in interface Network<LINKID,NODEID>node - the node to remove from the network.NetworkException - if node does not exist in the network.public final boolean containsNode(Node<NODEID> node)
containsNode in interface Network<LINKID,NODEID>node - the node to search for in the network.public final boolean containsNode(NODEID nodeId)
containsNode in interface Network<LINKID,NODEID>nodeId - the id of the node to search for in the network.public final void addLink(Link<LINKID,NODEID> link) throws NetworkException
addLink in interface Network<LINKID,NODEID>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.public final void removeLink(Link<LINKID,NODEID> link) throws NetworkException
removeLink in interface Network<LINKID,NODEID>link - the link to remove from the network.NetworkException - if link does not exist in the network.public final Link<LINKID,NODEID> getLink(Node<NODEID> node1, Node<NODEID> node2)
public final Link<LINKID,NODEID> getLink(NODEID nodeId1, NODEID nodeId2) throws NetworkException
getLink in interface Network<LINKID,NODEID>nodeId1 - id of the first nodenodeId2 - id of the second nodeNetworkException - if the node(s) cannot be found by their idpublic final boolean containsLink(Link<LINKID,NODEID> link)
containsLink in interface Network<LINKID,NODEID>link - the link to search for in the network.public final boolean containsLink(LINKID linkId)
containsLink in interface Network<LINKID,NODEID>linkId - the id of the link to search for in the network.public final void addRoute(Route<LINKID,NODEID> route) throws NetworkException
addRoute in interface Network<LINKID,NODEID>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.public final void removeRoute(Route<LINKID,NODEID> route) throws NetworkException
removeRoute in interface Network<LINKID,NODEID>route - the route to remove from the network.NetworkException - if route does not exist in the network.public final boolean containsRoute(Route<LINKID,NODEID> route)
containsRoute in interface Network<LINKID,NODEID>route - the route to search for in the network.public final boolean containsRoute(String routeId)
containsRoute in interface Network<LINKID,NODEID>routeId - the route to search for in the network.public final Set<Route<LINKID,NODEID>> getRoutesBetween(Node<NODEID> nodeFrom, Node<NODEID> nodeTo)
getRoutesBetween in interface Network<LINKID,NODEID>nodeFrom - the start node.nodeTo - the end node.public final Route<LINKID,NODEID> getShortestRouteBetween(Node<NODEID> nodeFrom, Node<NODEID> nodeTo)
getShortestRouteBetween in interface Network<LINKID,NODEID>nodeFrom - the start node.nodeTo - the end node.public final NETWORKID getId()
public final Map<NODEID,Node<NODEID>> getNodeMap()
getNodeMap in interface Network<LINKID,NODEID>public final Map<LINKID,Link<LINKID,NODEID>> getLinkMap()
getLinkMap in interface Network<LINKID,NODEID>Copyright © 2014–2015 Delft University of Technology. All rights reserved.