nus-yam/ex-repair huggingface dataset:
Program: 86549
Project: 86549
Buggy source:
/** 
 * The same goal as in testRefinementHeight, but in this case the point is on an edge of the mesh.
 * @throws DelaunayError 
 */
public void testRefinementHeightBis() throws DelaunayError {
  ConstrainedMesh mesh=new ConstrainedMesh();
  mesh.addPoint(new DPoint(0,2,0));
  mesh.addPoint(new DPoint(5,2,0));
  mesh.addPoint(new DPoint(2,4,10));
  mesh.addPoint(new DPoint(2,0,0));
  mesh.processDelaunay();
  int index=mesh.getTriangleList().indexOf(new DTriangle(new DPoint(2,4,10),new DPoint(2,0,0),new DPoint(0,2,0)));
  DTriangle tri=mesh.getTriangleList().get(index);
  mesh.insertTriangleCircumCenter(tri,false,0.2);
  assertTrue(mesh.getPoints().contains(new DPoint(2,2,5)));
  assertTrianglesTopology(mesh);
}

Fixed version (ground truth):
/** 
 * The same goal as in testRefinementHeight, but in this case the point is on an edge of the mesh.
 * @throws DelaunayError 
 */
public void testRefinementHeightBis() throws DelaunayError {
  ConstrainedMesh mesh=new ConstrainedMesh();
  mesh.addPoint(new DPoint(0,2,0));
  mesh.addPoint(new DPoint(5,2,0));
  mesh.addPoint(new DPoint(2,4,10));
  mesh.addPoint(new DPoint(2,0,0));
  mesh.processDelaunay();
  assertTrianglesTopology(mesh);
  int index=mesh.getTriangleList().indexOf(new DTriangle(new DPoint(2,4,10),new DPoint(2,0,0),new DPoint(0,2,0)));
  DTriangle tri=mesh.getTriangleList().get(index);
  mesh.insertTriangleCircumCenter(tri,false,0.2);
  assertTrue(mesh.getPoints().contains(new DPoint(2,2,5)));
  assertTrianglesTopology(mesh);
}
Program: 86550
Project: 86550
Buggy source:
/** 
 * This method reverts the first step of a point insertion in the mesh, when this insertion occurs on an edge of a triangle. <br/> Note that we need to decrease the edge, triangle and point GIDs, and  to remove the elements we don't need from each data structure.
 * @param ed
 * @param forget
 * @param extremity
 * @param leftLast
 * @param rightLast
 * @throws DelaunayError 
 */
void revertPointOnEdgeInsertion(DEdge ed,DPoint forget,DPoint extremity,DEdge leftLast,DEdge rightLast) throws DelaunayError {
  DTriangle left=ed.getLeft();
  DTriangle right=ed.getRight();
  DPoint st;
  ed.setEndPoint(extremity);
  st=ed.getStartPoint();
  if (left != null) {
    rebuildTriangleOEI(left,st,leftLast);
    edges.remove(edges.size() - 1);
    edgeGID--;
    triangleList.remove(triangleList.size() - 1);
    triangleGID--;
  }
  edges.remove(edges.size() - 1);
  edgeGID--;
  if (right != null) {
    edges.remove(edges.size() - 1);
    edgeGID--;
    triangleList.remove(triangleList.size() - 1);
    triangleGID--;
  }
  points.remove(points.size() - 1);
  pointGID--;
}

Fixed version (ground truth):
/** 
 * This method reverts the first step of a point insertion in the mesh, when this insertion occurs on an edge of a triangle. <br/> Note that we need to decrease the edge, triangle and point GIDs, and  to remove the elements we don't need from each data structure.
 * @param ed
 * @param forget
 * @param extremity
 * @param leftLast
 * @param rightLast
 * @throws DelaunayError 
 */
void revertPointOnEdgeInsertion(DEdge ed,DPoint forget,DPoint extremity,DEdge leftLast,DEdge rightLast) throws DelaunayError {
  DTriangle left=ed.getLeft();
  DTriangle right=ed.getRight();
  DPoint st;
  ed.setEndPoint(extremity);
  st=ed.getStartPoint();
  if (left != null) {
    rebuildTriangleOEI(left,st,leftLast);
    edges.remove(edges.size() - 1);
    edgeGID--;
    triangleList.remove(triangleList.size() - 1);
    triangleGID--;
  }
  edges.remove(edges.size() - 1);
  edgeGID--;
  if (right != null) {
    rebuildTriangleOEI(right,st,rightLast);
    edges.remove(edges.size() - 1);
    edgeGID--;
    triangleList.remove(triangleList.size() - 1);
    triangleGID--;
  }
  points.remove(points.size() - 1);
  pointGID--;
}
Program: 86552
Project: 86552
Buggy source:
/** 
 * Method that revert a point insertion in a triangle (but not on one of its edges). We need the reference to the triangle, the inserted point, and the former third point of the triangle.<br/> Note that we need to decrease the edge, triangle and point GIDs, and  to remove the elements we don't need from each data structure.
 * @param dt
 * @param forget
 * @param apex 
 */
final void revertPointInTriangleInsertion(DTriangle dt,DPoint forget,DPoint apex) throws DelaunayError {
  DEdge perm=dt.getOppositeEdge(forget);
  DEdge mod=dt.getOppositeEdge(perm.getStartPoint());
  if (forget.equals(mod.getStartPoint())) {
    mod.setStartPoint(apex);
  }
 else {
    mod.setEndPoint(apex);
  }
  mod=dt.getOppositeEdge(perm.getEndPoint());
  if (forget.equals(mod.getStartPoint())) {
    mod.setStartPoint(apex);
  }
 else {
    mod.setEndPoint(apex);
  }
  dt.recomputeCenter();
  points.remove(points.size() - 1);
  edges.remove(edges.size() - 1);
  edges.remove(edges.size() - 1);
  edges.remove(edges.size() - 1);
  triangleList.remove(triangleList.size() - 1);
  triangleList.remove(triangleList.size() - 1);
  forceCoherence(dt);
}

Fixed version (ground truth):
/** 
 * Method that revert a point insertion in a triangle (but not on one of its edges). We need the reference to the triangle, the inserted point, and the former third point of the triangle.<br/> Note that we need to decrease the edge, triangle and point GIDs, and  to remove the elements we don't need from each data structure.
 * @param dt
 * @param forget
 * @param apex 
 */
