Constructor and Description |
---|
TLcdRoute(ILcdGraph<N,E> aGraph,
N aStartNode)
Create a new route which has all its edges and nodes contained in the given graph,
with the given start node.
|
Modifier and Type | Method and Description |
---|---|
void |
addEdgeAtEnd(E aEdge)
Adds an edge to the end of the route.
|
void |
addEdgeAtStart(E aEdge)
Adds an edge in front of the start of the route.
|
boolean |
equals(Object o) |
E |
getEdge(int aIndex)
Returns the edge at position
aIndex in this route, counting in positive direction
and starting from 0 for the first edge. |
int |
getEdgeCount()
Returns the number of edges in this route.
|
N |
getEndNode()
Returns the end node of this route, this is the node of the last edge of the
route that is passed last when following the route in positive direction.
|
N |
getNode(int aIndex)
Returns the node at position
aIndex in this route, counting in positive direction
and starting from 0 for the start node. |
int |
getNodeCount()
Returns the number of nodes in this route, this should always equal the number of edges in this
route + 1.
|
N |
getStartNode()
Returns the start node of this route, this is the node of the first edge of
the route that is passed first when following the route in positive direction.
|
int |
hashCode() |
String |
toString()
Returns a general description of this route, as a sequence of all edges in this route.
|
public TLcdRoute(ILcdGraph<N,E> aGraph, N aStartNode)
aGraph
- the graph in which all edges and nodes of this route are contained.aStartNode
- the start node of the route.public void addEdgeAtEnd(E aEdge)
aEdge
- the edge to be added.IllegalArgumentException
- the given edge is not adjacent to the endpoint of the route
or the given edge is not part of the graph in which the route is contained.NullPointerException
- if the given edge is null
.public void addEdgeAtStart(E aEdge)
aEdge
- the edge to be added.IllegalArgumentException
- the given edge is not adjacent to the start node of the route
or the given edge is not part of the graph in which the route is contained.NullPointerException
- if the given edge is null
.public int getEdgeCount()
ILcdRoute
getEdgeCount
in interface ILcdRoute<N,E>
public E getEdge(int aIndex)
ILcdRoute
aIndex
in this route, counting in positive direction
and starting from 0 for the first edge.public int getNodeCount()
ILcdRoute
getNodeCount
in interface ILcdRoute<N,E>
public N getNode(int aIndex)
ILcdRoute
aIndex
in this route, counting in positive direction
and starting from 0 for the start node.public N getStartNode()
ILcdRoute
route.getEdge(0).getStartNode()
: an edge can have its
orientation in opposite direction of the positive route direction, in which case the start node
of the route will be equal to route.getEdge(0).getEndNode()
.getStartNode
in interface ILcdRoute<N,E>
Object
of this route.public N getEndNode()
ILcdRoute
route.getEdge(route.getEdgeCount-1).getEndNode()
: an
edge can have its orientation in opposite direction of the route direction, in which case
the end node of the route will be equal to route.getEdge(route.getEdgeCount-1).getStartNode()
.getEndNode
in interface ILcdRoute<N,E>
Object
of this route.public String toString()