minCoordinateIndexWithRange static method
Returns the index of the minimum coordinate of a part of the coordinate sequence (defined by {@code from} and {@code to}, using the usual lexicographic comparison.
@param seq the coordinate sequence to search
@param from the lower search index
@param to the upper search index
@return the index of the minimum coordinate in the sequence, found using compareTo
@see Coordinate#compareTo(Object)
Implementation
static int minCoordinateIndexWithRange(
CoordinateSequence seq, int from, int to) {
int minCoordIndex = -1;
Coordinate? minCoord;
for (int i = from; i <= to; i++) {
Coordinate testCoord = seq.getCoordinate(i);
if (minCoord == null || minCoord.compareTo(testCoord) > 0) {
minCoord = testCoord;
minCoordIndex = i;
}
}
return minCoordIndex;
}