Program: 86590
Project: 86590
Buggy source:
/** 
 * Generate the Delaunay's triangularization with a flip-flop algorithm. Mesh must have been set. Triangularization can only be done once. Otherwise call reprocessDelaunay
 * @throws DelaunayError
 */
public void processDelaunay() throws DelaunayError {
  if (isMeshComputed())   throw new DelaunayError(DelaunayError.DelaunayError_Generated);
 else   if (getNbPoints() < 3)   throw new DelaunayError(DelaunayError.DelaunayError_notEnoughPointsFound);
 else {
    boolean startedLocaly=false;
    if (startComputation == 0) {
      setStart();
      startedLocaly=true;
    }
    badEdgesQueueList=new LinkedList<MyEdge>();
    boundaryEdges=new LinkedList<MyEdge>();
    if (polygons.size() > 0) {
      if (verbose)       System.out.println("String_Node_Str" + polygons.size() + "String_Node_Str"+ (polygons.size() > 1 ? "String_Node_Str" : "String_Node_Str"));
      for (      MyPolygon aPolygon : polygons) {
        points.addAll(aPolygon.getPoints());
      }
    }
    if (verbose)     System.out.println("String_Node_Str");
    sortAndSimplify();
    if (verbose)     System.out.println("String_Node_Str");
    MyTriangle aTriangle;
    MyPoint p1, p2, p3;
    MyEdge e1, e2, e3;
    p1=p2=p3=null;
    ListIterator<MyPoint> iterPoint=points.listIterator();
    p1=iterPoint.next();
    while (p1.isMarked())     p1=iterPoint.next();
    p2=iterPoint.next();
    while (p2.isMarked())     p2=iterPoint.next();
    p3=iterPoint.next();
    while (p3.isMarked())     p3=iterPoint.next();
    e1=new MyEdge(p1,p2);
    if (e1.isLeft(p3)) {
      e2=new MyEdge(p2,p3);
      e3=new MyEdge(p3,p1);
    }
 else {
      e1.setStartPoint(p2);
      e1.setEndPoint(p1);
      e2=new MyEdge(p1,p3);
      e3=new MyEdge(p3,p2);
    }
    edges.add(e1);
    edges.add(e2);
    edges.add(e3);
    aTriangle=new MyTriangle(e1,e2,e3);
    triangles.add(aTriangle);
    boundaryEdges.add(e1);
    boundaryEdges.add(e2);
    boundaryEdges.add(e3);
    int count=0;
    while (iterPoint.hasNext()) {
      count++;
      MyPoint aPoint=iterPoint.next();
      if (!aPoint.isMarked()) {
        if (myInsertPoint(aPoint) == null)         System.out.println("String_Node_Str");
      }
    }
    meshComputed=true;
    pointsQuadTree=null;
    edgesQuadTree=null;
    if (verbose)     System.out.println("String_Node_Str");
    processEdges(constraintsEdges);
    if (polygons.size() > 0) {
      if (verbose)       System.out.println("String_Node_Str" + polygons.size() + "String_Node_Str"+ (polygons.size() > 1 ? "String_Node_Str" : "String_Node_Str"));
      processPolygons();
    }
    if (verbose)     System.out.println("String_Node_Str");
    setAllGids();
    if (verbose) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + points.size());
      System.out.println("String_Node_Str" + edges.size());
      System.out.println("String_Node_Str" + triangles.size());
    }
    if (startedLocaly)     setEnd();
  }
}

Fixed version (ground truth):
/** 
 * Generate the Delaunay's triangularization with a flip-flop algorithm. Mesh must have been set. Triangularization can only be done once. Otherwise call reprocessDelaunay
 * @throws DelaunayError
 */
public void processDelaunay() throws DelaunayError {
  if (isMeshComputed())   throw new DelaunayError(DelaunayError.DelaunayError_Generated);
 else   if (getNbPoints() < 3)   throw new DelaunayError(DelaunayError.DelaunayError_notEnoughPointsFound);
 else {
    boolean startedLocaly=false;
    if (startComputation == 0) {
      setStart();
      startedLocaly=true;
    }
    badEdgesQueueList=new LinkedList<MyEdge>();
    boundaryEdges=new LinkedList<MyEdge>();
    LinkedList<MyPoint> badPointList=new LinkedList<MyPoint>();
    if (polygons.size() > 0) {
      if (verbose)       System.out.println("String_Node_Str" + polygons.size() + "String_Node_Str"+ (polygons.size() > 1 ? "String_Node_Str" : "String_Node_Str"));
      for (      MyPolygon aPolygon : polygons) {
        points.addAll(aPolygon.getPoints());
      }
    }
    if (verbose)     System.out.println("String_Node_Str");
    sortAndSimplify();
    if (verbose)     System.out.println("String_Node_Str");
    MyTriangle aTriangle;
    MyPoint p1, p2, p3;
    MyEdge e1, e2, e3;
    p1=p2=p3=null;
    ListIterator<MyPoint> iterPoint=points.listIterator();
    p1=iterPoint.next();
    while (p1.isMarked())     p1=iterPoint.next();
    p2=iterPoint.next();
    while (p2.isMarked())     p2=iterPoint.next();
    e1=new MyEdge(p1,p2);
    p3=iterPoint.next();
    while (p3.isMarked())     p3=iterPoint.next();
    while ((e1.isColinear2D(p3)) && (iterPoint.hasNext())) {
      badPointList.add(p3);
      p3=iterPoint.next();
      while (p3.isMarked())       p3=iterPoint.next();
    }
    if (e1.isLeft(p3)) {
      e2=new MyEdge(p2,p3);
      e3=new MyEdge(p3,p1);
    }
 else {
      e1.setStartPoint(p2);
      e1.setEndPoint(p1);
      e2=new MyEdge(p1,p3);
      e3=new MyEdge(p3,p2);
    }
    edges.add(e1);
    edges.add(e2);
    edges.add(e3);
    aTriangle=new MyTriangle(e1,e2,e3);
    triangles.add(aTriangle);
    boundaryEdges.add(e1);
    boundaryEdges.add(e2);
    boundaryEdges.add(e3);
    boolean ended=false;
    MyPoint aPoint=null;
    MyPoint LastTestedPoint=null;
    int count=0;
    while (!ended) {
      boolean hasGotPoint=false;
      if (!badPointList.isEmpty()) {
        aPoint=badPointList.getFirst();
        if (LastTestedPoint != aPoint) {
          badPointList.removeFirst();
          hasGotPoint=true;
        }
      }
      if (!hasGotPoint)       if (iterPoint.hasNext()) {
        count++;
        aPoint=iterPoint.next();
      }
 else {
        ended=true;
        aPoint=null;
      }
      LastTestedPoint=aPoint;
      if (aPoint != null)       if (!aPoint.isMarked()) {
        if (myInsertPoint(aPoint) == null)         badPointList.addFirst(aPoint);
      }
    }
    meshComputed=true;
    pointsQuadTree=null;
    edgesQuadTree=null;
    if (verbose)     System.out.println("String_Node_Str");
    processEdges(constraintsEdges);
    if (polygons.size() > 0) {
      if (verbose)       System.out.println("String_Node_Str" + polygons.size() + "String_Node_Str"+ (polygons.size() > 1 ? "String_Node_Str" : "String_Node_Str"));
      processPolygons();
    }
    if (verbose)     System.out.println("String_Node_Str");
    setAllGids();
    if (verbose) {
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + points.size());
      System.out.println("String_Node_Str" + edges.size());
      System.out.println("String_Node_Str" + triangles.size());
    }
    if (startedLocaly)     setEnd();
  }
}