public static class Coordinate.DimensionalComparator extends Object implements Comparator<Coordinate>
Coordinates, 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
Coordinates along to the number of
dimensions specified. |
static int |
compare(double a,
double b)
Compare two
doubles, allowing for NaN values. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic DimensionalComparator()
public DimensionalComparator(int dimensionsToTest)
dimensionsToTest - the number of dimensions to testpublic static int compare(double a,
double b)
doubles, allowing for NaN values.
NaN is treated as being less than any valid number.a - a doubleb - a doublepublic int compare(Coordinate c1, Coordinate c2)
Coordinates along to the number of
dimensions specified.compare in interface Comparator<Coordinate>c1 - a Coordinatec2 - a {link Coordinate}Copyright © 2024. All rights reserved.