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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-16 10:20:53 +0200 (Thu, 16 Jul 2015) $, @version $Revision: 1124 $, by $Author: pknoppers $, initial version Jul 22, 2015
BSD-style license. See OpenTrafficSim License.- 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompleteRouteaddNode(Node node)Add a node to the end of the node list.CompleteRouteclone(Network newNetwork)Clone the Route.booleancontainsLink(Link link)Determine if this Route contains the specified Link.booleanequals(Object obj)inthashCode()StringtoString()-
Methods inherited from class org.opentrafficsim.core.network.route.Route
contains, destinationNode, getId, getNode, getNodes, indexOf, originNode, size, verify
-
-
-
-
Constructor Detail
-
CompleteRoute
public CompleteRoute(String id, GTUType gtuType)
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
public CompleteRoute(String id, GTUType gtuType, List<Node> nodes) throws NetworkException
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 Detail
-
addNode
public final CompleteRoute addNode(Node node) throws NetworkException
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
public final boolean containsLink(Link link)
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.
-
clone
public CompleteRoute clone(Network newNetwork) throws NetworkException
Clone the Route.- Overrides:
clonein classRoute- Parameters:
newNetwork- Network; the new network- Returns:
- a clone of this route
- Throws:
NetworkException- in case the cloning fails
-
-