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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEdgeAtEnd(E aEdge) Adds an edge to the end of the route.voidaddEdgeAtStart(E aEdge) Adds an edge in front of the start of the route.booleangetEdge(int aIndex) Returns the edge at positionaIndexin this route, counting in positive direction and starting from 0 for the first edge.intReturns 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 positionaIndexin this route, counting in positive direction and starting from 0 for the start node.intReturns 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.inthashCode()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:ILcdRouteReturns the number of edges in this route. Edges which are passed multiple times, are counted as many times as they are passed.- Specified by:
getEdgeCountin interfaceILcdRoute<N,E> - Returns:
- the number of edges in this route.
-
getEdge
Description copied from interface:ILcdRouteReturns the edge at positionaIndexin this route, counting in positive direction and starting from 0 for the first edge. -
getNodeCount
public int getNodeCount()Description copied from interface:ILcdRouteReturns 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:
getNodeCountin interfaceILcdRoute<N,E> - Returns:
- the number of nodes in this route.
-
getNode
Description copied from interface:ILcdRouteReturns the node at positionaIndexin this route, counting in positive direction and starting from 0 for the start node. -
getStartNode
Description copied from interface:ILcdRouteReturns 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:
getStartNodein interfaceILcdRoute<N,E> - Returns:
- the start
Objectof this route.
-
getEndNode
Description copied from interface:ILcdRouteReturns 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:
getEndNodein interfaceILcdRoute<N,E> - Returns:
- the end
Objectof 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()
-