private void checkNoSelfIntersectingRing(EdgeIntersectionList eiList){
  Set nodeSet=new TreeSet();
  boolean isFirst=true;
  for (Iterator i=eiList.iterator(); i.hasNext(); ) {
    EdgeIntersection ei=(EdgeIntersection)i.next();
    if (isFirst) {
      isFirst=false;
      continue;
    }
    if (nodeSet.contains(ei.coord)) {
      validErr=new TopologyValidationError(TopologyValidationError.RING_SELF_INTERSECTION,ei.coord);
      return;
    }
 else {
      nodeSet.add(ei.coord);
    }
  }
}

private void checkNoSelfIntersectingRing ( EdgeIntersectionList eiList ) { Set nodeSet = new TreeSet ( ) ; boolean isFirst = true ; for ( Iterator i = eiList . iterator ( ) ; i . hasNext ( ) ; ) { EdgeIntersection ei = ( EdgeIntersection ) i . next ( ) ; if ( isFirst ) { isFirst = false ; continue ; } if ( nodeSet . contains ( ei . coord ) ) { validErr = new TopologyValidationError ( TopologyValidationError . RING_SELF_INTERSECTION , ei . coord ) ; return ; } else { nodeSet . add ( ei . coord ) ; } } }
check that a ring does not self - intersect , except at its endpoints . algorithm is to count the number of times each node along edge occurs . if any occur more than once , that must be a self - intersection .
