Class Coordinate.DimensionalComparator

Hierarchy: Object , Coordinate.DimensionalComparator
All Implemented Interfaces: Comparator
public static class Coordinate.DimensionalComparator
implements Comparator
Compares two Coordinates, allowing for either a 2-dimensional or 3-dimensional comparison, and handling NaN values correctly.
public DimensionalComparator()
Creates a comparator for 2 dimensional coordinates.
public DimensionalComparator(int dimensionsToTest)
Creates a comparator for 2 or 3 dimensional coordinates, depending on the value provided.
Parameters:
dimensionsToTest - dimensionsToTest the number of dimensions to test
public static int compare(double a, double b)
Compare two doubles, allowing for NaN values. NaN is treated as being less than any valid number.
Parameters:
a - a a double
b - b a double
Returns:
-1, 0, or 1 depending on whether a is less than, equal to or greater than b
public int compare(Coordinate c1, Coordinate c2)
Compares two Coordinates along to the number of dimensions specified.
Parameters:
o1 - o1 a Coordinate
o2 - o2 a {link Coordinate}
Returns:
-1, 0, or 1 depending on whether o1 is less than, equal to, or greater than 02