NODEID - the ID type of the Node, e.g., String.LINKID - the ID type of the Link, e.g., String.public class Route<LINKID,NODEID> extends Object implements Serializable
Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, @version $Revision: 1155 $, by $Author: averbraeck $,
initial version Jan 1, 2015
| Constructor and Description |
|---|
Route(String id)
Create an empty route.
|
Route(String id,
List<Node<NODEID>> nodes)
Create a route based on an initial list of nodes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(Node<NODEID> node)
Add a node to the end of the node list.
|
Node<NODEID> |
destinationNode() |
String |
getId() |
Node<NODEID> |
getNode(int i) |
List<Node<NODEID>> |
getNodes() |
int |
indexOf(Node<NODEID> node)
Return the index of a Node in this Route, or -1 if this Route does not contain the specified Node.
|
Node<NODEID> |
originNode() |
int |
size() |
String |
toString() |
public Route(String id)
id - the name of the route.public void addNode(Node<NODEID> node) throws NetworkException
node - the node to add.NetworkException - in case node could not be added to the route.public final Node<NODEID> getNode(int i) throws NetworkException
i - the index of the node to obtainNetworkException - if i < 0 or i > sizepublic final Node<NODEID> originNode() throws NetworkException
NetworkException - when the list has no nodes.public final int size()
public final Node<NODEID> destinationNode() throws NetworkException
NetworkException - when the list has no nodes.public final int indexOf(Node<NODEID> node)
node - Node<?, ?>; the Node to findpublic final String getId()
Copyright © 2014–2015 Delft University of Technology. All rights reserved.