public class OTSNetwork extends Object implements Network, 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-08-23 00:48:01 +0200 (Sun, 23 Aug 2015) $, @version $Revision: 1291 $, by $Author: averbraeck $,
initial version Jul 22, 2015
| Constructor and Description |
|---|
OTSNetwork(String id)
Construction of an empty network.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLink(Link link) |
void |
addNode(Node node) |
void |
addRoute(Route route) |
boolean |
containsLink(Link link) |
boolean |
containsLink(String linkId) |
boolean |
containsNode(Node node) |
boolean |
containsNode(String nodeId) |
boolean |
containsRoute(Route route) |
boolean |
containsRoute(String routeId) |
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) |
Link |
getLink(String nodeId1,
String nodeId2)
Find a link between node1 and node2 and return it if it exists in the network.
|
Map<String,Link> |
getLinkMap() |
Node |
getNode(String nodeId) |
Map<String,Node> |
getNodeMap() |
Route |
getRoute(String routeId) |
Map<String,Route> |
getRouteMap() |
Set<Route> |
getRoutesBetween(Node nodeFrom,
Node nodeTo) |
Route |
getShortestRouteBetween(Node nodeFrom,
Node nodeTo) |
void |
removeLink(Link link) |
void |
removeNode(Node node) |
void |
removeRoute(Route route) |
public OTSNetwork(String id)
id - the network id.public final void addNode(Node node) throws NetworkException
addNode in interface Networknode - 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 node) throws NetworkException
removeNode in interface Networknode - the node to remove from the network.NetworkException - if node does not exist in the network.public final boolean containsNode(Node node)
containsNode in interface Networknode - the node to search for in the network.public final boolean containsNode(String nodeId)
containsNode in interface NetworknodeId - the id of the node to search for in the network.public final void addLink(Link link) throws NetworkException
addLink in interface Networklink - 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 link) throws NetworkException
removeLink in interface Networklink - the link to remove from the network.NetworkException - if link does not exist in the network.public final Link getLink(Node node1, Node node2)
public final Link getLink(String nodeId1, String nodeId2) throws NetworkException
getLink in interface NetworknodeId1 - id of the first nodenodeId2 - id of the second nodeNetworkException - if the node(s) cannot be found by their idpublic final boolean containsLink(Link link)
containsLink in interface Networklink - the link to search for in the network.public final boolean containsLink(String linkId)
containsLink in interface NetworklinkId - the id of the link to search for in the network.public final void addRoute(Route route) throws NetworkException
addRoute in interface Networkroute - 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 route) throws NetworkException
removeRoute in interface Networkroute - the route to remove from the network.NetworkException - if route does not exist in the network.public final boolean containsRoute(Route route)
containsRoute in interface Networkroute - the route to search for in the network.public final boolean containsRoute(String routeId)
containsRoute in interface NetworkrouteId - the route to search for in the network.public final Set<Route> getRoutesBetween(Node nodeFrom, Node nodeTo)
getRoutesBetween in interface NetworknodeFrom - the start node.nodeTo - the end node.public final Route getShortestRouteBetween(Node nodeFrom, Node nodeTo)
getShortestRouteBetween in interface NetworknodeFrom - the start node.nodeTo - the end node.public final String getId()
public final Map<String,Node> getNodeMap()
getNodeMap in interface Networkpublic final Map<String,Link> getLinkMap()
getLinkMap in interface Networkpublic final Map<String,Route> getRouteMap()
getRouteMap in interface NetworkCopyright © 2014–2015 Delft University of Technology. All rights reserved.