final void revertPointInTriangleInsertion(DTriangle dt,DPoint forget,DPoint apex,DEdge o1,DEdge o2) throws DelaunayError {
  DEdge perm=dt.getOppositeEdge(forget);
  DEdge mod=dt.getOppositeEdge(perm.getStartPoint());
  int index=dt.getEdgeIndex(mod);
  int index2=dt.getEdgeIndex(dt.getOppositeEdge(perm.getEndPoint()));
  if (o1.contains(perm.getStartPoint())) {
    dt.setEdge(index,o2);
    dt.setEdge(index2,o1);
  }
 else {
    dt.setEdge(index,o1);
    dt.setEdge(index2,o2);
  }
  dt.recomputeCenter();
  points.remove(points.size() - 1);
  edges.remove(edges.size() - 1);
  edges.remove(edges.size() - 1);
  edges.remove(edges.size() - 1);
  triangleList.remove(triangleList.size() - 1);
  triangleList.remove(triangleList.size() - 1);
  forceCoherence(dt);
}
Program: 86553
Project: 86553
Buggy source:
/** 
 * Process the flip-flap algorithm on the list of triangles
 */
private void processBadEdges() throws DelaunayError {
  LinkedList<DEdge> alreadySeen=new LinkedList<DEdge>();
  while (!badEdgesQueueList.isEmpty()) {
    DEdge anEdge=badEdgesQueueList.remove(0);
    boolean doIt=!anEdge.isLocked() && !alreadySeen.contains(anEdge);
    if (doIt) {
      alreadySeen.add(anEdge);
      DTriangle aTriangle1=anEdge.getLeft();
      DTriangle aTriangle2=anEdge.getRight();
      if (swapTriangle(anEdge)) {
        LinkedList<DEdge> others=new LinkedList<DEdge>();
        others.add(aTriangle1.getOppositeEdge(anEdge.getStartPoint()));
        others.add(aTriangle1.getOppositeEdge(anEdge.getEndPoint()));
        others.add(aTriangle2.getOppositeEdge(anEdge.getStartPoint()));
        others.add(aTriangle2.getOppositeEdge(anEdge.getEndPoint()));
        for (        DEdge ed : others) {
          if (ed.getLeft() != null && ed.getRight() != null && !badEdgesQueueList.contains(ed)) {
            badEdgesQueueList.add(ed);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process the flip-flap algorithm on the list of triangles
 */
private void processBadEdges() throws DelaunayError {
  LinkedList<DEdge> alreadySeen=new LinkedList<DEdge>();
  while (!badEdgesQueueList.isEmpty()) {
    DEdge anEdge=badEdgesQueueList.remove(0);
    boolean doIt=!anEdge.isLocked() && !alreadySeen.contains(anEdge);
    if (doIt) {
      alreadySeen.add(anEdge);
      if (swapTriangle(anEdge)) {
        LinkedList<DEdge> others=new LinkedList<DEdge>();
        DTriangle aTriangle1=anEdge.getLeft();
        DTriangle aTriangle2=anEdge.getRight();
        others.add(aTriangle1.getOppositeEdge(anEdge.getStartPoint()));
        others.add(aTriangle1.getOppositeEdge(anEdge.getEndPoint()));
        others.add(aTriangle2.getOppositeEdge(anEdge.getStartPoint()));
        others.add(aTriangle2.getOppositeEdge(anEdge.getEndPoint()));
        for (        DEdge ed : others) {
          if (ed.getLeft() != null && ed.getRight() != null && !badEdgesQueueList.contains(ed)) {
            badEdgesQueueList.add(ed);
          }
        }
      }
    }
  }
}
Program: 86555
Project: 86555
Buggy source:
/** 
 * This method performs the revertible insertion of a point on an edge of the mesh. It first remember all the elemnts that could be needed to revert all the operations.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertOnEdgeRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge contEdge=container.getContainingEdge(pt);
  DTriangle left=contEdge.getLeft();
  DEdge memleft=null;
  DPoint memExt=contEdge.getEnd();
  if (left != null) {
    memleft=left.getOppositeEdge(contEdge.getStartPoint());
  }
  DTriangle right=contEdge.getRight();
  DEdge memright=null;
  if (right != null) {
    memright=right.getOppositeEdge(contEdge.getStartPoint());
  }
  ret=initPointOnEdge(pt,contEdge,badEdges);
  if (ret != null) {
    revertPointOnEdgeInsertion(contEdge,pt,memExt,memleft,memright);
  }
  ret=revertibleSwapping(badEdges,swapMem);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    if (contEdge.getStartPoint().equals(pt)) {
      contEdge.swap();
    }
    revertPointOnEdgeInsertion(contEdge,pt,memExt,memleft,memright);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * This method performs the revertible insertion of a point on an edge of the mesh. It first remember all the elemnts that could be needed to revert all the operations.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertOnEdgeRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge contEdge=container.getContainingEdge(pt);
  if (contEdge.isLocked() || contEdge.getLeft() == null || contEdge.getRight() == null) {
    return contEdge;
  }
  DTriangle left=contEdge.getLeft();
  DEdge memleft=null;
  DPoint memExt=contEdge.getEnd();
  if (left != null) {
    memleft=left.getOppositeEdge(contEdge.getStartPoint());
  }
  DTriangle right=contEdge.getRight();
  DEdge memright=null;
  if (right != null) {
    memright=right.getOppositeEdge(contEdge.getStartPoint());
  }
  ret=initPointOnEdge(pt,contEdge,badEdges);
  if (ret != null) {
    revertPointOnEdgeInsertion(contEdge,pt,memExt,memleft,memright);
    return ret;
  }
  ret=revertibleSwapping(badEdges,swapMem);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    if (contEdge.getStartPoint().equals(pt)) {
      contEdge.swap();
    }
    revertPointOnEdgeInsertion(contEdge,pt,memExt,memleft,memright);
  }
  return ret;
}
Program: 86556
Project: 86556
Buggy source:
/** 
 * This method performs the revertible insertion of a point in a triangle of the mesh. It first remember all the elements that will be needed to finalize the  reversion of the insertion, and then try it.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertInTriangleRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge eMem0=container.getEdge(0);
  DEdge eMem1=container.getEdge(1);
  DEdge eMem2=container.getEdge(2);
  DPoint mem=container.getOppositePoint(eMem0);
  ret=initPointInTriangle(pt,container,badEdges);
  if (ret != null) {
    revertPointInTriangleInsertion(container,pt,mem);
    return ret;
  }
  ret=revertibleSwapping(badEdges,swapMem);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    if (!container.belongsTo(pt)) {
      eMem0.deepSwap();
    }
    checkMemEdges(eMem1,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    checkMemEdges(eMem2,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    revertPointInTriangleInsertion(container,pt,mem);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * This method performs the revertible insertion of a point in a triangle of the mesh. It first remember all the elements that will be needed to finalize the  reversion of the insertion, and then try it.<br/> Our goal here is to fail fast : as soon as we find an encroached edge, we stop our process and we revert our operations.
 * @param container
 * @param pt
 * @return
 * @throws DelaunayError 
 */
private DEdge insertInTriangleRevertible(DTriangle container,DPoint pt) throws DelaunayError {
  LinkedList<DEdge> badEdges=new LinkedList<DEdge>();
  Deque<DEdge> swapMem=new LinkedList<DEdge>();
  DEdge ret;
  DEdge eMem0=container.getEdge(0);
  DEdge eMem1=container.getEdge(1);
  DEdge eMem2=container.getEdge(2);
  DPoint mem=container.getOppositePoint(eMem0);
  ret=initPointInTriangle(pt,container,badEdges);
  if (ret != null) {
    revertPointInTriangleInsertion(container,pt,mem,eMem1,eMem2);
    return ret;
  }
  ret=revertibleSwapping(badEdges,swapMem);
  if (ret != null) {
    Iterator<DEdge> it=swapMem.descendingIterator();
    proceedSwaps(it);
    if (!container.belongsTo(pt)) {
      eMem0.deepSwap();
    }
    checkMemEdges(eMem1,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    checkMemEdges(eMem2,pt,triangleList.get(triangleList.size() - 1),triangleList.get(triangleList.size() - 2));
    revertPointInTriangleInsertion(container,pt,mem,eMem1,eMem2);
  }
  return ret;
}
Program: 86560
Project: 86560
Buggy source:
public void testEdgesMorphologicalClassification() throws DelaunayError {
  ConstrainedMesh aMesh=new ConstrainedMesh();
  HydroNetwork HydroNetwork=new HydroNetwork(aMesh);
  aMesh.setPrecision(1.0e-3);
  aMesh.setVerbose(true);
  aMesh.setPoints(getPoints());
  aMesh.processDelaunay();
  HydroNetwork.morphologicalQualification();
  List<DEdge> edges=aMesh.getEdges();
  for (  DEdge myEdge : edges) {
    myEdge.getProperty();
  }
}

Fixed version (ground truth):
public void testEdgesMorphologicalClassification() throws DelaunayError {
  HydroNetwork aMesh=new HydroNetwork();
  aMesh.setPrecision(1.0e-3);
  aMesh.setVerbose(true);
  aMesh.setPoints(getPoints());
  aMesh.processDelaunay();
  aMesh.morphologicalQualification();
  List<DEdge> edges=aMesh.getEdges();
  for (  DEdge myEdge : edges) {
    myEdge.getProperty();
  }
}
Program: 86563
Project: 86563
Buggy source:
/** 
 * A simple try to retrieve a boundary part.
 * @throws DelaunayError
 */
public void testGetEligiblePartSimple() throws DelaunayError {
  Boundary bound=getExampleBoundary();
  List<BoundaryPart> elig=bound.getEligibleParts(new Point(9,6,0));
  assertTrue(elig.size() == 1);
  assertTrue(elig.get(0).getBoundaryEdges().size() == 1);
  assertTrue(elig.get(0).getBoundaryEdges().get(0).equals(new Edge(6,5,0,7,7,0)));
  assertTrue(elig.get(0).getConstraint().equals(new Edge(6,5,0,10,5,0)));
}

Fixed version (ground truth):
/** 
 * A simple try to retrieve a boundary part.
 * @throws DelaunayError
 */
public void testGetEligiblePartSimple() throws DelaunayError {
  Boundary bound=getExampleBoundary();
  List<BoundaryPart> elig=bound.getEligibleParts(new Point(9,6,0));
  assertTrue(elig.size() == 1);
  assertTrue(elig.get(0).getBoundaryEdges().size() == 1);
  assertTrue(elig.get(0).getBoundaryEdges().get(0).equals(new Edge(6,5,0,7,7,0)));
  assertTrue(elig.get(0).getConstraint().equals(new Edge(6,5,0,10,4,0)));
}
Program: 86569
Project: 86569
Buggy source:
/** 
 * This test represents a special configuration with 4 edges. They all intersect in a really small area, and that can cause some problems when computing thee intersection.
 * @throws DelaunayError
 */
public void testAnotherIntersection() throws DelaunayError {
  ConstrainedMesh mesh=new ConstrainedMesh();
  ArrayList<Edge> edges=new ArrayList<Edge>();
  edges.add(new Edge(3.055669878287226,73.03246145782423,0,43.70557626947108,35.35995458365234,0));
  edges.add(new Edge(3.2192640691458885,98.57692790324268,0,19.81947056963683,13.613537224055394,0));
  edges.add(new Edge(5.981788531239529,17.432917460384022,0,9.21484373199296,90.49887456765843,0));
  edges.add(new Edge(6.399806805909236,67.72788939942218,0,74.23296927832122,86.61091383261046,0));
  mesh.setConstraintEdges(edges);
  mesh.forceConstraintIntegrity();
  edges=new ArrayList<Edge>();
}

Fixed version (ground truth):
/** 
 * This test represents a special configuration with 4 edges. They all intersect in a really small area, and that can cause some problems when computing thee intersection.
 * @throws DelaunayError
 */
public void testAnotherIntersection() throws DelaunayError {
  ConstrainedMesh mesh=new ConstrainedMesh();
  ArrayList<Edge> edges=new ArrayList<Edge>();
  edges.add(new Edge(3.055669878287226,73.03246145782423,0,43.70557626947108,35.35995458365234,0));
  edges.add(new Edge(3.2192640691458885,98.57692790324268,0,19.81947056963683,13.613537224055394,0));
  edges.add(new Edge(5.981788531239529,17.432917460384022,0,9.21484373199296,90.49887456765843,0));
  edges.add(new Edge(6.399806805909236,67.72788939942218,0,74.23296927832122,86.61091383261046,0));
  mesh.setConstraintEdges(edges);
  mesh.forceConstraintIntegrity();
  List<Edge> edgesB=mesh.getConstraintEdges();
  assertTrue(edgesB.size() == 16);
}
Program: 86570
Project: 86570
Buggy source:
/** 
 * Retrieve the boundarypart that share the same right point as orig, starting at index in the boundary list. DOES NOT include orig in the returned set. DOES NOT return the first boundarypart that does not share the same right point as orig and that is upper than it in the boundary. The returned parts come in the order we would find them if we iterated overt the BoundaryParts of this boundary.
 * @param index
 * @param orig
 * @return
 */
private List<BoundaryPart> getUpperSameRightPoint(int index,BoundaryPart orig){
  Point point=orig.getConstraint().getPointLeft();
  List<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  BoundaryPart bp;
  for (int i=index + 1; i < boundary.size(); i++) {
    bp=boundary.get(i);
    if (bp.getConstraint().getPointRight().equals(point)) {
      ret.add(bp);
    }
 else {
      break;
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Retrieve the boundarypart that share the same right point as orig, starting at index in the boundary list. DOES NOT include orig in the returned set. DOES NOT return the first boundarypart that does not share the same right point as orig and that is upper than it in the boundary. The returned parts come in the order we would find them if we iterated overt the BoundaryParts of this boundary.
 * @param index
 * @param orig
 * @return
 */
private List<BoundaryPart> getUpperSameRightPoint(int index,BoundaryPart orig){
  Point point=orig.getConstraint().getPointRight();
  List<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  BoundaryPart bp;
  for (int i=index + 1; i < boundary.size(); i++) {
    bp=boundary.get(i);
    if (bp.getConstraint().getPointRight().equals(point)) {
      ret.add(bp);
    }
 else {
      break;
    }
  }
  return ret;
}
Program: 86572
Project: 86572
Buggy source:
/** 
 * Retrieve the boundarypart that share the same right point as orig, starting at index in the boundary list, and going in reverse order. Does NOT include orig in the returned set. DOES return the first boundarypart that does not share the same right point as orig and that is lower than it in the boundary. The returned parts come in the order we would find them if we iterated overt the BoundaryParts of this boundary.
 * @param index
 * @param orig
 * @return
 */
private List<BoundaryPart> getLowerSameRightPoint(int index,BoundaryPart orig){
  Point point=orig.getConstraint().getPointLeft();
  List<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  BoundaryPart bp;
  for (int i=index - 1; i >= 0; i--) {
    bp=boundary.get(i);
    if (bp.getConstraint().getPointRight().equals(point)) {
      ret.add(bp);
    }
 else {
      ret.add(bp);
      break;
    }
  }
  Collections.reverse(ret);
  return ret;
}

Fixed version (ground truth):
/** 
 * Retrieve the boundarypart that share the same right point as orig, starting at index in the boundary list, and going in reverse order. Does NOT include orig in the returned set. DOES return the first boundarypart that does not share the same right point as orig and that is lower than it in the boundary. The returned parts come in the order we would find them if we iterated overt the BoundaryParts of this boundary.
 * @param index
 * @param orig
 * @return
 */
private List<BoundaryPart> getLowerSameRightPoint(int index,BoundaryPart orig){
  Point point=orig.getConstraint().getPointRight();
  List<BoundaryPart> ret=new ArrayList<BoundaryPart>();
  BoundaryPart bp;
  for (int i=index - 1; i >= 0; i--) {
    bp=boundary.get(i);
    if (bp.getConstraint().getPointRight().equals(point)) {
      ret.add(bp);
    }
 else {
      ret.add(bp);
      break;
    }
  }
  Collections.reverse(ret);
  return ret;
}
Program: 86573
Project: 86573
Buggy source:
/** 
 * Get the eligible parts for a point that is lower than all the parts of the boundary
 */
public void testGetEligiblePartsLower() throws DelaunayError {
  Boundary bound=getExampleBoundary();
  List<BoundaryPart> elig=bound.getEligibleParts(new Point(8,-1,0));
  assertTrue(elig.size() == 1);
  Edge ed=elig.get(0).getBoundaryEdges().get(0);
  assertTrue(ed.equals(new Edge(0,1,0,3,2,0)));
}

Fixed version (ground truth):
/** 
 * Get the eligible parts for a point that is lower than all the parts of the boundary
 */
public void testGetEligiblePartsLower() throws DelaunayError {
  Boundary bound=getExampleBoundary();
  List<BoundaryPart> elig=bound.getEligibleParts(new Point(8,-1,0));
  assertTrue(elig.size() == 1);
  Edge ed=elig.get(0).getBoundaryEdges().get(0);
  assertTrue(ed.equals(new Edge(0,1,0,3,2,0)));
  assertNull(elig.get(0).getConstraint());
}
Program: 86577
Project: 86577
Buggy source:
/** 
 * check if two edges intersect
 * @param p1 the start point of the other edge
 * @param p2 the end point of the other edge
 * @return intersection :<br/>0 = no intersection<br/> 1 = intersect<br/> 2 = co-linear and don't intersect<br/> 3 = intersects at the extremity<br/> 4 = intersect in more than one point<br/> note that if on extremity of an edge lies inside the other edge, but is not one of the extremities of the other edge, this method returns 1
 */
public int intersects(MyPoint p1,MyPoint p2) throws DelaunayError {
  int result=0;
  MyPoint p3=this.startPoint;
  MyPoint p4=this.endPoint;
  MyElement inter=getIntersection(p1,p2,false);
  if (inter == null) {
    double a1=p2.getX() - p1.getX();
    double b1=p4.getX() - p3.getX();
    double a2=p2.getY() - p1.getY();
    double b2=p4.getY() - p3.getY();
    double d=b1 * a2 - b2 * a1;
    if (-MyTools.EPSILON < d && d < MyTools.EPSILON) {
      return 2;
    }
 else {
      return 0;
    }
  }
 else   if (inter instanceof MyPoint) {
    MyPoint interPoint=(MyPoint)inter;
    if ((interPoint.squareDistance2D(p1) < MyTools.EPSILON2 || interPoint.squareDistance2D(p2) < MyTools.EPSILON2) && (interPoint.squareDistance2D(p3) < MyTools.EPSILON2 || interPoint.squareDistance2D(p4) < MyTools.EPSILON2)) {
      return 3;
    }
 else {
      return 1;
    }
  }
 else   if (inter instanceof MyEdge) {
    return 4;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * check if two edges intersect
 * @param p1 the start point of the other edge
 * @param p2 the end point of the other edge
 * @return intersection :<br/>0 = no intersection<br/> 1 = intersect<br/> 2 = co-linear and don't intersect<br/> 3 = intersects at the extremity<br/> 4 = intersect in more than one point<br/> note that if on extremity of an edge lies inside the other edge, but is not one of the extremities of the other edge, this method returns 1
 */
public int intersects(MyPoint p1,MyPoint p2) throws DelaunayError {
  int result=0;
  MyPoint p3=this.startPoint;
  MyPoint p4=this.endPoint;
  MyElement inter=getIntersection(p1,p2,false);
  if (inter == null) {
    double a1=p2.getX() - p1.getX();
    double b1=p4.getX() - p3.getX();
    double a2=p2.getY() - p1.getY();
    double b2=p4.getY() - p3.getY();
    double d=b1 * a2 - b2 * a1;
    if (-MyTools.EPSILON2 < d && d < MyTools.EPSILON2) {
      return 2;
    }
 else {
      return 0;
    }
  }
 else   if (inter instanceof MyPoint) {
    MyPoint interPoint=(MyPoint)inter;
    if ((interPoint.squareDistance2D(p1) < MyTools.EPSILON2 || interPoint.squareDistance2D(p2) < MyTools.EPSILON2) && (interPoint.squareDistance2D(p3) < MyTools.EPSILON2 || interPoint.squareDistance2D(p4) < MyTools.EPSILON2)) {
      return 3;
    }
 else {
      return 1;
    }
  }
 else   if (inter instanceof MyEdge) {
    return 4;
  }
  return result;
}
Program: 86581
Project: 86581
Buggy source:
/** 
 * This method check that the vertical sort defined in MyEdge works well
 */
public void testVerticalSort() throws DelaunayError {
  MyEdge e1=new MyEdge(0,0,0,2,2,2);
  MyEdge e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == 0);
}

Fixed version (ground truth):
/** 
 * This method check that the vertical sort defined in MyEdge works well
 */
public void testVerticalSort() throws DelaunayError {
  MyEdge e1=new MyEdge(0,0,0,2,2,2);
  MyEdge e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == 0);
  e1=new MyEdge(0,0,0,2,3,2);
  e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == 1);
  assertTrue(e1.verticalSort(e2,0) == 1);
  e1=new MyEdge(1,8,0,2,3,2);
  e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == 1);
  assertTrue(e1.verticalSort(e2,0) == 1);
  e1=new MyEdge(0,0,0,3,3,2);
  e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == 1);
  assertTrue(e1.verticalSort(e2,0) == 1);
  e1=new MyEdge(-1,-1,0,2,2,2);
  e2=new MyEdge(0,0,0,2,2,2);
  assertTrue(e1.verticalSort(e2,1) == -1);
  assertTrue(e1.verticalSort(e2,0) == -1);
}
Program: 86583
Project: 86583
Buggy source:
/** 
 * Check if this==y, considering only the first two coordinates.
 * @param y
 * @return
 */
public boolean equals2D(MyPoint y){
  if (y == null) {
    return false;
  }
 else {
    return coord.equals2D(y.getCoordinate());
  }
}

Fixed version (ground truth):
/** 
 * Check if this==y, considering only the first two coordinates.
 * @param y
 * @return
 */
public boolean equals2D(MyPoint y){
  if (y == null) {
    return false;
  }
 else {
    return (coord.distance(y.getCoordinate()) < MyTools.EPSILON);
  }
}
Program: 86584
Project: 86584
Buggy source:
/** 
 * We override the equals method, as two points can be said equal when their coordinate are exactly the same
 * @param y
 * @return
 */
@Override public boolean equals(Object p){
  if (p instanceof MyPoint) {
    MyPoint y=(MyPoint)p;
    return coord.equals3D(y.getCoordinate());
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * We override the equals method, as two points can be said equal when their coordinate are exactly the same
 * @param y
 * @return
 */
@Override public boolean equals(Object p){
  if (p instanceof MyPoint) {
    MyPoint y=(MyPoint)p;
    double dist=coord.distance(y.getCoordinate()) + (coord.z - y.getZ()) * coord.z - y.getZ();
    return dist < MyTools.EPSILON2;
  }
 else {
    return false;
  }
}
Program: 86587
Project: 86587
Buggy source:
/** 
 * Get the triangle in which the point is
 * @param aPoint
 */
public MyTriangle getTriangle(MyPoint aPoint){
  MyTriangle foundTriangle=null;
  ListIterator<MyTriangle> iterTriangle=triangles.listIterator();
  while ((iterTriangle.hasNext()) && (foundTriangle == null)) {
    MyTriangle aTriangle=iterTriangle.next();
    if (aTriangle.isInside(aPoint)) {
      foundTriangle=aTriangle;
    }
  }
  return foundTriangle;
}

Fixed version (ground truth):
/** 
 * Get the triangle in which the point is
 * @param aPoint
 */
public MyTriangle getTriangle(MyPoint aPoint){
  MyTriangle foundTriangle=null;
  if (this.trianglesQuadTrees.canBeUsed()) {
    foundTriangle=this.trianglesQuadTrees.search(aPoint);
  }
 else {
    ListIterator<MyTriangle> iterTriangle=triangles.listIterator();
    while ((iterTriangle.hasNext()) && (foundTriangle == null)) {
      MyTriangle aTriangle=iterTriangle.next();
      if (aTriangle.isInside(aPoint)) {
        foundTriangle=aTriangle;
      }
    }
  }
  return foundTriangle;
}
Program: 86589
Project: 86589
Buggy source:
/** 
 * Create an empty Mesh. Allocate data structures
 */
public MyMesh(){
  this.points=new ArrayList<MyPoint>();
  this.pointsQuadTree=new MyQuadTreeMapper<MyPoint>();
  this.edges=new ArrayList<MyEdge>();
  this.triangles=new ArrayList<MyTriangle>();
  this.constraintsEdges=new ArrayList<MyEdge>();
  this.polygons=new LinkedList<MyPolygon>();
  this.maxx=1200;
  this.maxy=700;
  this.theBox=new MyBox();
  this.isBoundingBoxInit=false;
  this.meshComputed=false;
  this.point_GID=0;
  this.edge_GID=0;
  this.triangle_GID=0;
  this.precision=0.0;
  this.tolarence=0.000001;
  this.maxArea=600;
  this.minArea=1;
  this.minAngle=5;
  this.refinement=0;
  this.verbose=false;
  this.duration=0;
  this.affiche=null;
  this.displayCircles=false;
}

Fixed version (ground truth):
/** 
 * Create an empty Mesh. Allocate data structures
 */
public MyMesh(){
  this.points=new ArrayList<MyPoint>();
  this.pointsQuadTree=new MyQuadTreeMapper<MyPoint>();
  this.edges=new ArrayList<MyEdge>();
  this.edgesQuadTree=new MyQuadTreeMapper<MyEdge>();
  this.triangles=new ArrayList<MyTriangle>();
  this.trianglesQuadTrees=new MyQuadTreeMapper<MyTriangle>();
  this.constraintsEdges=new ArrayList<MyEdge>();
  this.polygons=new LinkedList<MyPolygon>();
  this.maxx=1200;
  this.maxy=700;
  this.theBox=new MyBox();
  this.isBoundingBoxInit=false;
  this.meshComputed=false;
  this.point_GID=0;
  this.edge_GID=0;
  this.triangle_GID=0;
  this.precision=0.0;
  this.tolarence=0.000001;
  this.maxArea=600;
  this.minArea=1;
  this.minAngle=5;
  this.refinement=0;
  this.verbose=false;
  this.duration=0;
  this.affiche=null;
  this.displayCircles=false;
}
Program: 86592
Project: 86592
Buggy source:
/** 
 * Add a new edge to the current triangularization. If Delaunay triangularization has not been done, it generates an error.
 * @param anEdge
 * @throws DelaunayError
 */
public void addEdge(MyEdge anEdge) throws DelaunayError {
  if (!isMeshComputed())   throw new DelaunayError(DelaunayError.DelaunayError_notGenerated);
 else   if (anEdge.getStartPoint().squareDistance(anEdge.getEndPoint()) < tolarence)   throw new DelaunayError(DelaunayError.DelaunayError_proximity);
 else   if (!points.contains(anEdge.getStartPoint()))   throw new DelaunayError(DelaunayError.DelaunayError_pointNotFound);
 else   if (!points.contains(anEdge.getEndPoint()))   throw new DelaunayError(DelaunayError.DelaunayError_pointNotFound);
 else {
    badEdgesQueueList=new LinkedList<MyEdge>();
    ArrayList<MyEdge> theList=new ArrayList<MyEdge>();
    theList.add(anEdge);
    processEdges(theList);
  }
}

Fixed version (ground truth):
/** 
 * Add a new edge to the current triangularization. If Delaunay triangularization has not been done, it generates an error.
 * @param anEdge
 * @throws DelaunayError
 */
public void addEdge(MyEdge anEdge) throws DelaunayError {
  if (!isMeshComputed())   throw new DelaunayError(DelaunayError.DelaunayError_notGenerated);
 else   if (anEdge.getStartPoint().squareDistance(anEdge.getEndPoint()) < tolarence)   throw new DelaunayError(DelaunayError.DelaunayError_proximity);
 else   if (!points.contains(anEdge.getStartPoint()))   throw new DelaunayError(DelaunayError.DelaunayError_pointNotFound);
 else   if (!points.contains(anEdge.getEndPoint()))   throw new DelaunayError(DelaunayError.DelaunayError_pointNotFound);
 else {
    badEdgesQueueList=new LinkedList<MyEdge>();
    ArrayList<MyEdge> theList=new ArrayList<MyEdge>();
    theList.add(anEdge);
    processEdges(theList);
    this.trianglesQuadTrees.cancelUsability();
  }
}
Program: 86593
Project: 86593
Buggy source:
public Point[] getTouches(){
synchronized (this) {
    if (mInput == null) {
      return mPoints;
    }
    int index=0;
    for (int k=0; k < mPointIndicesCount; k++) {
      int id=mPointIndices[k];
      for (int i=0; i < mInput.getPointerCount() && index < mPoints.length; i++) {
        if (mInput.getPointerId(i) == id) {
          mPoints[index].x=(int)mInput.getX(i);
          mPoints[index].y=(int)mInput.getY(i);
          index++;
          break;
        }
      }
    }
    return mPoints;
  }
}

Fixed version (ground truth):
public Point[] getTouches(){
  float xRatio=(float)PunkActivity.static_width / FP.displayWidth;
  float yRatio=(float)PunkActivity.static_height / FP.displayHeight;
synchronized (this) {
    if (mInput == null) {
      return mPoints;
    }
    int index=0;
    for (int k=0; k < mPointIndicesCount; k++) {
      int id=mPointIndices[k];
      for (int i=0; i < mInput.getPointerCount() && index < mPoints.length; i++) {
        if (mInput.getPointerId(i) == id) {
          mPoints[index].x=(int)(mInput.getX(i) * xRatio);
          mPoints[index].y=(int)(mInput.getY(i) * yRatio);
          index++;
          break;
        }
      }
    }
    return mPoints;
  }
}
Program: 86595
Project: 86595
Buggy source:
public APRenderer(){
  if (FP.debug) {
    Paint p=new Paint();
    int fpsWidth=(int)p.measureText("String_Node_Str");
    mFPS=new Text("String_Node_Str",0);
    mUpdate=new Text("String_Node_Str",0);
    mUpdate.x=fpsWidth + FP.dip(5);
    mRender=new Text("String_Node_Str",0);
    mRender.x=mUpdate.x;
    mRender.y=-p.ascent() + p.descent() + FP.dip(2);
    mDebug=new GraphicList(mFPS,mUpdate,mRender);
    mDebugUpdateCount=0;
  }
}

Fixed version (ground truth):
public APRenderer(){
  if (FP.debug) {
    Paint p=new Paint();
    int fpsWidth=(int)p.measureText("String_Node_Str");
    mFPS=new AtlasText("String_Node_Str",0);
    mUpdate=new AtlasText("String_Node_Str",0);
    mUpdate.x=fpsWidth + FP.dip(5);
    mRender=new AtlasText("String_Node_Str",0);
    mRender.x=mUpdate.x;
    mRender.y=-p.ascent() + p.descent() + FP.dip(2);
    mDebug=new GraphicList(mFPS,mUpdate,mRender);
    mDebugUpdateCount=0;
  }
}
Program: 86596
Project: 86596
Buggy source:
public void onSurfaceChanged(GL10 gl,int width,int height){
  Log.d(TAG,"String_Node_Str" + width + "String_Node_Str"+ height);
  mScreenRect.set(0,0,width,height);
  Engine.fire(Event.ADDED_TO_STAGE);
  float scaleX=(float)width / static_width;
  float scaleY=(float)height / static_height;
  final int viewportWidth=(int)(mScreenRect.width());
  final int viewportHeight=(int)(mScreenRect.height());
  gl.glViewport(0,0,viewportWidth,viewportHeight);
  gl.glScissor(0,0,viewportWidth,viewportHeight);
  mScaleX=scaleX;
  mScaleY=scaleY;
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glLoadIdentity();
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glLoadIdentity();
  gl.glOrthof(0,viewportWidth,viewportHeight,0,-1,1);
  gl.glScalef(mScaleX,mScaleY,0.0f);
  mStarted=true;
  OpenGLSystem.setGL(gl);
  OpenGLSystem.processQueue();
  OpenGLSystem.setGL(null);
}

Fixed version (ground truth):
public void onSurfaceChanged(GL10 gl,int width,int height){
  Log.d(TAG,"String_Node_Str" + width + "String_Node_Str"+ height);
  mScreenRect.set(0,0,width,height);
  FP.displayWidth=width;
  FP.displayHeight=height;
  Engine.fire(Event.ADDED_TO_STAGE);
  float scaleX=(float)width / static_width;
  float scaleY=(float)height / static_height;
  final int viewportWidth=(int)(mScreenRect.width());
  final int viewportHeight=(int)(mScreenRect.height());
  gl.glViewport(0,0,viewportWidth,viewportHeight);
  gl.glScissor(0,0,viewportWidth,viewportHeight);
  mScaleX=scaleX;
  mScaleY=scaleY;
  gl.glMatrixMode(GL10.GL_MODELVIEW);
  gl.glLoadIdentity();
  gl.glMatrixMode(GL10.GL_PROJECTION);
  gl.glLoadIdentity();
  gl.glOrthof(0,viewportWidth,viewportHeight,0,-1,1);
  gl.glScalef(mScaleX,mScaleY,0.0f);
  mStarted=true;
  OpenGLSystem.setGL(gl);
  OpenGLSystem.processQueue();
  OpenGLSystem.setGL(null);
}
Program: 86598
Project: 86598
Buggy source:
public void onDrawFrame(GL10 gl){
  OpenGLSystem.setGL(gl);
  mRenderTime=SystemClock.uptimeMillis();
synchronized (mUpdateLock) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    OpenGLSystem.processQueue(14);
    if (mEngine != null) {
      mEngine.render();
    }
    if (FP.debug) {
      if (mDebugUpdateCount % 30 == 0) {
        mFPS.setText(String.format("String_Node_Str",Math.min(FP.frameRate,60)));
        mUpdate.setText(String.format("String_Node_Str",FP.updateTime));
        mRender.setText(String.format("String_Node_Str",FP.renderTime));
        mDebugUpdateCount=0;
      }
      mDebugUpdateCount++;
      FP.point.set(0,0);
      mDebug.render(gl,FP.point,FP.point);
    }
  }
  FP.renderTime=SystemClock.uptimeMillis() - mRenderTime;
  OpenGLSystem.setGL(null);
}

Fixed version (ground truth):
public void onDrawFrame(GL10 gl){
  OpenGLSystem.setGL(gl);
  mRenderTime=SystemClock.uptimeMillis();
synchronized (mUpdateLock) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    OpenGLSystem.processQueue(14);
    if (mEngine != null) {
      mEngine.render();
    }
    if (FP.debug) {
      if (mDebugUpdateCount % 30 == 0) {
        mFPS.setText(String.format("String_Node_Str",Math.min(FP.frameRate,60)));
        mUpdate.setText(String.format("String_Node_Str",FP.updateTime));
        mRender.setText(String.format("String_Node_Str",FP.renderTime));
        mDebugUpdateCount=0;
      }
      mDebugUpdateCount++;
      FP.point.set(0,0);
      OpenGLSystem.processQueue(4);
      mDebug.render(gl,FP.point,FP.point);
    }
  }
  FP.renderTime=SystemClock.uptimeMillis() - mRenderTime;
  OpenGLSystem.setGL(null);
}
Program: 86599
Project: 86599
Buggy source:
protected void setMatrix(GL10 gl){
  float sX=scaleX * scale;
  float sY=scaleY * scale;
  gl.glTranslatef((originX * sX) + mPoint.x,(originY * sY) + mPoint.y,0f);
  if (angle != 0) {
    gl.glRotatef(angle,0,0,1.0f);
  }
  gl.glScalef(sX,sY,1.0f);
  gl.glTranslatef(-originX,-originY,0.0f);
}

Fixed version (ground truth):
protected void setMatrix(GL10 gl){
  float sX=scaleX * scale;
  float sY=scaleY * scale;
  gl.glTranslatef((originX * Math.abs(sX)) + mPoint.x,(originY * Math.abs(sY)) + mPoint.y,0f);
  if (angle != 0) {
    gl.glRotatef(angle,0,0,1.0f);
  }
  gl.glScalef(sX,sY,1.0f);
  gl.glTranslatef(-originX,-originY,0.0f);
}
Program: 86600
Project: 86600
Buggy source:
/** 
 * Thread-safe creation the texture.
 * @param gl the GL context.
 */
public void load(){
  mRect.set(0,0,mSource.getWidth(),mSource.getHeight());
  TextureLoadRunnable runnable=new TextureLoadRunnable(mSource);
  GL10 agl=OpenGLSystem.getGL();
  if (agl != null) {
    runnable.run(agl);
  }
 else {
    OpenGLSystem.postRunnable(runnable);
  }
}

Fixed version (ground truth):
/** 
 * Thread-safe creation the texture.
 * @param gl the GL context.
 */
public void load(){
  mRect.set(0,0,mSource.getWidth(),mSource.getHeight());
  TextureLoadRunnable runnable=new TextureLoadRunnable(mSource);
  OpenGLSystem.postRunnable(runnable);
}
Program: 86601
Project: 86601
Buggy source:
@Override public void event(){
  mTime=mGameTime=SystemClock.uptimeMillis();
  FP.javaTime=mTime - mJavaTime;
  mUpdateTime=mTime;
  FP.elapsed=(mTime - mLast) / 1000.0f;
  if (FP.elapsed > maxElapsed)   FP.elapsed=maxElapsed;
  FP.elapsed*=FP.rate;
  mLast=mTime;
  if (!paused)   update();
  Input.update();
  mTime=mRenderTime=SystemClock.uptimeMillis();
  FP.updateTime=mTime - mUpdateTime;
  mTime=mJavaTime=SystemClock.uptimeMillis();
  FP.renderTime=mTime - mRenderTime;
  FP.gameTime=mTime - mGameTime;
}

Fixed version (ground truth):
@Override public void event(){
  mTime=mGameTime=SystemClock.uptimeMillis();
  FP.javaTime=mTime - mJavaTime;
  mUpdateTime=mTime;
  FP.elapsed=(mTime - mLast) / 1000.0f;
  if (FP.elapsed > maxElapsed)   FP.elapsed=maxElapsed;
  FP.elapsed*=FP.rate;
  mLast=mTime;
  if (!paused)   update();
  Input.update();
  mTime=mRenderTime=SystemClock.uptimeMillis();
  FP.updateTime=mTime - mUpdateTime;
  mTime=mJavaTime=SystemClock.uptimeMillis();
  FP.gameTime=mTime - mGameTime;
}
Program: 86602
Project: 86602
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  FP.resources=getResources();
  FP.context=this;
  setContentView(R.layout.main);
  mSurfaceView=(GLSurfaceView)findViewById(R.id.surface_view);
  mSurfaceView.setOnTouchListener(this);
  mRenderer=new APRenderer();
  mSurfaceView.setRenderer(mRenderer);
  mSurfaceView.setDebugFlags(GLSurfaceView.DEBUG_CHECK_GL_ERROR);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  setVolumeControlStream(AudioManager.STREAM_MUSIC);
  mAudioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  FP.resources=getResources();
  FP.context=this;
  setContentView(R.layout.main);
  mSurfaceView=(GLSurfaceView)findViewById(R.id.surface_view);
  mSurfaceView.setOnTouchListener(this);
  mRenderer=new APRenderer();
  mSurfaceView.setRenderer(mRenderer);
  mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  setVolumeControlStream(AudioManager.STREAM_MUSIC);
  mAudioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
}
Program: 86603
Project: 86603
Buggy source:
public void onDrawFrame(GL10 gl){
  OpenGLSystem.setGL(gl);
synchronized (mUpdateLock) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    OpenGLSystem.processQueue(14);
    if (mEngine != null) {
      mEngine.render();
    }
  }
  OpenGLSystem.setGL(null);
}

Fixed version (ground truth):
public void onDrawFrame(GL10 gl){
  OpenGLSystem.setGL(gl);
  mRenderTime=SystemClock.uptimeMillis();
synchronized (mUpdateLock) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    OpenGLSystem.processQueue(14);
    if (mEngine != null) {
      gl.glScalef(mScaleX,mScaleY,0.0f);
      mEngine.render();
    }
    if (FP.debug) {
      if (mDebugUpdateCount % 30 == 0) {
        mFPS.setText(String.format("String_Node_Str",Math.min(FP.frameRate,60)));
        mUpdate.setText(String.format("String_Node_Str",FP.updateTime));
        mRender.setText(String.format("String_Node_Str",FP.renderTime));
        mDebugUpdateCount=0;
      }
      mDebugUpdateCount++;
      FP.point.set(0,0);
      mDebug.render(gl,FP.point,FP.point);
    }
  }
  FP.renderTime=SystemClock.uptimeMillis() - mRenderTime;
  OpenGLSystem.setGL(null);
}
Program: 86604
Project: 86604
Buggy source:
@Override protected void onDestroy(){
  super.onDestroy();
  Sfx.SOUND_POOL.release();
  FP.clearCachedBitmaps();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  super.onDestroy();
  Sfx.SOUND_POOL.release();
  FP.clearCachedBitmaps();
  Engine.clearEventListeners();
}
Program: 86605
Project: 86605
Buggy source:
@Override public void run(){
  while (mRunning) {
    step();
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (mRunning) {
    step();
  }
  Log.d(TAG,"String_Node_Str");
}
Program: 86607
Project: 86607
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mRunning=true;
  if (mGameThread == null || !mGameThread.isAlive()) {
    mGameThread=new EngineRunner();
    mGameThread.start();
  }
  mSurfaceView.onResume();
  for (  Timer t : Engine.TIMERS) {
    t.start();
  }
  int result=mAudioManager.requestAudioFocus(afChangeListener,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN);
  if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
    Log.e(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mRunning=true;
  if (mGameThread == null || !mGameThread.isAlive()) {
    mGameThread=new EngineRunner();
    mGameThread.start();
  }
  mSurfaceView.onResume();
  for (  Timer t : Engine.TIMERS) {
    t.start();
  }
  int result=mAudioManager.requestAudioFocus(afChangeListener,AudioManager.STREAM_MUSIC,AudioManager.AUDIOFOCUS_GAIN);
  if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
    Log.e(TAG,"String_Node_Str");
  }
  if (mEngine != null) {
    int count=Atlas.ATLAS.size();
    for (int i=0; i < count; i++) {
      Atlas.ATLAS.get(i).reload();
    }
    Vector<Entity> v=new Vector<Entity>();
    FP.getWorld().getAll(v);
    count=v.size();
    for (int i=0; i < count; i++) {
      Entity e=v.get(i);
      Graphic g=e.getGraphic();
      if (g instanceof Text) {
        g.reload();
      }
 else       if (g instanceof GraphicList) {
        GraphicList list=(GraphicList)g;
        Vector<Graphic> glist=list.getChildren();
        int glistCount=glist.size();
        for (int k=0; k < glistCount; k++) {
          Graphic listGraphic=glist.get(k);
          if (listGraphic instanceof Text) {
            listGraphic.reload();
          }
        }
      }
    }
  }
}
Program: 86608
Project: 86608
Buggy source:
private void step(){
  if (mStarted) {
    long now=SystemClock.uptimeMillis();
    Engine.fire(Event.ENTER_FRAME);
synchronized (mUpdateLock) {
      Engine.checkEvents();
    }
    long delta=SystemClock.uptimeMillis() - now;
    if (delta < 16) {
      try {
        Thread.sleep(16 - delta);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
private void step(){
  if (mStarted) {
    long now=SystemClock.uptimeMillis();
    Engine.fire(Event.ENTER_FRAME);
synchronized (mUpdateLock) {
      Engine.checkEvents();
    }
    mSurfaceView.requestRender();
    long delta=SystemClock.uptimeMillis() - now;
    if (delta < 16) {
      try {
        Thread.sleep(16 - delta);
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 86610
Project: 86610
Buggy source:
/** 
 * Sets the color range of this particle type.
 * @param start		The starting color.
 * @param finish		The finish color.
 * @param ease		easer function.
 * @return	This ParticleType object.
 */
public ParticleType setColor(int start,int finish,OnEaseCallback ease){
  mRed=Color.red(start);
  mGreen=Color.green(start);
  mBlue=Color.blue(start);
  mRedRange=Color.red(finish) - mRed;
  mGreenRange=Color.green(finish) - mGreen;
  mBlueRange=Color.blue(finish) - mBlue;
  mColorEase=ease;
  createBuffer();
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the color range of this particle type.
 * @param start		The starting color.
 * @param finish		The finish color.
 * @param ease		easer function.
 * @return	This ParticleType object.
 */
public ParticleType setColor(int start,int finish,OnEaseCallback ease){
  mRed=Color.red(start);
  mGreen=Color.green(start);
  mBlue=Color.blue(start);
  mRedRange=Color.red(finish) - mRed;
  mGreenRange=Color.green(finish) - mGreen;
  mBlueRange=Color.blue(finish) - mBlue;
  mColorEase=ease;
  return this;
}
Program: 86611
Project: 86611
Buggy source:
/** 
 * Sets the alpha range of this particle type.
 * @param start		The starting alpha.
 * @param finish		The finish alpha.
 * @param ease		easer function.
 * @return	This ParticleType object.
 */
public ParticleType setAlpha(int start,int finish,OnEaseCallback ease){
  start=start < 0 ? 0 : (start > 255 ? 255 : start);
  finish=finish < 0 ? 0 : (finish > 255 ? 255 : finish);
  mAlpha=start;
  mAlphaRange=finish - start;
  mAlphaEase=ease;
  createBuffer();
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the alpha range of this particle type.
 * @param start		The starting alpha.
 * @param finish		The finish alpha.
 * @param ease		easer function.
 * @return	This ParticleType object.
 */
public ParticleType setAlpha(int start,int finish,OnEaseCallback ease){
  start=start < 0 ? 0 : (start > 255 ? 255 : start);
  finish=finish < 0 ? 0 : (finish > 255 ? 255 : finish);
  mAlpha=start;
  mAlphaRange=finish - start;
  mAlphaEase=ease;
  return this;
}