Index: src/Common/NetTopologySuite/Noding/OrientedCoordinateArray.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/NetTopologySuite/Noding/OrientedCoordinateArray.cs (.../OrientedCoordinateArray.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/NetTopologySuite/Noding/OrientedCoordinateArray.cs (.../OrientedCoordinateArray.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -9,8 +9,8 @@ /// public class OrientedCoordinateArray : IComparable { - private ICoordinate[] pts = null; - private bool orientation = false; + private readonly ICoordinate[] pts = null; + private readonly bool orientation = false; /// /// Creates a new } @@ -24,19 +24,6 @@ } /// - /// Computes the canonical orientation for a coordinate array. - /// - /// - /// - /// true if the points are oriented forwards, or - /// falseif the points are oriented in reverse. - /// - private static bool Orientation(ICoordinate[] pts) - { - return CoordinateArrays.IncreasingDirection(pts) == 1; - } - - /// /// Compares two s for their relative order. /// /// @@ -48,10 +35,23 @@ public int CompareTo(object o1) { OrientedCoordinateArray oca = (OrientedCoordinateArray) o1; - return CompareOriented(pts, orientation, oca.pts, oca.orientation); + return CompareOriented(pts, orientation, oca.pts, oca.orientation); } /// + /// Computes the canonical orientation for a coordinate array. + /// + /// + /// + /// true if the points are oriented forwards, or + /// falseif the points are oriented in reverse. + /// + private static bool Orientation(ICoordinate[] pts) + { + return CoordinateArrays.IncreasingDirection(pts) == 1; + } + + /// /// /// /// @@ -67,24 +67,32 @@ int limit2 = orientation2 ? pts2.Length : -1; int i1 = orientation1 ? 0 : pts1.Length - 1; - int i2 = orientation2 ? 0 : pts2.Length - 1; + int i2 = orientation2 ? 0 : pts2.Length - 1; while (true) { int compPt = pts1[i1].CompareTo(pts2[i2]); if (compPt != 0) + { return compPt; + } i1 += dir1; i2 += dir2; bool done1 = i1 == limit1; bool done2 = i2 == limit2; - if(done1 && !done2) + if (done1 && !done2) + { return -1; - if(!done1 && done2) + } + if (!done1 && done2) + { return 1; - if(done1 && done2) + } + if (done1 && done2) + { return 0; + } } } } -} +} \ No newline at end of file