CommonAlgorithmsFromCartAGen { public static ILineString openRingAtIndex(IRing ring, int index) { IDirectPositionList list = new DirectPositionList(); for (int i = index; i < ring.coord().size() - 1; i++) list.add(ring.coord().get(i)); for (int i = 0; i < index; i++) list.add(ring.coord().get(i)); return new GM_LineString(list); }  static IDirectPosition getNearestVertexFromPoint(IGeometry geom,
      IDirectPosition point); static int getNearestVertexPositionFromPoint(IGeometry geom,
      IDirectPosition point); static int getNearestVertexPositionBeforePoint(IGeometry geom,
      IDirectPosition point); static ILineString insertVertex(ILineString line,
      IDirectPosition newVertex); static ILineString insertVertex(ILineString line,
      IDirectPosition newVertex, double tolerance); static IPolygon insertVertex(IPolygon polygon,
      IDirectPosition newVertex); static IPolygon insertVertex(IPolygon polygon,
      IDirectPosition newVertex, double tolerance); static ILineString[] splitLine(ILineString line,
      IDirectPosition splitVertex, double tolerance); static IDirectPosition getNearestOtherVertexFromPoint(IGeometry geom,
      IDirectPosition point); static ILineSegment getNearestSegmentFromPoint(IGeometry geom,
      IDirectPosition point); static Vector2D rotateVector(Vector2D v, double angle); static double getOverlappingLength(IPolygon poly1, IPolygon poly2); static double getOverlappingLength(ILineString line, IPolygon poly); static double angleBetween2Lines(ILineString line1,
      ILineString line2); static Angle lineAbsoluteOrientation(ILineString line,
      IDirectPosition point); static int getNbCommonVertices(IGeometry geom1, IGeometry geom2); static LineConnectionInfo getLineConnectionInfo(ILineString line1,
      ILineString line2); static boolean isLineCrossingPolygon(ILineString line, IPolygon poly); static IGeometry geomColnUnion(Collection<IGeometry> geomColn); static IGeometry geomColnIntersection(Collection<IGeometry> geomColn); static double getSidelongMaxDist(IPolygon poly, double orientation); static IDirectPosition projection(IDirectPosition point,
      ILineString line, Vector2D direction); static IDirectPosition projectionOrtho(IDirectPosition point,
      ILineString line, Vector2D direction); static IPolygon getBiggerFromMultiSurface(
      IMultiSurface<IOrientableSurface> multi); static ILineString getLongestFromMultiCurve(
      IMultiCurve<IOrientableCurve> multi); static IPolygon getBiggerFromAggregate(IAggregate<IGeometry> aggr); static IDirectPosition getCommonVertexBetween2Lines(ILineString line1,
      ILineString line2); static Set<IRing> getIntersectingInnerRings(IPolygon multiRing,
      IGeometry geom); static IRing getContainingInnerRing(IPolygon multiRing,
      IGeometry geom); static ILineString displaceOneSide(ILineString line, boolean start,
      Vector2D displacementVector); static double getLineDistanceToIndex(ILineString line, int index); static double getLineDistanceBetweenIndexes(ILineString line,
      int index1, int index2); static ILineString getSubLine(ILineString line, IDirectPosition pt1,
      IDirectPosition pt2); static double getShortestEdgeLength(IGeometry geom); static double getEdgeLengthMedian(IGeometry geom); static Vector<Object> getPtMaxXFromLine(ILineString line); static Vector<Object> getPtMaxXFromPolygon(IPolygon line); static IDirectPosition getPtMaxDirFromLine(ILineString line,
      Angle theta); static IPolygon removeHoles(IPolygon polygon); static IPolygon removeSmallHoles(IPolygon polygon, double area); static ILineString getLongestInsideSegment(IPolygon polygon,
      double orientation); static ILineString getPolygonDiameter(IPolygon polygon); static boolean areLinesSameDirection(ILineString line,
      ILineString subLine); static ILineString openRingAtIndex(IRing ring, int index); static List<IDirectPosition> getSharpAngleVertices(IPolygon polygon,
      double maxAngle); static ILineString getMeanLine(ILineString line1, ILineString line2); static List<IDirectPosition> getSelfIntersections(ILineString line); static ILineString removeDuplicates(ILineString line);  }
@Test public void testOpenRingAtIndex() { IDirectPosition p1 = new DirectPosition(0.0, 0.0); IDirectPosition p2 = new DirectPosition(10.0, 0.0); IDirectPosition p3 = new DirectPosition(20.0, 0.0); IDirectPosition p4 = new DirectPosition(30.0, 5.0); IDirectPosition p5 = new DirectPosition(40.0, 10.0); IDirectPosition p6 = new DirectPosition(0.0, 10.0); IDirectPositionList list1 = new DirectPositionList(); list1.add(p1); list1.add(p2); list1.add(p3); list1.add(p4); list1.add(p5); list1.add(p6); list1.add(p1); IRing line1 = new GM_Ring(new GM_LineString(list1)); IDirectPositionList list2 = new DirectPositionList(); list2.add(p3); list2.add(p4); list2.add(p5); list2.add(p6); list2.add(p1); list2.add(p2); ILineString line2 = new GM_LineString(list2); Assert.assertTrue(line2.equals(CommonAlgorithmsFromCartAGen .openRingAtIndex(line1, 2))); }