Class TLcdRoute<N,E>

java.lang.Object
com.luciad.network.graph.route.TLcdRoute<N,E>
All Implemented Interfaces:
ILcdRoute<N,E>

public class TLcdRoute<N,E> extends Object implements ILcdRoute<N,E>
Default implementation of ILcdRoute.
Since:
5.1
  • Constructor Summary

    Constructors
    Constructor
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEdgeAtEnd(E aEdge)
    Adds an edge to the end of the route.
    void
    Adds an edge in front of the start of the route.
    boolean
     
    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
    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 position aIndex 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
     
    Returns a general description of this route, as a sequence of all edges in this route.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TLcdRoute

      public 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.
      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

      public void addEdgeAtEnd(E aEdge)
      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 is null.
    • addEdgeAtStart

      public void addEdgeAtStart(E aEdge)
      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 is null.
    • 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 interface ILcdRoute<N,E>
      Returns:
      the number of edges in this route.
    • getEdge

      public E getEdge(int aIndex)
      Description copied from interface: ILcdRoute
      Returns the edge at position aIndex in this route, counting in positive direction and starting from 0 for the first edge.
      Specified by:
      getEdge in interface ILcdRoute<N,E>
      Parameters:
      aIndex - the index of the edge in the route.
      Returns:
      the edge with the given index in this route.
    • 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 interface ILcdRoute<N,E>
      Returns:
      the number of nodes in this route.
    • getNode

      public N getNode(int aIndex)
      Description copied from interface: ILcdRoute
      Returns the node at position aIndex in this route, counting in positive direction and starting from 0 for the start node.
      Specified by:
      getNode in interface ILcdRoute<N,E>
      Parameters:
      aIndex - the index of the node in the route.
      Returns:
      the node with the given index in this route.
    • getStartNode

      public N 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 as 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().
      Specified by:
      getStartNode in interface ILcdRoute<N,E>
      Returns:
      the start Object of this route.
    • getEndNode

      public N 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 as 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().
      Specified by:
      getEndNode in interface ILcdRoute<N,E>
      Returns:
      the end Object of this route.
    • toString

      public String 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.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object