public interface ILcdRoute<N,E>
ILcdRoute
describes a route in a graph, i.e. a sequence of connected edges in a
graph. With 'connected edges' is meant that the following invariant should always apply for each
ILcdRoute
:
every edge in a route should have at least one node in common with its immediate
predecessor edge, and at least one node in common with its immediate successor edge.
No further constraints are imposed on the route: nodes or edges can be passed multiple times,
closed circuits are allowed, etc ...
Note: with 'positive direction', we mean the direction following the route from the first edge of
the route to the last edge of the route.Modifier and Type | Method and Description |
---|---|
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 getEdgeCount()
E getEdge(int aIndex)
aIndex
in this route, counting in positive direction
and starting from 0 for the first edge.aIndex
- the index of the edge in the route.IndexOutOfBoundsException
- aIndex < 0 || aIndex >= getEdgeCount()
.int getNodeCount()
N getNode(int aIndex)
aIndex
in this route, counting in positive direction
and starting from 0 for the start node.aIndex
- the index of the node in the route.IndexOutOfBoundsException
- aIndex < 0 || aIndex >= getNodeCount()
.N getStartNode()
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()
.Object
of this route.N getEndNode()
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()
.Object
of this route.