public static class Coordinate.DimensionalComparator extends Object implements Comparator<Coordinate>
Coordinate
s, allowing for either a 2-dimensional
or 3-dimensional comparison, and handling NaN values correctly.Constructor and 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 and Description |
---|---|
int |
compare(Coordinate c1,
Coordinate c2)
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. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
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(Coordinate c1, Coordinate c2)
Coordinate
s along to the number of
dimensions specified.compare
in interface Comparator<Coordinate>
c1
- a Coordinate
c2
- a {link Coordinate}Copyright © 2022. All rights reserved.