Class DijkstraPathFinder.Node

  • Enclosing class:
    DijkstraPathFinder

    protected class DijkstraPathFinder.Node
    extends java.lang.Object
    • Constructor Detail

      • Node

        public Node​(Point p)
      • Node

        public Node​(float x,
                    float y)
    • Method Detail

      • atEndOfLine

        public boolean atEndOfLine​(Line theLine)
        test if this Node is one of the ends of theLine
        Parameters:
        theLine - endpoints to check
        Returns:
        true if this node is an end of the line
      • setSourceDistance

        public void setSourceDistance​(float theDistance)
        set the distance of this Node from the source
        Parameters:
        theDistance -
      • getSourceDistance

        public float getSourceDistance()
        return the shortest path length to this node from the start node
        Returns:
        shortest distance
      • getDistance

        public float getDistance​(Point aPoint)
        get the straight line distance from this node to aPoint
        Parameters:
        aPoint -
        Returns:
        the distance
      • getDistance

        public float getDistance​(DijkstraPathFinder.Node aNode)
        return the straight distance from this node to aNode
        Parameters:
        aNode -
        Returns:
        the distance
      • getLocation

        public Point getLocation()
        return the location of this node
        Returns:
        the location
      • block

        public void block​(DijkstraPathFinder.Node aNode)
        add aNode to list of nodes not a neighbour of this Node
        Parameters:
        aNode -
      • setPredecessor

        public void setPredecessor​(DijkstraPathFinder.Node thePredecessor)
        set the predecessor of this node in the shortest path from the start node
        Parameters:
        thePredecessor -
      • getPredecessor

        public DijkstraPathFinder.Node getPredecessor()
        get the predecessor of this node in the shortest path from the start
        Returns:
        the predecessor node
      • getX

        public float getX()
        get the X coordinate of this node
        Returns:
        X coordinate
      • getY

        public float getY()
        get the Y coordinate of thes Node
        Returns:
        Y coordinate
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object