Package com.luciad.network.graph.route
Class TLcdRoute<N,E>
java.lang.Object
com.luciad.network.graph.route.TLcdRoute<N,E>
- All Implemented Interfaces:
ILcdRoute<N,
E>
Default implementation of
ILcdRoute
.- Since:
- 5.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
getEdge
(int aIndex) Returns the edge at positionaIndex
in this route, counting in positive direction and starting from 0 for the first edge.int
Returns the number of edges in this route.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.getNode
(int aIndex) Returns the node at positionaIndex
in this route, counting in positive direction and starting from 0 for the start node.int
Returns the number of nodes in this route, this should always equal the number of edges in this route + 1.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()
toString()
Returns a general description of this route, as a sequence of all edges in this route.
-
Constructor Details
-
TLcdRoute
Create a new route which has all its edges and nodes contained in the given graph, with the given start node.- Parameters:
aGraph
- the graph in which all edges and nodes of this route are contained.aStartNode
- the start node of the route.
-
-
Method Details
-
addEdgeAtEnd
Adds an edge to the end of the route.- Parameters:
aEdge
- the edge to be added.- Throws:
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 isnull
.
-
addEdgeAtStart
Adds an edge in front of the start of the route.- Parameters:
aEdge
- the edge to be added.- Throws:
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 isnull
.
-
getEdgeCount
public int getEdgeCount()Description copied from interface:ILcdRoute
Returns the number of edges in this route. Edges which are passed multiple times, are counted as many times as they are passed.- Specified by:
getEdgeCount
in interfaceILcdRoute<N,
E> - Returns:
- the number of edges in this route.
-
getEdge
Description copied from interface:ILcdRoute
Returns the edge at positionaIndex
in this route, counting in positive direction and starting from 0 for the first edge. -
getNodeCount
public int getNodeCount()Description copied from interface:ILcdRoute
Returns the number of nodes in this route, this should always equal the number of edges in this route + 1. Nodes which are passed multiple times, are counted as many times as they are passed. Start node and end node are included in the route.- Specified by:
getNodeCount
in interfaceILcdRoute<N,
E> - Returns:
- the number of nodes in this route.
-
getNode
Description copied from interface:ILcdRoute
Returns the node at positionaIndex
in this route, counting in positive direction and starting from 0 for the start node. -
getStartNode
Description copied from interface:ILcdRoute
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. This is not necessarily the same asroute.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 toroute.getEdge(0).getEndNode()
.- Specified by:
getStartNode
in interfaceILcdRoute<N,
E> - Returns:
- the start
Object
of this route.
-
getEndNode
Description copied from interface:ILcdRoute
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. This is not necessarily the same asroute.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 toroute.getEdge(route.getEdgeCount-1).getStartNode()
.- Specified by:
getEndNode
in interfaceILcdRoute<N,
E> - Returns:
- the end
Object
of this route.
-
toString
Returns a general description of this route, as a sequence of all edges in this route. The exact details of the representation are unspecified and are subject to change. -
equals
-
hashCode
public int hashCode()
-