maths.functions.distances.DistanceCalculator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstat Show documentation
Show all versions of jstat Show documentation
Java Library for Statistical Analysis.
The newest version!
package maths.functions.distances;
import java.util.Comparator;
/**
* Some path finding algorithms like A* use heuristic functions
* in order to work. Often this heuristic may simply be the distance
* between two positions. This interface provides a common contract
* for distance claculation between two Points
*
*/
public interface DistanceCalculator {
/**
* Returns the distance between the two points
* @param p1 the first point
* @param p2 the second point
*/
ResultType calculate(final PointType p1, final PointType p2);
/**
* Initialize the min distance
*/
ResultType minValue();
/**
* Initialize the maximum distance
*/
ResultType maxValue();
/**
* Compare the two results
*/
ResultType compareMin(ResultType r1, ResultType r2);
/**
* Returns
* -1 if r1 less than r2
* 0 if r1 == r2
* 1 if r1 greater than r2
*/
int compare(ResultType r1, ResultType r2);
}