Class CompleteRoute
java.lang.Object
org.opentrafficsim.core.network.route.Route
org.opentrafficsim.core.network.route.CompleteRoute
- All Implemented Interfaces:
Serializable,Identifiable
public class CompleteRoute extends Route
A CompleteRoute is a Route with directly connected Nodes.
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: 2015-07-16 10:20:53 +0200 (Thu, 16 Jul 2015) $, @version $Revision: 1124 $, by $Author: pknoppers $,
initial version Jul 22, 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description CompleteRoute(String id, GTUType gtuType)Create an empty route for the given GTUType.CompleteRoute(String id, GTUType gtuType, List<Node> nodes)Create a route based on an initial list of nodes. -
Method Summary
Modifier and Type Method Description CompleteRouteaddNode(Node node)Add a node to the end of the node list.CompleteRouteclone(Network newNetwork, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the Route.booleancontainsLink(Link link)Determine if this Route contains the specified Link.StringtoString()Methods inherited from class org.opentrafficsim.core.network.route.Route
contains, destinationNode, getId, getNode, getNodes, indexOf, originNode, size
-
Constructor Details
-
CompleteRoute
Create an empty route for the given GTUType.- Parameters:
id- String; the name of the routegtuType- GTUType; the GTUType for which this is a route
-
CompleteRoute
Create a route based on an initial list of nodes.
This constructor makes a defensive copy of the provided List.- Parameters:
id- String; the name of the route.gtuType- GTUType; the GTUType for which this is a routenodes- List<Node>; the initial list of nodes.- Throws:
NetworkException- if intermediate nodes are missing in the route.
-
-
Method Details
-
addNode
Add a node to the end of the node list.- Overrides:
addNodein classRoute- Parameters:
node- Node; the node to add.- Returns:
- Route; this route for method chaining
- Throws:
NetworkException- in case node could not be added to the route.
-
containsLink
Determine if this Route contains the specified Link.- Parameters:
link- Link; the link to check in the route.- Returns:
- whether the link is part of the route or not.
-
toString
-
clone
public CompleteRoute clone(Network newNetwork, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkExceptionClone the Route.- Overrides:
clonein classRoute- Parameters:
newNetwork- Network; the new networknewSimulator- SimulatorInterface.TimeDoubleUnit; the new simulator for this network- Returns:
- a clone of this route
- Throws:
NetworkException- in case the cloning fails
-