cs252proj.api
Interface ClosestPointFinder
- public interface ClosestPointFinder
An interface for finding the closest pair of a set of points.
Method Summary |
void |
execute(jdsl.core.api.ObjectIterator oi)
Initializes the ClosestPointFinder with the given set of points. |
Point2DPair |
getClosestPoints()
Finds the closest pair of points in the container. |
execute
public void execute(jdsl.core.api.ObjectIterator oi)
- Initializes the ClosestPointFinder with the given set of points.
- Parameters:
oi
- an iterator over the set of points.- Throws:
java.lang.ClassCastException
- if an object in the iterator isn't a
Point2D.
getClosestPoints
public Point2DPair getClosestPoints()
throws java.lang.IllegalStateException
- Finds the closest pair of points in the container. If more than one
pair is equally closest, one such pair is chosen arbitrarily.
- Returns:
- a Point2DPair containing the closest points. Returns null if
no closest pair exists.
- Throws:
java.lang.IllegalStateException
- if execute() was not called first.