public class Route extends Object implements Serializable, Identifiable
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-01-06 01:35:05 +0100 (Sun, 06 Jan 2019) $, @version $Revision: 4831 $, 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 |
---|---|
Route |
addNode(Node node)
Add a node to the end of the node list.
|
Route |
clone(Network newNetwork,
SimulatorInterface.TimeDoubleUnit newSimulator)
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
- String; the name of the route.public Route addNode(Node node) throws NetworkException
node
- 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
- int; 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()
getId
in interface Identifiable
public Route clone(Network newNetwork, SimulatorInterface.TimeDoubleUnit newSimulator) throws NetworkException
newNetwork
- Network; the new networknewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator for this networkNetworkException
- in case the cloning failsCopyright © 2014–2019 Delft University of Technology. All rights reserved.