java.util.Comparator
public static class Coordinate.DimensionalComparator
extends java.lang.Object
implements java.util.Comparator
Coordinate
s, allowing for either a 2-dimensional
or 3-dimensional comparison, and handling NaN values correctly.Constructor | Description |
---|---|
DimensionalComparator() |
Creates a comparator for 2 dimensional coordinates.
|
DimensionalComparator(int dimensionsToTest) |
Creates a comparator for 2 or 3 dimensional coordinates, depending
on the value provided.
|
Modifier and Type | Method | Description |
---|---|---|
static int |
compare(double a,
double b) |
Compare two
double s, allowing for NaN values. |
int |
compare(java.lang.Object o1,
java.lang.Object o2) |
Compares two
Coordinate s along to the number of
dimensions specified. |
public DimensionalComparator()
public DimensionalComparator(int dimensionsToTest)
dimensionsToTest
- the number of dimensions to testpublic static int compare(double a, double b)
double
s, allowing for NaN values.
NaN is treated as being less than any valid number.a
- a double
b
- a double
public int compare(java.lang.Object o1, java.lang.Object o2)
Coordinate
s along to the number of
dimensions specified.compare
in interface java.util.Comparator
o1
- a Coordinate
o2
- a {link Coordinate}Copyright © 2018. All rights reserved.