compare static method
Compares two {@link CoordinateSequence}s for relative order.
@param o1 a {@link CoordinateSequence} @param o2 a {@link CoordinateSequence} @return -1, 0, or 1 depending on whether o1 is less than, equal to, or greater than o2
Implementation
static int compare(Object o1, Object o2, int dimensionLimit) {
CoordinateSequence s1 = o1 as CoordinateSequence;
CoordinateSequence s2 = o2 as CoordinateSequence;
int size1 = s1.size();
int size2 = s2.size();
int dim1 = s1.getDimension();
int dim2 = s2.getDimension();
int minDim = dim1;
if (dim2 < minDim) minDim = dim2;
bool dimLimited = false;
if (dimensionLimit <= minDim) {
minDim = dimensionLimit;
dimLimited = true;
}
// lower dimension is less than higher
if (!dimLimited) {
if (dim1 < dim2) return -1;
if (dim1 > dim2) return 1;
}
// lexicographic ordering of point sequences
int i = 0;
while (i < size1 && i < size2) {
int ptComp = compareCoordinate(s1, s2, i, minDim);
if (ptComp != 0) return ptComp;
i++;
}
if (i < size1) return 1;
if (i < size2) return -1;
return 0;
}