Package lejos.robotics.pathfinding
Class DijkstraPathFinder.Node
- java.lang.Object
-
- lejos.robotics.pathfinding.DijkstraPathFinder.Node
-
- Enclosing class:
- DijkstraPathFinder
protected class DijkstraPathFinder.Node extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.util.ArrayList<DijkstraPathFinder.Node>_blockedprotected Point_pprotected DijkstraPathFinder.Node_predecessorprotected float_sourceDistance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanatEndOfLine(Line theLine)test if this Node is one of the ends of theLinevoidblock(DijkstraPathFinder.Node aNode)add aNode to list of nodes not a neighbour of this NodefloatgetDistance(Point aPoint)get the straight line distance from this node to aPointfloatgetDistance(DijkstraPathFinder.Node aNode)return the straight distance from this node to aNodePointgetLocation()return the location of this nodeDijkstraPathFinder.NodegetPredecessor()get the predecessor of this node in the shortest path from the startfloatgetSourceDistance()return the shortest path length to this node from the start nodefloatgetX()get the X coordinate of this nodefloatgetY()get the Y coordinate of thes NodevoidsetPredecessor(DijkstraPathFinder.Node thePredecessor)set the predecessor of this node in the shortest path from the start nodevoidsetSourceDistance(float theDistance)set the distance of this Node from the sourcejava.lang.StringtoString()
-
-
-
Field Detail
-
_p
protected Point _p
-
_sourceDistance
protected float _sourceDistance
-
_predecessor
protected DijkstraPathFinder.Node _predecessor
-
_blocked
public java.util.ArrayList<DijkstraPathFinder.Node> _blocked
-
-
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:
toStringin classjava.lang.Object
-
-