Package org.opentrafficsim.core.network
Interface Network
- All Superinterfaces:
Definitions,EventProducerInterface,Identifiable
- All Known Implementing Classes:
ExpansionNetwork,OTSNetwork
public interface Network extends Definitions, EventProducerInterface, Identifiable
Interface that defines what information a network should be able to provide about Nodes, Links and Routes.
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
- Author:
- Alexander Verbraeck, Peter Knoppers, Guus Tamminga
-
Field Summary
Fields Modifier and Type Field Description static EventTypeANIMATION_GENERATOR_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of an GTUGenerator implementing object.static EventTypeANIMATION_GENERATOR_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of an GTUGenerator implementing object.static EventTypeANIMATION_GTU_ADD_EVENTThe timed event type for pub/sub indicating the addition of a GTU to the network.static EventTypeANIMATION_GTU_REMOVE_EVENTThe timed event type for pub/sub indicating the removal of a GTU from the network.static EventTypeANIMATION_INVISIBLE_OBJECT_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing object.static EventTypeANIMATION_INVISIBLE_OBJECT_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing object.static EventTypeANIMATION_LINK_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of a Link.static EventTypeANIMATION_LINK_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Link.static EventTypeANIMATION_NODE_ADD_EVENTThe timed event type for pub/sub indicating the addition of a Node.static EventTypeANIMATION_NODE_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Node.static EventTypeANIMATION_OBJECT_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.static EventTypeANIMATION_OBJECT_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.static EventTypeANIMATION_ROUTE_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.static EventTypeANIMATION_ROUTE_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.static EventTypeGENERATOR_ADD_EVENTThe timed event type for pub/sub indicating the addition of a GTUGenerator to the network.static EventTypeGENERATOR_REMOVE_EVENTThe timed event type for pub/sub indicating the removal of a GTUGenerator from the network.static EventTypeGTU_ADD_EVENTThe timed event type for pub/sub indicating the addition of a GTU to the network.static EventTypeGTU_REMOVE_EVENTThe timed event type for pub/sub indicating the removal of a GTU from the network.static EventTypeINVISIBLE_OBJECT_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing object.static EventTypeINVISIBLE_OBJECT_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing object.static EventTypeLINK_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of a Link.static EventTypeLINK_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Link.static EventTypeNODE_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of a Node.static EventTypeNODE_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Node.static EventTypeOBJECT_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.static EventTypeOBJECT_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.static EventTypeROUTE_ADD_EVENTThe (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.static EventTypeROUTE_REMOVE_EVENTThe (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION -
Method Summary
Modifier and Type Method Description voidaddInvisibleObject(InvisibleObjectInterface object)Add an ObjectInterface implementing object to the Network.voidaddLink(Link link)Register a link in the network.voidaddNode(Node node)Register a node in the network.voidaddObject(ObjectInterface object)Add an ObjectInterface implementing object to the Network.voidaddRoute(GTUType gtuType, Route route)Add a route to the network.voidbuildGraph(GTUType gtuType)(Re)build the underlying graph for the given GTUType.booleancontainsInvisibleObject(String objectId)Test whether an invisible object with the given id is present in the Network.booleancontainsInvisibleObject(InvisibleObjectInterface object)Test whether the invisible object is present in the Network.booleancontainsLink(String link)Test whether a link with a given id is present in the network.booleancontainsLink(Link link)Test whether a link is present in the network.booleancontainsNode(String nodeId)Test whether a node with a given id is present in the network.booleancontainsNode(Node node)Test whether a node is present in the network.booleancontainsObject(String objectId)Test whether an object with the given id is present in the Network.booleancontainsObject(ObjectInterface object)Test whether the object is present in the Network.booleancontainsRoute(GTUType gtuType, String routeId)Determine whether a route with the given id exists in the network for the given GTUType.booleancontainsRoute(GTUType gtuType, Route route)Determine whether the provided route 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.StringgetId()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.LinkgetLink(String linkId)Retrieve a node with a given id from the network, or null if the id cannot be found.LinkgetLink(String nodeId1, String nodeId2)Find a link between node1 and node2 and return it if it exists in the network.LinkgetLink(Node node1, Node node2)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.NodegetNode(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>
TgetObject(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>
ImmutableMap<String,T>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.RoutegetRoute(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 CompleteRoutegetShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo)Calculate the shortest route between two nodes in the network.default CompleteRoutegetShortestRouteBetween(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.CompleteRoutegetShortestRouteBetween(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.CompleteRoutegetShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, LinkWeight linkWeight)Calculate the shortest route between two nodes in the network.voidremoveInvisibleObject(InvisibleObjectInterface object)Remove an ObjectInterface implementing object form the Network.voidremoveLink(Link link)Unregister a link from the network.voidremoveNode(Node node)Unregister a node from the network.voidremoveObject(ObjectInterface object)Remove an ObjectInterface implementing object form the Network.voidremoveRoute(GTUType gtuType, Route route)Remove the route from the network, e.g.Methods inherited from interface org.opentrafficsim.core.definitions.Definitions
addDefaultGtuTypes, addDefaultLinkTypes, addGtuType, addLinkType, getGtuType, getGtuType, getGtuTypes, getLinkType, getLinkType, getLinkTypesMethods inherited from interface nl.tudelft.simulation.event.EventProducerInterface
addListener, addListener, addListener, addListener, removeListener
-
Field Details
-
ANIMATION_NODE_ADD_EVENT
The timed event type for pub/sub indicating the addition of a Node.
Payload: Node node (not an array, just an Object) -
ANIMATION_NODE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Node.
Payload: Node node (not an array, just an Object) -
ANIMATION_LINK_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Link.
Payload: Link link (not an array, just an Object) -
ANIMATION_LINK_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Link.
Payload: Link link (not an array, just an Object) -
ANIMATION_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.
Payload: StaticObject object (not an array, just an Object) -
ANIMATION_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.
Payload: StaticObject object (not an array, just an Object) -
ANIMATION_INVISIBLE_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing object.
Payload: InvisibleObject object (not an array, just an Object) -
ANIMATION_INVISIBLE_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing object.
Payload: InvisibleObject object (not an array, just an Object) -
ANIMATION_ROUTE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.
Payload: [GTUType gtuType, Route route] -
ANIMATION_ROUTE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.
Payload: [GTUType gtuType, Route route] -
ANIMATION_GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the network.
Payload: GTU gtu (not an array, just an Object) -
ANIMATION_GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the network.
Payload: GTU gtu (not an array, just an Object) -
ANIMATION_GENERATOR_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an GTUGenerator implementing object.
Payload: AbstractGTUGenerator object (not an array, just an Object) -
ANIMATION_GENERATOR_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an GTUGenerator implementing object.
Payload: AbstractGTUGenerator object (not an array, just an Object) -
NODE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Node.
Payload: String nodeId (not an array, just a String) -
NODE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Node.
Payload: String nodeId (not an array, just a String) -
LINK_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Link.
Payload: String linkId (not an array, just a String) -
LINK_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Link.
Payload: String linkId (not an array, just a String) -
OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an ObjectInterface implementing object.
Payload: String ObjectId (not an array, just a String) -
OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an ObjectInterface implementing object.
Payload: String objectId (not an array, just a String) -
INVISIBLE_OBJECT_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of an InvisibleObjectInterface implementing object.
Payload: String ObjectId (not an array, just a String) -
INVISIBLE_OBJECT_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of an InvisibleObjectInterface implementing object.
Payload: String objectId (not an array, just a String) -
ROUTE_ADD_EVENT
The (regular, not timed) event type for pub/sub indicating the addition of a Route for a gtuType.
Payload: [String gtuTypeId, String routeId] -
ROUTE_REMOVE_EVENT
The (regular, not timed) event type for pub/sub indicating the removal of a Route for a gtuType.
Payload: [String gtuTypeId, String routeId] -
GTU_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTU to the network.
Payload: String gtuId (not an array, just a String) -
GTU_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTU from the network.
Payload: String gtuId (not an array, just a String) -
GENERATOR_ADD_EVENT
The timed event type for pub/sub indicating the addition of a GTUGenerator to the network.
Payload: String generatorName (not an array, just a String) -
GENERATOR_REMOVE_EVENT
The timed event type for pub/sub indicating the removal of a GTUGenerator from the network.
Payload: String generatorName (not an array, just a String)
-
-
Method Details
-
getId
String getId()- Specified by:
getIdin interfaceIdentifiable- Returns:
- String; the id
-
getNodeMap
ImmutableMap<String,Node> getNodeMap()Provide an immutable map of node ids to nodes in the network.- Returns:
- an immutable map of nodes.
-
addNode
Register a node in the network.- Parameters:
node- Node; the node to add to the network.- Throws:
NetworkException- if node already exists in the network, or if name of the node is not unique.
-
removeNode
Unregister a node from the network.- Parameters:
node- Node; the node to remove from the network.- Throws:
NetworkException- if node does not exist in the network.
-
containsNode
Test whether a node is present in the network.- Parameters:
node- Node; the node to search for in the network.- Returns:
- whether the node is in this network
-
containsNode
Test whether a node with a given id is present in the network.- Parameters:
nodeId- String; the id of the node to search for in the network.- Returns:
- whether the node is in this network
-
getNode
Retrieve a node with a given id from the network, or null if the id cannot be found.- Parameters:
nodeId- String; the id of the node to search for in the network.- Returns:
- the node or null if not present
-
getLinkMap
ImmutableMap<String,Link> getLinkMap()Provide an immutable map of link ids to links in the network.- Returns:
- the an immutable map of links.
-
addLink
Register a link in the network.- Parameters:
link- Link; the link to add to the network.- Throws:
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.
-
removeLink
Unregister a link from the network.- Parameters:
link- Link; the link to remove from the network.- Throws:
NetworkException- if link does not exist in the network.
-
containsLink
Test whether a link is present in the network.- Parameters:
link- Link; the link to search for in the network.- Returns:
- whether the link is in this network
-
containsLink
Test whether a link with a given id is present in the network.- Parameters:
link- String; the id of the link to search for in the network.- Returns:
- whether the link is in this network
-
getLink
Retrieve a node with a given id from the network, or null if the id cannot be found.- Parameters:
linkId- String; the id of the link to search for in the network.- Returns:
- the link or null if not present
-
getLink
Find a link between node1 and node2 and return it if it exists in the network. If not, return null.- Parameters:
node1- Node; first nodenode2- Node; second node- Returns:
- the link between node1 and node2 in the network or null if it does not exist.
-
getLink
Find a link between node1 and node2 and return it if it exists in the network. If not, return null.- Parameters:
nodeId1- String; id of the first nodenodeId2- String; id of the second node- Returns:
- the link between node1 and node2 in the network or null if it does not exist.
- Throws:
NetworkException- if the node(s) cannot be found by their id
-
getObjectMap
ImmutableMap<String,ObjectInterface> getObjectMap()Return an immutable map of all ObjectInterface implementing objects in the Network.- Returns:
- ImmutableMap<String, ObjectInterface>; the immutable map of all ObjectInterface implementing objects in the Network
-
getObjectMap
Return an immutable map of all ObjectInterface implementing objects in the network that are of type objectType, or any sub type thereof.- Type Parameters:
T- type of object- Parameters:
objectType- Class<T>; the (sub-)type of ObjectInterface that the returned map is reduced to- Returns:
- ImmutableMap<String, ObjectInterface>; the immutable map of all ObjectInterface implementing objects in the Network that are of the type objectType, or any sub type thereof
-
getObject
Return object of given type with given id.- Type Parameters:
T- object type- Parameters:
objectType- T; object type classobjectId- String; id of object- Returns:
- T; object of given type with given id,
nullif no such object
-
addObject
Add an ObjectInterface implementing object to the Network.- Parameters:
object- ObjectInterface; the object that implements ObjectInterface- Throws:
NetworkException- if link already exists in the network, if name of the object is not unique.
-
removeObject
Remove an ObjectInterface implementing object form the Network.- Parameters:
object- ObjectInterface; the object that implements ObjectInterface- Throws:
NetworkException- if the object does not exist in the network.
-
containsObject
Test whether the object is present in the Network.- Parameters:
object- ObjectInterface; the object that is tested for presence- Returns:
- boolean; whether the object is present in the Network
-
containsObject
Test whether an object with the given id is present in the Network.- Parameters:
objectId- String; the id that is tested for presence- Returns:
- boolean; whether an object with the given id is present in the Network
-
getInvisibleObjectMap
ImmutableMap<String,InvisibleObjectInterface> getInvisibleObjectMap()Return an immutable map of all InvisibleObject implementing objects in the Network.- Returns:
- ImmutableMap<String, ObjectInterface>; the immutable map of all ObjectInterface implementing objects in the Network
-
getInvisibleObjectMap
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.- Parameters:
objectType- Class<InvisibleObjectInterface>; the (sub-)type of InvisibleObject that the returned map is reduced to- Returns:
- ImmutableMap<String, InvisibleObject>; the immutable map of all InvisibleObject implementing objects in the Network that are of the type objectType, or any sub type thereof
-
addInvisibleObject
Add an ObjectInterface implementing object to the Network.- Parameters:
object- InvisibleObjectInterface; the object that implements ObjectInterface- Throws:
NetworkException- if link already exists in the network, if name of the object is not unique.
-
removeInvisibleObject
Remove an ObjectInterface implementing object form the Network.- Parameters:
object- InvisibleObjectInterface; the object that implements ObjectInterface- Throws:
NetworkException- if the object does not exist in the network.
-
containsInvisibleObject
Test whether the invisible object is present in the Network.- Parameters:
object- InvisibleObjectInterface; the object that is tested for presence- Returns:
- boolean; whether the invisible object is present in the Network
-
containsInvisibleObject
Test whether an invisible object with the given id is present in the Network.- Parameters:
objectId- String; the id that is tested for presence- Returns:
- boolean; whether an invisible object with the given id is present in the Network
-
getDefinedRouteMap
Return an immutable map of routes that exist in the network for the GTUType.- Parameters:
gtuType- GTUType; the GTUType for which to retrieve the defined routes- Returns:
- an immutable map of routes in the network for the given GTUType, or an empty Map if no routes are defined for the given GTUType.
-
addRoute
Add a route to the network.- Parameters:
gtuType- GTUType; the GTUType for which to add a routeroute- Route; the route to add to the network.- Throws:
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.
-
removeRoute
Remove the route from the network, e.g. because of road maintenance.- Parameters:
gtuType- GTUType; the GTUType for which to remove a routeroute- Route; the route to remove from the network.- Throws:
NetworkException- if route does not exist in the network.
-
getRoute
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.- Parameters:
gtuType- GTUType; the GTUType for which to retrieve a route based on its id.routeId- String; the route to search for in the network.- Returns:
- the route or null if not present
-
containsRoute
Determine whether the provided route exists in the network for the given GTUType.- Parameters:
gtuType- GTUType; the GTUType for which to check whether the route existsroute- Route; the route to check for- Returns:
- whether the route exists in the network for the given GTUType
-
containsRoute
Determine whether a route with the given id exists in the network for the given GTUType.- Parameters:
gtuType- GTUType; the GTUType for which to check whether the route existsrouteId- String; the id of the route to check for- Returns:
- whether a route with the given id exists in the network for the given GTUType
-
getRoutesBetween
Return the the shortest route between two nodes in the network, via a list of intermediate nodes. If no path exists from the start node to the end node via the intermediate nodes in the network, null is returned.- Parameters:
gtuType- GTUType; the GTUType for which to retrieve the defined routesnodeFrom- Node; the start node.nodeTo- Node; the end node.- Returns:
- a set with routes from the start Node to the end Node in the network; if no route can be found, an empty set is returned.
-
buildGraph
(Re)build the underlying graph for the given GTUType.- Parameters:
gtuType- GTUType; the GTUType for which to (re)build the graph
-
getShortestRouteBetween
default CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo) throws NetworkExceptionCalculate the shortest route between two nodes in the network. If no path exists from the start node to the end node in the network, null is returned. This method returns a CompleteRoute, which includes all nodes to get from start to end. In case the graph for the GTUType has not yet been built, this method will call the buildGraph method.- Parameters:
gtuType- GTUType; the GTUType for which to calculate the shortest routenodeFrom- Node; the start node.nodeTo- Node; the end node.- Returns:
- the shortest route from the start Node to the end Node in the network. If no path exists from the start node to the end node in the network, null is returned.
- Throws:
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.
-
getShortestRouteBetween
CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, LinkWeight linkWeight) throws NetworkExceptionCalculate the shortest route between two nodes in the network. If no path exists from the start node to the end node in the network, null is returned. This method returns a CompleteRoute, which includes all nodes to get from start to end. This method recalculates the graph.- Parameters:
gtuType- GTUType; the GTUType for which to calculate the shortest routenodeFrom- Node; the start node.nodeTo- Node; the end node.linkWeight- LinkWeight; link weight.- Returns:
- the shortest route from the start Node to the end Node in the network. If no path exists from the start node to the end node in the network, null is returned.
- Throws:
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.
-
getShortestRouteBetween
default CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, List<Node> nodesVia) throws NetworkExceptionCalculate the shortest route between two nodes in the network, via a list of intermediate nodes. If no path exists from the start node to the end node via the intermediate nodes in the network, null is returned. This method returns a CompleteRoute, which includes all nodes to get from start to end. In case the graph for the GTUType has not yet been built, this method will call the buildGraph method.- Parameters:
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.- Returns:
- the shortest route between two nodes in the network, via the intermediate nodes. If no path exists from the start node to the end node via the intermediate nodes in the network, null is returned.
- Throws:
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.
-
getShortestRouteBetween
CompleteRoute getShortestRouteBetween(GTUType gtuType, Node nodeFrom, Node nodeTo, List<Node> nodesVia, LinkWeight linkWeight) throws NetworkExceptionCalculate the shortest route between two nodes in the network, via a list of intermediate nodes. If no path exists from the start node to the end node via the intermediate nodes in the network, null is returned. This method returns a CompleteRoute, which includes all nodes to get from start to end. This method recalculates the graph.- Parameters:
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.- Returns:
- the shortest route between two nodes in the network, via the intermediate nodes. If no path exists from the start node to the end node via the intermediate nodes in the network, null is returned.
- Throws:
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.
-