compareTo method
Compares this object with the specified object for order.
@param o the LineStringLocation
with which this Coordinate
is being compared
@return a negative integer, zero, or a positive integer as this LineStringLocation
is less than, equal to, or greater than the specified LineStringLocation
Implementation
int compareTo(dynamic o) {
LinearLocation other = o as LinearLocation;
// compare component indices
if (componentIndex < other.componentIndex) return -1;
if (componentIndex > other.componentIndex) return 1;
// compare segments
if (segmentIndex < other.segmentIndex) return -1;
if (segmentIndex > other.segmentIndex) return 1;
// same segment, so compare segment fraction
if (segmentFraction < other.segmentFraction) return -1;
if (segmentFraction > other.segmentFraction) return 1;
// same location
return 0;
}