/// <summary> /// Compares two <see cref="IBasicLineString" /> instances and returns a value indicating whether one is less than, equal to, or greater than the other. /// </summary> /// <param name="x">The first <see cref="IBasicLineString" /> to compare.</param> /// <param name="y">The second <see cref="IBasicLineString" /> to compare.</param> /// <returns>A signed integer that indicates the relative values of <paramref name="x" /> and <paramref name="y" />.</returns> /// <exception cref="System.ArgumentNullException"> /// The x argument is null. /// or /// The y argument is null. /// </exception> public Int32 Compare(IBasicLineString x, IBasicLineString y) { if (x == null) { throw new ArgumentNullException("x", "The x argument is null."); } if (y == null) { throw new ArgumentNullException("y", "The y argument is null."); } if (x == y) { return(0); } Int32 index = 0; // look for the first different coordinate in the linestring while (index < x.Count && index < y.Count) { Int32 comparison = _comparer.Compare(x.GetCoordinate(index), y.GetCoordinate(index)); if (comparison != 0) { return(comparison); } index++; } // check whether there are additional coordinates in either linestring if (index < x.Count) { return(1); } if (index < y.Count) { return(-1); } return(0); }