public class Route extends Object implements Serializable
Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2017-04-28 03:35:59 +0200 (Fri, 28 Apr 2017) $, @version $Revision: 3569 $, by $Author: averbraeck $,
initial version Jan 1, 2015
| Constructor and Description |
|---|
Route(String id)
Create an empty route.
|
Route(String id,
List<Node> nodes)
Create a route based on an initial list of nodes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(Node node)
Add a node to the end of the node list.
|
Route |
clone(Network newNetwork,
OTSSimulatorInterface newSimulator,
boolean animation)
Clone the Route.
|
boolean |
contains(Node node) |
Node |
destinationNode() |
String |
getId() |
Node |
getNode(int i) |
List<Node> |
getNodes() |
int |
indexOf(Node node)
Return the index of a Node in this Route, or -1 if this Route does not contain the specified Node.
|
Node |
originNode() |
int |
size() |
String |
toString() |
public Route(String id)
id - the name of the route.public void addNode(Node node) throws NetworkException
node - the node to add.NetworkException - in case node could not be added to the route.public final Node getNode(int i) throws NetworkException
i - the index of the node to obtainNetworkException - if i < 0 or i > sizepublic final Node originNode() throws NetworkException
NetworkException - when the list has no nodes.public final int size()
public final Node destinationNode() throws NetworkException
NetworkException - when the list has no nodes.public final int indexOf(Node node)
node - Node; the Node to findpublic final boolean contains(Node node)
node - Node; the Node to findpublic final String getId()
public Route clone(Network newNetwork, OTSSimulatorInterface newSimulator, boolean animation) throws NetworkException
newNetwork - the new networknewSimulator - the new simulator for this networkanimation - whether to (re)create animation or notNetworkException - in case the cloning failsCopyright © 2014–2017 Delft University of Technology. All rights reserved.