cs252proj.api
Interface BarPathFinder
- public interface BarPathFinder
An interface for finding the shortest path between two points, avoiding
bar obstacles.
Method Summary |
void |
execute(jdsl.core.api.ObjectIterator oi)
Initializes the path finder with the given set of bars. |
jdsl.core.api.ObjectIterator |
findPath(jdsl.geomobj.api.Point2D p1,
jdsl.geomobj.api.Point2D p2)
Finds a path avoiding the bars. |
execute
public void execute(jdsl.core.api.ObjectIterator oi)
throws java.lang.ClassCastException
- Initializes the path finder with the given set of bars.
- Parameters:
oi
- an iterator over the bars- Throws:
java.lang.ClassCastException
- if one of the objects in the iterator is
not a Segment2D.java.lang.IllegalArgumentException
- if a bar does not have a certain
orientation (e.g. horizontal), specific
to the implementation of the
BarPathFinder.
findPath
public jdsl.core.api.ObjectIterator findPath(jdsl.geomobj.api.Point2D p1,
jdsl.geomobj.api.Point2D p2)
throws java.lang.IllegalStateException
- Finds a path avoiding the bars.
- Parameters:
p1
- the first point in the path.p2
- the last point in the path.- Returns:
- an iterator over the sequence of Point2Ds making up the path,
or null if no path exists.
- Throws:
java.lang.IllegalStateException
- if execute() was not called first.