public class CoordinateSequenceComparator extends Object implements Comparator
LineStrings.
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
doubles, allowing for NaN values. |
int |
compare(Object o1,
Object o2)
Compares two
LineStrings for relative order. |
protected int |
compareCoordinate(LineString s1,
LineString s2,
int i,
int dimension)
Compares the same coordinate of two
LineStrings
along the given number of dimensions. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequalspublic CoordinateSequenceComparator()
public CoordinateSequenceComparator(int dimensionLimit)
dimensionLimit - 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(Object o1, Object o2)
LineStrings for relative order.compare in interface Comparatoro1 - a LineStringo2 - a LineStringprotected int compareCoordinate(LineString s1, LineString s2, int i, int dimension)
LineStrings
along the given number of dimensions.s1 - a LineStrings2 - a LineStringi - the index of the coordinate to testdimension - the number of dimensiosn to testCopyright © 2015 Revolution Systems Inc.. All rights reserved.