public class CoordinateSequenceComparator extends Object implements Comparator
CoordinateSequence
s.
For sequences of the same dimension, the ordering is lexicographic.
Otherwise, lower dimensions are sorted before higher.
The dimensions compared can be limited; if this is done
ordinate dimensions above the limit will not be compared.
If different behaviour is required for comparing size, dimension, or coordinate values, any or all methods can be overridden.
Modifier and Type | Field and Description |
---|---|
protected int |
dimensionLimit
The number of dimensions to test
|
Constructor and Description |
---|
CoordinateSequenceComparator()
Creates a comparator which will test all dimensions.
|
CoordinateSequenceComparator(int dimensionLimit)
Creates a comparator which will test only the specified number of dimensions.
|
Modifier and Type | Method and Description |
---|---|
static int |
compare(double a,
double b)
Compare two
double s, allowing for NaN values. |
int |
compare(Object o1,
Object o2)
Compares two
CoordinateSequence s for relative order. |
protected int |
compareCoordinate(CoordinateSequence s1,
CoordinateSequence s2,
int i,
int dimension)
Compares the same coordinate of two
CoordinateSequence s
along the given number of dimensions. |
clone, equals, finalize, 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 CoordinateSequenceComparator()
public CoordinateSequenceComparator(int dimensionLimit)
dimensionLimit
- 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(Object o1, Object o2)
CoordinateSequence
s for relative order.compare
in interface Comparator
o1
- a CoordinateSequence
o2
- a CoordinateSequence
protected int compareCoordinate(CoordinateSequence s1, CoordinateSequence s2, int i, int dimension)
CoordinateSequence
s
along the given number of dimensions.s1
- a CoordinateSequence
s2
- a CoordinateSequence
i
- the index of the coordinate to testdimension
- the number of dimensiosn to testCopyright © 2016. All rights reserved.