com.cuspy.pathfinder
Interface PathFinder

All Superinterfaces:
java.lang.Runnable
All Known Implementing Classes:
AbstractPathFinder

public interface PathFinder
extends java.lang.Runnable

The PathFinder interface is implemented by classes that provide a mechanism to find routes between nodes. A PathFinder is a Runnable so that you can use it either directly or as a Thread. To use it directly, just call findPath. This may take a while, so you may want to use it as a Thread. You do this by constructing the PathFinder, adding yourself as a PathListener, and then calling the start method. When the path has been found or all possible paths have been exhausted, a PathEvent will be sent.


Method Summary
 void abort()
          Abort the current path search.
 void addPathListener(PathListener l)
          Add a listener for PathEvents.
 java.util.List findPath()
          Find a path between the start and the goal Nodes.
 java.util.List getConsideredPath()
          Get the path currently being considered.
 void removePathListener(PathListener l)
          Remove a listener for PathEvents.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

findPath

public java.util.List findPath()
Find a path between the start and the goal Nodes.

Returns:
a List of Node elements.

abort

public void abort()
Abort the current path search. This only makes sense if you are using the threaded approach. The state of the pathfinder will be reset such that it is okay to call findPath again to start over.


getConsideredPath

public java.util.List getConsideredPath()
Get the path currently being considered. This only makes sense if you are using the threaded approach. It is only safe to call this after having received a considered PathEvent.

Returns:
a List of Nodes in the considered path.

addPathListener

public void addPathListener(PathListener l)
Add a listener for PathEvents.

Parameters:
l - the listener to add.

removePathListener

public void removePathListener(PathListener l)
Remove a listener for PathEvents.

Parameters:
l - the listener to remove.