com.vividsolutions.jts.geom
Class Coordinate.DimensionalComparator
java.lang.Object
com.vividsolutions.jts.geom.Coordinate.DimensionalComparator
- Coordinate
- Comparator
public static class Coordinate.DimensionalComparator
extends java.lang.Object
implements Comparator
Compares two
Coordinate
s, allowing for either a 2-dimensional
or 3-dimensional comparison, and handling NaN values correctly.
int | compare(Object o1, Object o2) - Compares two
Coordinate s along to the number of
dimensions specified.
|
static int | compare(double a, double b) - Compare two
double s, allowing for NaN values.
|
DimensionalComparator
public DimensionalComparator()
Creates a comparator for 2 dimensional coordinates.
DimensionalComparator
public DimensionalComparator(int dimensionsToTest)
Creates a comparator for 2 or 3 dimensional coordinates, depending
on the value provided.
compare
public int compare(Object o1,
Object o2)
Compares two
Coordinate
s along to the number of
dimensions specified.
- -1, 0, or 1 depending on whether o1 is less than,
equal to, or greater than 02
compare
public static int compare(double a,
double b)
Compare two double
s, allowing for NaN values.
NaN is treated as being less than any valid number.
- -1, 0, or 1 depending on whether a is less than, equal to or greater than b