nus-yam/ex-repair huggingface dataset:
Program: 39901
Project: 39901
Buggy source:
@Override public void computeData(Graph graph,Network nw,HashMap<String,Metric> metrics){
  this.runtime=new Timer();
  this.localCharacteristicPathLength=new double[graph.getNodes().length];
  long[] SPL=this.computeShortestPathLengths(graph.getNodes());
  this.shortestPathLengthDistribution=new Distribution(this.computeShortestPathLengthDistribution(SPL));
  this.shortestPathLengthDistributionAbsolute=new Distribution(this.computeShortestPathLengthDistributionAbsolute(SPL,graph));
  this.connectivity=(double)Util.sum(SPL) / (double)(graph.getNodes().length * (graph.getNodes().length - 1));
  this.runtime.end();
}

Fixed version (ground truth):
@Override public void computeData(Graph graph,Network nw,HashMap<String,Metric> metrics){
  this.runtime=new Timer();
  this.localCharacteristicPathLength=new double[graph.getNodes().length];
  long[] SPL=this.computeShortestPathLengths(graph.getNodes());
  this.shortestPathLengthDistribution=new Distribution(this.computeShortestPathLengthDistribution(SPL));
  this.shortestPathLengthDistributionAbsolute=new Distribution(this.computeShortestPathLengthDistributionAbsolute(SPL,graph));
  this.connectivity=(double)Util.sum(SPL) / (double)((double)graph.getNodes().length * (double)(graph.getNodes().length - 1));
  this.runtime.end();
}
Program: 39902
Project: 39902
Buggy source:
private double[] computeShortestPathLengthDistributionAbsolute(long[] SPL,Graph graph){
  long sum=graph.getNodes().length * (graph.getNodes().length - 1);
  double[] spld=new double[SPL.length];
  for (int i=0; i < SPL.length; i++) {
    spld[i]=(double)SPL[i] / sum;
  }
  return spld;
}

Fixed version (ground truth):
private double[] computeShortestPathLengthDistributionAbsolute(long[] SPL,Graph graph){
  long sum=(long)graph.getNodes().length * (long)(graph.getNodes().length - 1);
  double[] spld=new double[SPL.length];
  for (int i=0; i < SPL.length; i++) {
    spld[i]=(double)SPL[i] / sum;
  }
  return spld;
}
Program: 39903
Project: 39903
Buggy source:
public Edge[] getAllEdges(){
  ArrayList<Edge> edgeList=new ArrayList<Edge>();
  for (  int dst : getOutgoingEdges()) {
    edgeList.add(new Edge(this.index,dst));
  }
  for (  int src : getIncomingEdges()) {
    edgeList.add(new Edge(src,this.index));
  }
  return (Edge[])edgeList.toArray();
}

Fixed version (ground truth):
public Edge[] getAllEdges(){
  ArrayList<Edge> edgeList=new ArrayList<Edge>();
  for (  int dst : getOutgoingEdges()) {
    edgeList.add(new Edge(this.index,dst));
  }
  for (  int src : getIncomingEdges()) {
    edgeList.add(new Edge(src,this.index));
  }
  Edge[] arrayEdgeList=new Edge[edgeList.size()];
  for (int i=0; i < arrayEdgeList.length; i++) {
    arrayEdgeList[i]=edgeList.get(i);
  }
  return arrayEdgeList;
}
Program: 39904
Project: 39904
Buggy source:
protected int countAllCrossings(Graph g){
  int numCross=0;
  Edge[] edgeList=g.generateEdges();
  handledEdges=new ArrayList<String>();
  for (  Edge e : edgeList) {
    numCross+=countCrossings(e,edgeList);
  }
  System.out.println("String_Node_Str" + numCross + "String_Node_Str");
  return numCross;
}

Fixed version (ground truth):
protected int countAllCrossings(Graph g){
  int numCross=0;
  Edge[] edgeList=g.generateEdges();
  handledEdges=new ArrayList<String>();
  for (  Edge e : edgeList) {
    numCross+=countCrossings(e,edgeList);
  }
  return numCross;
}
Program: 39905
Project: 39905
Buggy source:
private Boolean hasCrossing(Edge x,Edge y){
  if (x.equals(y))   return false;
  double xStart=Math.min(getPosition(x.getSrc()),getPosition(x.getDst()));
  double xEnd=Math.max(getPosition(x.getSrc()),getPosition(x.getDst()));
  String xString=xStart + "String_Node_Str" + xEnd;
  double yStart=Math.min(getPosition(y.getSrc()),getPosition(y.getDst()));
  double yEnd=Math.max(getPosition(y.getSrc()),getPosition(y.getDst()));
  String yString=yStart + "String_Node_Str" + yEnd;
  String edgeString;
  if (xStart < yStart)   edgeString=xString + "String_Node_Str" + yString;
 else   edgeString=yString + "String_Node_Str" + xString;
  if (handledEdges.contains(edgeString)) {
    return false;
  }
  handledEdges.add(edgeString);
  if ((xStart < yStart && xEnd > yEnd) || (yStart < xStart && yEnd > xEnd) || (yStart > xEnd || xStart > yEnd)|| (yStart == xEnd || xStart == yEnd || xStart == yStart || xEnd == yEnd)) {
    System.out.println("String_Node_Str" + edgeString);
    return false;
  }
  if ((xStart < yStart && xEnd < yEnd) || (xStart > yStart && xEnd > yEnd)) {
    System.out.println("String_Node_Str" + edgeString);
    return true;
  }
  System.err.println("String_Node_Str" + edgeString);
  return false;
}

Fixed version (ground truth):
private Boolean hasCrossing(Edge x,Edge y){
  if (x.equals(y))   return false;
  double xStart=Math.min(getPosition(x.getSrc()),getPosition(x.getDst()));
  double xEnd=Math.max(getPosition(x.getSrc()),getPosition(x.getDst()));
  String xString=xStart + "String_Node_Str" + xEnd;
  double yStart=Math.min(getPosition(y.getSrc()),getPosition(y.getDst()));
  double yEnd=Math.max(getPosition(y.getSrc()),getPosition(y.getDst()));
  String yString=yStart + "String_Node_Str" + yEnd;
  String edgeString;
  if (xStart < yStart)   edgeString=xString + "String_Node_Str" + yString;
 else   edgeString=yString + "String_Node_Str" + xString;
  if (handledEdges.contains(edgeString)) {
    return false;
  }
  handledEdges.add(edgeString);
  if ((xStart < yStart && xEnd > yEnd) || (yStart < xStart && yEnd > xEnd) || (yStart > xEnd || xStart > yEnd)|| (yStart == xEnd || xStart == yEnd || xStart == yStart || xEnd == yEnd)) {
    return false;
  }
  if ((xStart < yStart && xEnd < yEnd) || (xStart > yStart && xEnd > yEnd)) {
    return true;
  }
  System.err.println("String_Node_Str" + edgeString);
  return false;
}
Program: 39906
Project: 39906
Buggy source:
public Graph getSpanningTree(Node root){
  Graph result=new Graph(this.name + "String_Node_Str");
  Node[] resultNodes=new Node[this.nodes.length];
  int[] edges;
  int nodeCounter=0;
  Node tempNodeFromList, tempNewNode;
  LinkedList<Node> todoList=new LinkedList<Node>();
  LinkedList<Integer> handledNodes=new LinkedList<Integer>();
  LinkedList<Integer> linkedNodes=new LinkedList<Integer>();
  LinkedList<Integer> newEdges;
  todoList.add(root);
  linkedNodes.add(root.getIndex());
  while (!todoList.isEmpty()) {
    tempNodeFromList=todoList.pop();
    if (handledNodes.contains(tempNodeFromList.getIndex())) {
      continue;
    }
    edges=tempNodeFromList.getOutgoingEdges();
    newEdges=new LinkedList<Integer>();
    for (    int e : edges) {
      if (!linkedNodes.contains(e)) {
        todoList.add(this.nodes[e]);
        newEdges.add(e);
        linkedNodes.add(e);
      }
    }
    tempNewNode=new Node(tempNodeFromList.getIndex(),result);
    edges=new int[newEdges.size()];
    for (int i=0; i < newEdges.size(); i++) {
      edges[i]=newEdges.get(i);
    }
    tempNewNode.setOutgoingEdges(edges);
    resultNodes[nodeCounter]=tempNewNode;
    handledNodes.add(tempNodeFromList.getIndex());
    nodeCounter++;
  }
  result.setNodes(resultNodes);
  return result;
}

Fixed version (ground truth):
public Graph getSpanningTree(Node root){
  Graph result=new Graph(this.name + "String_Node_Str");
  Node[] resultNodes=new Node[this.nodes.length];
  int[] edges;
  Node tempNodeFromList, tempNewNode;
  LinkedList<Node> todoList=new LinkedList<Node>();
  LinkedList<Integer> handledNodes=new LinkedList<Integer>();
  LinkedList<Integer> linkedNodes=new LinkedList<Integer>();
  LinkedList<Integer> newEdges;
  todoList.add(root);
  linkedNodes.add(root.getIndex());
  while (!todoList.isEmpty()) {
    tempNodeFromList=todoList.pop();
    if (handledNodes.contains(tempNodeFromList.getIndex())) {
      continue;
    }
    edges=tempNodeFromList.getOutgoingEdges();
    newEdges=new LinkedList<Integer>();
    for (    int e : edges) {
      if (!linkedNodes.contains(e)) {
        todoList.add(this.nodes[e]);
        newEdges.add(e);
        linkedNodes.add(e);
      }
    }
    tempNewNode=new Node(tempNodeFromList.getIndex(),result);
    edges=new int[newEdges.size()];
    for (int i=0; i < newEdges.size(); i++) {
      edges[i]=newEdges.get(i);
    }
    tempNewNode.setOutgoingEdges(edges);
    resultNodes[tempNodeFromList.getIndex()]=tempNewNode;
    handledNodes.add(tempNodeFromList.getIndex());
  }
  result.setNodes(resultNodes);
  return result;
}
Program: 39907
Project: 39907
Buggy source:
public void plot(Graph g,String filename){
  if (!disabled) {
    gephi.Plot(g,filename + "String_Node_Str" + extension);
  }
}

Fixed version (ground truth):
public void plot(Graph g,String filename){
  gephi.Plot(g,filename + "String_Node_Str" + extension);
}
Program: 39908
Project: 39908
Buggy source:
public void Plot(Graph g,String fileName){
  gephiNodes=new org.gephi.graph.api.Node[g.getNodes().length];
  this.plotGraph(g);
  ExportController ec=Lookup.getDefault().lookup(ExportController.class);
  try {
    ec.exportFile(new File(Config.get("String_Node_Str") + fileName));
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return;
  }
}

Fixed version (ground truth):
public void Plot(Graph g,String fileName){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.newProject();
  graphModel=Lookup.getDefault().lookup(GraphController.class).getModel();
  gephiGraph=graphModel.getGraph();
  PreviewModel model=Lookup.getDefault().lookup(PreviewController.class).getModel();
  model.getUndirectedEdgeSupervisor().setCurvedFlag(false);
  model.getBiEdgeSupervisor().setCurvedFlag(false);
  gephiNodes=new org.gephi.graph.api.Node[g.getNodes().length];
  this.plotGraph(g);
  ExportController ec=Lookup.getDefault().lookup(ExportController.class);
  try {
    ec.exportFile(new File(Config.get("String_Node_Str") + fileName));
  }
 catch (  IOException ex) {
    ex.printStackTrace();
    return;
  }
}
Program: 39909
Project: 39909
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  Stats stats=new Stats();
  boolean generate=true;
  int times=1;
  boolean wot=false;
  boolean skipExistingFolders=false;
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str" + skipExistingFolders);
  Network nw1=new ErdosRenyi(1000,20,true,new Greedy(),new Transformation[]{new RandomRingIDSpace()});
  Network nw2=new Chord(1000,20,true,new Greedy(),null);
  Network[] nw=new Network[]{nw1,nw2};
  Series[] s=Series.generate(nw,1);
  Plot.allMulti(s,"String_Node_Str");
  stats.end();
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  Stats stats=new Stats();
  boolean generate=true;
  int times=1;
  boolean wot=false;
  boolean skipExistingFolders=false;
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str" + skipExistingFolders);
  Network nw1=new ReadableFile("String_Node_Str","String_Node_Str","String_Node_Str",null,null);
  Graph g=nw1.generate();
  Transformation t=new RandomRingIDSpaceSimple();
  g=t.transform(g);
  GraphWriter.writeWithProperties(g,"String_Node_Str");
  Graph g2=GraphReader.readWithProperties("String_Node_Str");
  GraphWriter.writeWithProperties(g2,"String_Node_Str");
  stats.end();
}
Program: 39910
Project: 39910
Buggy source:
@Override public Double distance(Identifier<Double> id){
  MDIdentifier to=(MDIdentifier)id;
  if (this.idSpace.getDimensions() != to.getIdSpace().getDimensions()) {
    throw new RuntimeException("String_Node_Str");
  }
  double squarredResult=0;
  for (int i=0; i < this.idSpace.getDimensions(); i++) {
    if (this.idSpace.isWrapAround()) {
      squarredResult+=Math.abs(this.coordinates[i] - to.getCoordinate(i)) % (this.idSpace.getModulus(i) / 2.0);
    }
 else {
      squarredResult+=Math.abs(this.coordinates[i] - to.getCoordinate(i));
    }
  }
  return Math.sqrt(squarredResult);
}

Fixed version (ground truth):
@Override public Double distance(Identifier<Double> id){
  MDIdentifier to=(MDIdentifier)id;
  if (this.idSpace.getDimensions() != to.getIdSpace().getDimensions()) {
    throw new RuntimeException("String_Node_Str");
  }
  double squarredResult=0;
  double temp;
  for (int i=0; i < this.idSpace.getDimensions(); i++) {
    if (this.idSpace.isWrapAround()) {
      temp=Math.abs(this.coordinates[i] - to.getCoordinate(i)) % (this.idSpace.getModulus(i) / 2.0);
    }
 else {
      temp=Math.abs(this.coordinates[i] - to.getCoordinate(i));
    }
    squarredResult+=Math.pow(temp,2);
  }
  return Math.sqrt(squarredResult);
}
Program: 39911
Project: 39911
Buggy source:
protected NeighborsFirstObfuscatedLookaheadList(String key,boolean randomizeOrder){
  super(key,new String[]{},new String[]{});
  this.randomizeOrder=randomizeOrder;
}

Fixed version (ground truth):
protected NeighborsFirstObfuscatedLookaheadList(String key,boolean randomizeOrder){
  super(key,new String[]{"String_Node_Str"},new String[]{"String_Node_Str" + randomizeOrder});
  this.randomizeOrder=randomizeOrder;
}
Program: 39912
Project: 39912
Buggy source:
@Override public Graph transform(Graph g){
  Random rand=new Random();
  GraphProperty[] gps=g.getProperties("String_Node_Str");
  for (  GraphProperty p : gps) {
    IdentifierSpace ids=(IdentifierSpace)p;
    ArrayList<LookaheadList> lists=new ArrayList<LookaheadList>();
    for (    Node n : g.getNodes()) {
      ArrayList<LookaheadElement> list=new ArrayList<LookaheadElement>();
      for (      int outIndex : n.getOutgoingEdges()) {
        list.add(new LookaheadElement(ids.getPartitions()[outIndex],outIndex));
        Node out=g.getNode(outIndex);
        for (        int lookaheadIndex : out.getOutgoingEdges()) {
          if (lookaheadIndex == n.getIndex()) {
            continue;
          }
          list.add(new LookaheadElement(this.obfuscatePartition(ids.getPartitions()[lookaheadIndex],rand),outIndex));
        }
      }
      lists.add(new LookaheadList(n.getIndex(),list));
    }
    g.addProperty(g.getNextKey("String_Node_Str"),new LookaheadLists(lists));
  }
  return g;
}

Fixed version (ground truth):
@Override public Graph transform(Graph g){
  Random rand=new Random();
  GraphProperty[] gps=g.getProperties("String_Node_Str");
  for (  GraphProperty p : gps) {
    IdentifierSpace ids=(IdentifierSpace)p;
    ArrayList<LookaheadList> lists=new ArrayList<LookaheadList>();
    for (    Node n : g.getNodes()) {
      ArrayList<LookaheadElement> list=new ArrayList<LookaheadElement>();
      if (this.randomizeOrder) {
        ArrayList<LookaheadElement> neighbors=new ArrayList<LookaheadElement>(n.getOutDegree());
        for (        int outIndex : n.getOutgoingEdges()) {
          neighbors.add(new LookaheadElement(ids.getPartitions()[outIndex],outIndex));
        }
        for (        LookaheadElement neighbor : neighbors) {
          ArrayList<LookaheadElement> lookahead=new ArrayList<LookaheadElement>(g.getNode(neighbor.getVia()).getOutDegree());
          Node out=g.getNode(neighbor.getVia());
          for (          int lookaheadIndex : out.getOutgoingEdges()) {
            if (lookaheadIndex == n.getIndex()) {
              continue;
            }
            lookahead.add(new LookaheadElement(this.obfuscatePartition(ids.getPartitions()[lookaheadIndex],rand),neighbor.getVia()));
          }
          list.add(neighbor);
          list.addAll(lookahead);
        }
      }
 else {
        for (        int outIndex : n.getOutgoingEdges()) {
          list.add(new LookaheadElement(ids.getPartitions()[outIndex],outIndex));
          Node out=g.getNode(outIndex);
          for (          int lookaheadIndex : out.getOutgoingEdges()) {
            if (lookaheadIndex == n.getIndex()) {
              continue;
            }
            list.add(new LookaheadElement(this.obfuscatePartition(ids.getPartitions()[lookaheadIndex],rand),outIndex));
          }
        }
      }
      lists.add(new LookaheadList(n.getIndex(),list));
    }
    g.addProperty(g.getNextKey("String_Node_Str"),new LookaheadLists(lists));
  }
  return g;
}
Program: 39913
Project: 39913
Buggy source:
protected NeighborsGroupedObfuscatedLookaheadList(String key,boolean randomizeOrder){
  super(key,new String[]{},new String[]{});
  this.randomizeOrder=randomizeOrder;
}

Fixed version (ground truth):
protected NeighborsGroupedObfuscatedLookaheadList(String key,boolean randomizeOrder){
  super(key,new String[]{"String_Node_Str"},new String[]{"String_Node_Str" + randomizeOrder});
  this.randomizeOrder=randomizeOrder;
}
Program: 39915
Project: 39915
Buggy source:
protected ObfuscatedLookaheadList(String key,int minBits,int maxBits,String[] configKeys,String[] configValues){
  super(key,ObfuscatedLookaheadList.add(configKeys,"String_Node_Str","String_Node_Str"),ObfuscatedLookaheadList.add(configValues,"String_Node_Str" + BigInteger.ONE.shiftLeft(minBits),"String_Node_Str" + BigInteger.ONE.shiftLeft(maxBits)));
  this.minBits=minBits;
  this.maxBits=maxBits;
  this.min=BigInteger.ONE.shiftLeft(minBits);
  this.diff=maxBits - minBits;
}

Fixed version (ground truth):
protected ObfuscatedLookaheadList(String key,int minBits,int maxBits,String[] configKeys,String[] configValues){
  super(key,ObfuscatedLookaheadList.add(configKeys,"String_Node_Str","String_Node_Str"),ObfuscatedLookaheadList.add(configValues,"String_Node_Str" + (minBits == 0 ? BigInteger.ZERO : BigInteger.ONE.shiftLeft(minBits)),"String_Node_Str" + (maxBits == 0 ? BigInteger.ZERO : BigInteger.ONE.shiftLeft(maxBits))));
  this.minBits=minBits;
  this.maxBits=maxBits;
  this.diff=maxBits - minBits;
  if (this.minBits == 0) {
    this.min=BigInteger.ZERO;
  }
 else {
    this.min=BigInteger.ONE.shiftLeft(minBits);
  }
}
Program: 39916
Project: 39916
Buggy source:
public BigInteger distance(Identifier<BigInteger> id){
  BigInteger value=((ChordIdentifier)id).getId();
  BigInteger sub1=this.id.subtract(value).abs();
  BigInteger sub2=this.idSpace.getModulus().subtract(sub1);
  return sub1.min(sub2);
}

Fixed version (ground truth):
public BigInteger distance(Identifier<BigInteger> id){
  BigInteger dest=((ChordIdentifier)id).getId();
  if (this.id.compareTo(dest) == -1) {
    return dest.subtract(this.id);
  }
 else {
    return this.idSpace.getModulus().subtract(this.id).add(dest);
  }
}
Program: 39917
Project: 39917
Buggy source:
@Override public BigInteger distance(Identifier<BigInteger> id){
  if (this.contains(id)) {
    return BigInteger.ZERO;
  }
  BigInteger compare=((ChordIdentifier)id).getId();
  if (this.succ.getId().compareTo(compare) == -1) {
    return compare.subtract(this.succ.getId()).mod(this.succ.getIdSpace().getModulus());
  }
 else {
    return compare.add(this.succ.getIdSpace().getModulus()).subtract(this.succ.getId()).mod(this.succ.getIdSpace().getModulus());
  }
}

Fixed version (ground truth):
@Override public BigInteger distance(Identifier<BigInteger> id){
  if (this.contains(id)) {
    return BigInteger.ZERO;
  }
  BigInteger compare=((ChordIdentifier)id).getId();
  return this.succ.distance(id);
}
Program: 39918
Project: 39918
Buggy source:
private Route route(ArrayList<Integer> route,int current,Identifier target,Random rand,Node[] nodes,HashSet<Integer> seen){
  route.add(current);
  seen.add(current);
  if (this.idSpace.getPartitions()[current].contains(target)) {
    return new RouteImpl(route,true);
  }
  if (route.size() > this.ttl) {
    return new RouteImpl(route,false);
  }
  LookaheadList list=this.lists.getList(current);
  int via=-1;
  if (list.getList()[0].getPartition() instanceof DPartition) {
    double currentDist=(Double)this.p[current].distance(target);
    double minDist=(Double)this.idSpace.getMaxDistance();
    for (    LookaheadElement l : list.getList()) {
      double dist=((DPartition)l.getPartition()).distance(target);
      if (dist < minDist && dist < currentDist && !seen.contains(l.getVia())) {
        minDist=dist;
        via=l.getVia();
      }
    }
  }
 else   if (list.getList()[0].getPartition() instanceof BIPartition) {
    BigInteger currentDist=(BigInteger)this.p[current].distance(target);
    BigInteger minDist=(BigInteger)this.idSpace.getMaxDistance();
    for (    LookaheadElement l : list.getList()) {
      BigInteger dist=((BIPartition)l.getPartition()).distance(target);
      if (dist.compareTo(minDist) == -1 && dist.compareTo(currentDist) == -1 && !seen.contains(l.getVia())) {
        minDist=dist;
        via=l.getVia();
      }
    }
  }
 else {
    return null;
  }
  if (via == -1) {
    return new RouteImpl(route,false);
  }
  return this.route(route,via,target,rand,nodes,seen);
}

Fixed version (ground truth):
private Route route(ArrayList<Integer> route,int current,Identifier target,Random rand,Node[] nodes,HashSet<Integer> seen){
  route.add(current);
  seen.add(current);
  if (this.idSpace.getPartitions()[current].contains(target)) {
    return new RouteImpl(route,true);
  }
  if (route.size() > this.ttl) {
    return new RouteImpl(route,false);
  }
  LookaheadList list=this.lists.getList(current);
  int via=-1;
  if (list.getList().length == 0) {
    return new RouteImpl(route,false);
  }
  if (list.getList()[0].getPartition() instanceof DPartition) {
    double currentDist=(Double)this.p[current].distance(target);
    double minDist=(Double)this.idSpace.getMaxDistance();
    for (    LookaheadElement l : list.getList()) {
      double dist=((DPartition)l.getPartition()).distance(target);
      if (dist < minDist && dist < currentDist && !seen.contains(l.getVia())) {
        minDist=dist;
        via=l.getVia();
      }
    }
  }
 else   if (list.getList()[0].getPartition() instanceof BIPartition) {
    BigInteger currentDist=(BigInteger)this.p[current].distance(target);
    BigInteger minDist=(BigInteger)this.idSpace.getMaxDistance();
    for (    LookaheadElement l : list.getList()) {
      BigInteger dist=((BIPartition)l.getPartition()).distance(target);
      if (dist.compareTo(minDist) == -1 && dist.compareTo(currentDist) == -1 && !seen.contains(l.getVia())) {
        minDist=dist;
        via=l.getVia();
      }
    }
  }
 else {
    return null;
  }
  if (via == -1) {
    return new RouteImpl(route,false);
  }
  return this.route(route,via,target,rand,nodes,seen);
}
Program: 39919
Project: 39919
Buggy source:
@Override public void computeData(Graph g,Network n,HashMap<String,Metric> m){
  if (!g.hasProperty("String_Node_Str")) {
    this.runtime=new Timer();
    this.communitySize=new Distribution(new double[]{0.0});
    this.runtime.end();
  }
  this.runtime=new Timer();
  gtna.communities.Communities communities=(gtna.communities.Communities)g.getProperty("String_Node_Str");
  double[] c=new double[communities.getCommunities().length];
  for (int i=0; i < c.length; i++) {
    c[i]=(double)communities.getCommunities()[i].getNodes().length / (double)g.getNodes().length;
  }
  Arrays.sort(c);
  for (int i=0; i < c.length / 2; i++) {
    double temp=c[i];
    c[i]=c[c.length - i - 1];
    c[c.length - i - 1]=temp;
  }
  this.communitySize=new Distribution(c);
  this.runtime.end();
}

Fixed version (ground truth):
@Override public void computeData(Graph g,Network n,HashMap<String,Metric> m){
  if (!g.hasProperty("String_Node_Str")) {
    this.runtime=new Timer();
    this.communitySize=new Distribution(new double[]{0.0});
    this.runtime.end();
    return;
  }
  this.runtime=new Timer();
  gtna.communities.Communities communities=(gtna.communities.Communities)g.getProperty("String_Node_Str");
  double[] c=new double[communities.getCommunities().length];
  for (int i=0; i < c.length; i++) {
    c[i]=(double)communities.getCommunities()[i].getNodes().length / (double)g.getNodes().length;
  }
  Arrays.sort(c);
  for (int i=0; i < c.length / 2; i++) {
    double temp=c[i];
    c[i]=c[c.length - i - 1];
    c[c.length - i - 1]=temp;
  }
  this.communitySize=new Distribution(c);
  this.runtime.end();
}
Program: 39920
Project: 39920
Buggy source:
public Edge[] generateEdges(){
  int E=0;
  for (  Node n : this.nodes) {
    E+=n.getDegree();
  }
  Edge[] edges=new Edge[E];
  int index=0;
  for (  Node n : this.nodes) {
    for (    int out : n.getOutgoingEdges()) {
      edges[index++]=new Edge(n.getIndex(),out);
    }
    for (    int in : n.getIncomingEdges()) {
      edges[index++]=new Edge(in,n.getIndex());
    }
  }
  return edges;
}

Fixed version (ground truth):
public Edge[] generateEdges(){
  int E=0;
  for (  Node n : this.nodes) {
    E+=n.getOutDegree();
  }
  Edge[] edges=new Edge[E];
  int index=0;
  for (  Node n : this.nodes) {
    for (    int out : n.getOutgoingEdges()) {
      edges[index++]=new Edge(n.getIndex(),out);
    }
  }
  return edges;
}
Program: 39921
Project: 39921
Buggy source:
public void computeData(Graph graph,Network nw,HashMap<String,Metric> m){
  this.runtime=new Timer();
  double[] dd=new double[this.maxDegree(graph) + 1];
  double[] ddi=new double[this.maxInDegree(graph) + 1];
  double[] ddo=new double[this.maxOutDegree(graph) + 1];
  for (  Node n : graph.getNodes()) {
    dd[n.getDegree()]++;
    ddi[n.getInDegree()]++;
    ddo[n.getOutDegree()]++;
  }
  for (int i=0; i < dd.length; i++) {
    dd[i]/=(double)graph.getNodes().length;
  }
  for (int i=0; i < ddi.length; i++) {
    ddi[i]/=(double)graph.getNodes().length;
  }
  for (int i=0; i < ddo.length; i++) {
    ddo[i]/=(double)graph.getNodes().length;
  }
  this.degreeDistribution=new Distribution(dd);
  this.inDegreeDistribution=new Distribution(ddi);
  this.outDegreeDistribution=new Distribution(ddo);
  this.nodes=graph.getNodes().length;
  this.edges=graph.generateIncomingEdges().length;
  this.runtime.end();
}

Fixed version (ground truth):
public void computeData(Graph graph,Network nw,HashMap<String,Metric> m){
  this.runtime=new Timer();
  double[] dd=new double[this.maxDegree(graph) + 1];
  double[] ddi=new double[this.maxInDegree(graph) + 1];
  double[] ddo=new double[this.maxOutDegree(graph) + 1];
  for (  Node n : graph.getNodes()) {
    dd[n.getDegree()]++;
    ddi[n.getInDegree()]++;
    ddo[n.getOutDegree()]++;
  }
  for (int i=0; i < dd.length; i++) {
    dd[i]/=(double)graph.getNodes().length;
  }
  for (int i=0; i < ddi.length; i++) {
    ddi[i]/=(double)graph.getNodes().length;
  }
  for (int i=0; i < ddo.length; i++) {
    ddo[i]/=(double)graph.getNodes().length;
  }
  this.degreeDistribution=new Distribution(dd);
  this.inDegreeDistribution=new Distribution(ddi);
  this.outDegreeDistribution=new Distribution(ddo);
  this.nodes=graph.getNodes().length;
  this.edges=graph.generateEdges().length;
  this.runtime.end();
}
Program: 39922
Project: 39922
Buggy source:
public static void chordTest(){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Network nw=new Chord(10000,128,null,null);
  Series s=Series.generate(nw,10);
  Plot.multiConf(s,"String_Node_Str");
}

Fixed version (ground truth):
public static void chordTest(){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  RoutingAlgorithm r=new GreedyBI();
  Network nw0=new Chord(16,5,r,null);
  Network[] nw=new Network[]{nw0};
  Series[] s=Series.generate(nw,1);
  Plot.multiConf(s,"String_Node_Str");
}
Program: 39923
Project: 39923
Buggy source:
@Override public Graph generate(){
  Graph graph=new Graph(this.description());
  Node[] nodes=Node.init(this.nodes(),graph);
  graph.setNodes(nodes);
  RandomChordIDSpace t=new RandomChordIDSpace(this.bits);
  graph=t.transform(graph);
  ChordIDSpace idSpace=(ChordIDSpace)graph.getProperty("String_Node_Str");
  ChordPartition[] partitions=(ChordPartition[])idSpace.getPartitions();
  Edges edges=new Edges(nodes,nodes.length * this.bits);
  for (  Node node : nodes) {
    ChordPartition p=partitions[node.getIndex()];
    BigInteger id=p.getSucc().getId();
    BigInteger predID=p.getPred().getId();
    BigInteger succID=id.add(BigInteger.ONE).mod(idSpace.getModulus());
    int predIndex=this.find(partitions,p.getPred(),node.getIndex());
    int succIndex=this.find(partitions,new ChordID(idSpace,succID),node.getIndex());
    BigInteger add=BigInteger.ONE;
    int[] fingerIndex=new int[this.bits];
    BigInteger[] fingerID=new BigInteger[this.bits];
    for (int i=0; i < this.bits; i++) {
      fingerID[i]=id.add(add).mod(idSpace.getModulus());
      fingerIndex[i]=this.find(partitions,new ChordID(idSpace,fingerID[i]),node.getIndex());
      add=add.shiftLeft(1);
    }
    edges.add(node.getIndex(),predIndex);
    edges.add(node.getIndex(),succIndex);
    for (    int finger : fingerIndex) {
      edges.add(node.getIndex(),finger);
    }
  }
  edges.fill();
  graph.getTimer().end();
  return graph;
}

Fixed version (ground truth):
@Override public Graph generate(){
  Graph graph=new Graph(this.description());
  Node[] nodes=Node.init(this.nodes(),graph);
  graph.setNodes(nodes);
  RandomChordIDSpace t=new RandomChordIDSpace(this.bits);
  graph=t.transform(graph);
  ChordIDSpace idSpace=(ChordIDSpace)graph.getProperty("String_Node_Str");
  ChordPartition[] partitions=(ChordPartition[])idSpace.getPartitions();
  Edges edges=new Edges(nodes,nodes.length * this.bits);
  for (  Node node : nodes) {
    ChordPartition p=partitions[node.getIndex()];
    BigInteger id=p.getSucc().getId();
    BigInteger predID=p.getPred().getId();
    BigInteger succID=id.add(BigInteger.ONE).mod(idSpace.getModulus());
    int predIndex=this.find(partitions,p.getPred(),node.getIndex());
    int succIndex=this.find(partitions,new ChordID(idSpace,succID),node.getIndex());
    BigInteger add=BigInteger.ONE;
    int[] fingerIndex=new int[this.bits];
    BigInteger[] fingerID=new BigInteger[this.bits];
    for (int i=0; i < this.bits; i++) {
      fingerID[i]=id.add(add).mod(idSpace.getModulus());
      fingerIndex[i]=this.find(partitions,new ChordID(idSpace,fingerID[i]),node.getIndex());
      add=add.shiftLeft(1);
    }
    edges.add(node.getIndex(),succIndex);
    for (    int finger : fingerIndex) {
      edges.add(node.getIndex(),finger);
    }
  }
  edges.fill();
  graph.getTimer().end();
  return graph;
}
Program: 39924
Project: 39924
Buggy source:
@Override public BigInteger distance(BIID id){
  return this.succ.distance(id);
}

Fixed version (ground truth):
@Override public BigInteger distance(BIID id){
  if (this.contains(id)) {
    return BigInteger.ZERO;
  }
  BigInteger compare=((ChordID)id).getId();
  if (this.succ.getId().compareTo(compare) == -1) {
    return compare.subtract(this.succ.getId()).mod(this.succ.getIdSpace().getModulus());
  }
 else {
    return compare.add(this.succ.getIdSpace().getModulus()).subtract(this.succ.getId()).mod(this.succ.getIdSpace().getModulus());
  }
}
Program: 39925
Project: 39925
Buggy source:
@Override public boolean applicable(Graph graph){
  return graph.hasProperty("String_Node_Str") && graph.getProperty("String_Node_Str") instanceof IDSpace;
}

Fixed version (ground truth):
@Override public boolean applicable(Graph graph){
  return graph.hasProperty("String_Node_Str") && graph.getProperty("String_Node_Str") instanceof BIIDSpace;
}
Program: 39926
Project: 39926
Buggy source:
@Override public void read(String filename,Graph graph){
  Filereader fr=new Filereader(filename);
  fr.readLine();
  String key=fr.readLine();
  int partitions=Integer.parseInt(fr.readLine());
  this.partitions=new RingPartitionSimple[partitions];
  String line=null;
  while ((line=fr.readLine()) != null) {
    String[] temp=line.split("String_Node_Str");
    int index=Integer.parseInt(temp[0]);
    this.partitions[index++]=new RingPartitionSimple(temp[1]);
  }
  fr.close();
  graph.addProperty(key,this);
}

Fixed version (ground truth):
@Override public void read(String filename,Graph graph){
  Filereader fr=new Filereader(filename);
  fr.readLine();
  String key=fr.readLine();
  int partitions=Integer.parseInt(fr.readLine());
  this.partitions=new RingPartitionSimple[partitions];
  String line=null;
  while ((line=fr.readLine()) != null) {
    String[] temp=line.split("String_Node_Str");
    int index=Integer.parseInt(temp[0]);
    this.partitions[index]=new RingPartitionSimple(temp[1]);
  }
  fr.close();
  graph.addProperty(key,this);
}
Program: 39927
Project: 39927
Buggy source:
@Override public double distance(ID id){
  return this.id.distance((RingID)id);
}

Fixed version (ground truth):
@Override public double distance(ID id){
  return this.id.distance(id);
}
Program: 39928
Project: 39928
Buggy source:
private static void testRouting(){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Transformation t1=new RandomRingIDSpaceSimple();
  Transformation[] t=new Transformation[]{t1};
  RoutingAlgorithm r1=new Greedy();
  RoutingAlgorithm r2=new GreedyBacktracking();
  Network nw1=new ReadableFile("String_Node_Str","String_Node_Str","String_Node_Str",r1,t);
  Network nw2=new ReadableFile("String_Node_Str","String_Node_Str","String_Node_Str",r2,t);
  Network[] nw=new Network[]{nw1,nw2};
  Series[] s=Series.generate(nw,100);
  Plot.multiAvg(s,"String_Node_Str");
  Plot.singlesAvg(s,"String_Node_Str");
}

Fixed version (ground truth):
private static void testRouting(){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  Transformation t1=new RandomRingIDSpaceSimple();
  Transformation[] t=new Transformation[]{t1};
  RoutingAlgorithm r1=new Greedy();
  RoutingAlgorithm r2=new GreedyBacktracking();
  Network nw1=new ErdosRenyi(100,10,true,r1,t);
  Network nw2=new ErdosRenyi(100,10,true,r2,t);
  Network[] nw=new Network[]{nw1,nw2};
  Series[] s=Series.generate(nw,1);
  Plot.multiAvg(s,"String_Node_Str");
  Plot.singlesAvg(s,"String_Node_Str");
}
Program: 39929
Project: 39929
Buggy source:
@Override public Route routeToRandomTarget(Graph graph,int start,Random rand){
  ID target=this.idSpace.randomID(rand);
  while (this.p[start].contains(target)) {
    target=this.idSpace.randomID(rand);
  }
  return this.route(new ArrayList<Integer>(),start,target,rand,graph.getNodes(),new HashMap<Integer,Integer>());
}

Fixed version (ground truth):
@Override public Route routeToRandomTarget(Graph graph,int start,Random rand){
  ID target=this.idSpace.randomID(rand);
  while (this.p[start].contains(target)) {
    target=this.idSpace.randomID(rand);
  }
  System.out.println("String_Node_Str");
  return this.route(new ArrayList<Integer>(),start,target,rand,graph.getNodes(),new HashMap<Integer,Integer>());
}
Program: 39930
Project: 39930
Buggy source:
private Route route(ArrayList<Integer> route,int current,ID target,Random rand,Node[] nodes,HashMap<Integer,Integer> from){
  route.add(current);
  if (this.idSpace.getPartitions()[current].contains(target)) {
    return new RouteImpl(route,true);
  }
  double currentDist=this.idSpace.getPartitions()[current].distance(target);
  double minDist=Double.MAX_VALUE;
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.p[out].distance(target);
    if (dist < minDist && dist < currentDist && !from.containsKey(out)) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    return this.route(route,from.get(current),target,rand,nodes,from);
  }
 else   if (minNode == -1) {
    return new RouteImpl(route,false);
  }
  from.put(current,minNode);
  return this.route(route,minNode,target,rand,nodes,from);
}

Fixed version (ground truth):
private Route route(ArrayList<Integer> route,int current,ID target,Random rand,Node[] nodes,HashMap<Integer,Integer> from){
  System.out.println("String_Node_Str" + current);
  route.add(current);
  if (this.idSpace.getPartitions()[current].contains(target)) {
    return new RouteImpl(route,true);
  }
  double currentDist=this.idSpace.getPartitions()[current].distance(target);
  double minDist=Double.MAX_VALUE;
  int minNode=-1;
  for (  int out : nodes[current].getOutgoingEdges()) {
    double dist=this.p[out].distance(target);
    if (dist < minDist && dist < currentDist && !from.containsKey(out)) {
      minDist=dist;
      minNode=out;
    }
  }
  if (minNode == -1 && from.containsKey(current)) {
    System.out.println("String_Node_Str");
    return this.route(route,from.get(current),target,rand,nodes,from);
  }
 else   if (minNode == -1) {
    System.out.println("String_Node_Str" + route.size() + "String_Node_Str"+ from.size());
    System.out.println("String_Node_Str" + current);
    for (int i=0; i < route.size(); i++) {
      System.out.print("String_Node_Str" + route.get(i) + "String_Node_Str"+ from.containsKey(current));
    }
    System.out.println("String_Node_Str");
    return new RouteImpl(route,false);
  }
  System.out.println("String_Node_Str" + current + "String_Node_Str"+ minNode);
  from.put(minNode,current);
  return this.route(route,minNode,target,rand,nodes,from);
}
Program: 39931
Project: 39931
Buggy source:
public ReadableFolder(String name,String folder,String src,int type,RoutingAlgorithm ra,Transformation[] t){
  super(key(name,folder),Integer.MIN_VALUE,new String[]{},new String[]{},ra,t);
  this.type=type;
  File d=new File(src);
  if (!d.exists()) {
    this.files=new String[0];
  }
 else {
    File[] f=d.listFiles();
    this.files=new String[f.length];
    for (int i=0; i < f.length; i++) {
      this.files[i]=f[i].getAbsolutePath();
    }
  }
  this.index=-1;
  super.setNodes(GraphReader.nodes(this.files[0],this.type));
}

Fixed version (ground truth):
public ReadableFolder(String name,String folder,String src,int type,RoutingAlgorithm ra,Transformation[] t){
  super(key(name,folder),Integer.MIN_VALUE,new String[]{},new String[]{},ra,t);
  this.type=type;
  File d=new File(src);
  if (!d.exists()) {
    this.files=new String[0];
  }
 else {
    File[] f=d.listFiles();
    this.files=new String[f.length];
    for (int i=0; i < f.length; i++) {
      this.files[i]=f[i].getAbsolutePath();
    }
  }
  this.index=-1;
  if (this.files.length == 0) {
    super.setNodes(0);
  }
 else {
    super.setNodes(GraphReader.nodes(this.files[0],this.type));
  }
}
Program: 39932
Project: 39932
Buggy source:
private double[] computeLCC(NodeImpl[] nodes,HashMap<String,Edge> map){
  double[] lcc=new double[nodes.length];
  for (int i=0; i < nodes.length; i++) {
    Node[] neighborhood=this.neighborhood(nodes[i]);
    if (neighborhood.length == 1) {
      lcc[i]=0;
    }
 else {
      int edges=this.edgesInNeighborhood_NEW(neighborhood,nodes[i],nodes.length,map);
      lcc[i]=edges / (double)(neighborhood.length * (neighborhood.length - 1));
    }
  }
  return lcc;
}

Fixed version (ground truth):
private double[] computeLCC(NodeImpl[] nodes,boolean onlyOut){
  double[] lcc=new double[nodes.length];
  for (int i=0; i < nodes.length; i++) {
    Set<NodeImpl> n=this.neighborhood(nodes[i],onlyOut);
    if (n.size() <= 1) {
      lcc[i]=0;
    }
 else {
      int edges=this.edgesInNeighborhood(n);
      lcc[i]=edges / (double)(n.size() * (n.size() - 1));
    }
  }
  return lcc;
}
Program: 39933
Project: 39933
Buggy source:
public Value[] getValues(Value[] values){
  Value CC=new Value("String_Node_Str",this.cc);
  Value CCW=new Value("String_Node_Str",this.ccw);
  Value CC_RT=new Value("String_Node_Str",this.timer.rt());
  return new Value[]{CC,CCW,CC_RT};
}

Fixed version (ground truth):
public Value[] getValues(Value[] values){
  Value CC=new Value("String_Node_Str",this.cc);
  Value CCW=new Value("String_Node_Str",this.ccw);
  Value RT=new Value("String_Node_Str",this.timer.rt());
  return new Value[]{CC,CCW,RT};
}
Program: 39934
Project: 39934
Buggy source:
public void computeData(Graph g,Network n,Hashtable<String,Metric> m){
  this.timer=new Timer();
  double[] lcc=this.computeLCC(g.nodes,g.map());
  Arrays.sort(lcc);
  this.lcc=lcc;
  this.lccShort=Util.avgArray(lcc,Config.getInt("String_Node_Str"));
  this.cc=this.computeCC(this.lcc);
  this.ccw=this.computeCCW(this.lcc,g.nodes);
  this.timer.end();
}

Fixed version (ground truth):
public void computeData(Graph g,Network n,Hashtable<String,Metric> m){
  this.timer=new Timer();
  boolean onlyOut=GraphProperties.bidirectional(g) || Config.getBoolean("String_Node_Str");
  this.lcc=this.computeLCC(g.nodes,onlyOut);
  Arrays.sort(this.lcc);
  this.lccShort=this.computeLCCShort(this.lcc);
  this.cc=this.computeCC(this.lcc);
  this.ccw=this.computeCCW(this.lcc,g.nodes);
  this.timer.end();
}
Program: 39935
Project: 39935
Buggy source:
private Node[] neighborhood(NodeImpl node){
  ArrayList<NodeImpl> neighborhood=new ArrayList<NodeImpl>(node.out().length + node.in().length);
  neighborhood.add(node);
  NodeImpl[] out=node.out();
  for (int i=0; i < out.length; i++) {
    neighborhood.add(out[i]);
  }
  NodeImpl[] in=node.in();
  for (int i=0; i < in.length; i++) {
    if (!neighborhood.contains(in[i])) {
      neighborhood.add(in[i]);
    }
  }
  return Util.toNodeImplArray(neighborhood);
}

Fixed version (ground truth):
private Set<NodeImpl> neighborhood(NodeImpl node,boolean onlyOut){
  Set<NodeImpl> n=new HashSet<NodeImpl>();
  NodeImpl[] OUT=node.out();
  for (  NodeImpl out : OUT) {
    n.add(out);
  }
  if (!onlyOut) {
    NodeImpl[] IN=node.in();
    for (    NodeImpl in : IN) {
      n.add(in);
    }
  }
  return n;
}
Program: 39937
Project: 39937
Buggy source:
public static String formatNumber(double d,int decimalPlaces){
  if (decimalPlaces < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (decimalPlaces == 0) {
    long rounded=Math.round(d);
    return addCommas(rounded + "String_Node_Str");
  }
 else {
    long rounded=Math.round(d * Math.pow(10,decimalPlaces));
    d=rounded;
    for (int i=0; i < decimalPlaces; i++) {
      d/=10.0d;
    }
    String s=showAllDigitsFormat.format(d);
    int decimalIndex=s.indexOf('.');
    String leftSide=s.substring(0,decimalIndex);
    String rightSide=s.substring(decimalIndex + 1);
    leftSide=addCommas(leftSide);
    if (decimalPlaces < rightSide.length()) {
      rightSide=rightSide.substring(0,decimalPlaces);
    }
 else     if (decimalPlaces > rightSide.length()) {
      StringBuilder sb=new StringBuilder(rightSide);
      for (int i=0; i < decimalPlaces - rightSide.length(); i++) {
        sb.append('0');
      }
      rightSide=sb.toString();
    }
    return leftSide + "String_Node_Str" + rightSide;
  }
}

Fixed version (ground truth):
public static String formatNumber(double d,int decimalPlaces){
  if (decimalPlaces < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (decimalPlaces == 0) {
    long rounded=Math.round(d);
    return addCommas(rounded + "String_Node_Str");
  }
 else {
    long rounded=Math.round(d * Math.pow(10,decimalPlaces));
    d=rounded;
    for (int i=0; i < decimalPlaces; i++) {
      d/=10.0d;
    }
    String s=showAllDigitsFormat.format(d);
    int decimalIndex=0;
    if (s.contains("String_Node_Str")) {
      decimalIndex=s.indexOf('.');
    }
 else     if (s.contains("String_Node_Str")) {
      decimalIndex=s.indexOf(',');
    }
    String leftSide=s.substring(0,decimalIndex);
    String rightSide=s.substring(decimalIndex + 1);
    leftSide=addCommas(leftSide);
    if (decimalPlaces < rightSide.length()) {
      rightSide=rightSide.substring(0,decimalPlaces);
    }
 else     if (decimalPlaces > rightSide.length()) {
      StringBuilder sb=new StringBuilder(rightSide);
      for (int i=0; i < decimalPlaces - rightSide.length(); i++) {
        sb.append('0');
      }
      rightSide=sb.toString();
    }
    return leftSide + "String_Node_Str" + rightSide;
  }
}
Program: 39938
Project: 39938
Buggy source:
private void stopRunning(){
  Point before=MouseInfo.getPointerInfo().getLocation();
  clickAt(rob,origin[0],origin[1]);
  rob.keyRelease(KeyEvent.VK_Q);
  rob.keyRelease(KeyEvent.VK_W);
  rob.keyRelease(KeyEvent.VK_O);
  rob.keyRelease(KeyEvent.VK_P);
  rob.mouseMove(before.x,before.y);
}

Fixed version (ground truth):
private void stopRunning(){
  Point before=MouseInfo.getPointerInfo().getLocation();
  clickAt(rob,origin[0],origin[1]);
  rob.keyPress(KeyEvent.VK_Q);
  rob.keyPress(KeyEvent.VK_W);
  rob.keyPress(KeyEvent.VK_O);
  rob.keyPress(KeyEvent.VK_P);
  doWait(20);
  rob.keyRelease(KeyEvent.VK_Q);
  rob.keyRelease(KeyEvent.VK_W);
  rob.keyRelease(KeyEvent.VK_O);
  rob.keyRelease(KeyEvent.VK_P);
  rob.mouseMove(before.x,before.y);
}
Program: 39939
Project: 39939
Buggy source:
public RunInfo playOneGame(String str,long maxDuration){
  log.log("String_Node_Str" + str);
  doWait(500);
  this.start=System.currentTimeMillis();
  this.nextCheck=this.start + CHECK_INTERVAL;
  if (maxDuration > 0) {
    this.timeLimit=this.start + maxDuration;
  }
 else {
    this.timeLimit=0;
  }
  while (!(isFinished() || stop)) {
    playString(str);
  }
  stopRunning();
  checkSpeed();
  long end=System.currentTimeMillis();
  float distance=Float.parseFloat(captureDistance());
  RunInfo info;
  if (stop) {
    info=new RunInfo(str,this.delay,false,true,end - this.start,distance);
  }
 else {
    info=new RunInfo(str,this.delay,distance < 100,false,end - this.start,distance);
  }
  return info;
}

Fixed version (ground truth):
public RunInfo playOneGame(String str,long maxDuration){
  log.log("String_Node_Str" + str);
  doWait(500);
  this.start=System.currentTimeMillis();
  this.nextCheck=this.start + CHECK_INTERVAL;
  if (maxDuration > 0) {
    this.timeLimit=this.start + maxDuration;
  }
 else {
    this.timeLimit=0;
  }
  while (!(isFinished() || stop)) {
    playString(str);
  }
  stopRunning();
  checkSpeed();
  long end=System.currentTimeMillis();
  doWait(1000);
  float distance=Float.parseFloat(captureDistance());
  RunInfo info;
  if (stop) {
    info=new RunInfo(str,this.delay,false,true,end - this.start,distance);
  }
 else {
    info=new RunInfo(str,this.delay,distance < 100,false,end - this.start,distance);
  }
  return info;
}
Program: 39940
Project: 39940
Buggy source:
public void playOneRandomGame(String str){
  log.log("String_Node_Str" + str);
  long start=System.currentTimeMillis();
  doWait(500);
  while (!(isFinished() || stop)) {
    playString(rob,str);
  }
  long end=System.currentTimeMillis();
  log.logf("String_Node_Str",(end - start) / 1000.0);
}

Fixed version (ground truth):
public void playOneRandomGame(String str){
  log.log("String_Node_Str" + str);
  long start=System.currentTimeMillis();
  doWait(500);
  while (!(isFinished() || stop)) {
    playString(rob,str);
  }
  long end=System.currentTimeMillis();
  if (stop) {
    log.logf("String_Node_Str",(end - start) / 1000.0);
  }
 else {
    log.logf("String_Node_Str",(end - start) / 1000.0);
  }
}
Program: 39941
Project: 39941
Buggy source:
/** 
 * Start a game, either by clicking on it (at first load) or pressing space for next games.
 */
public void startGame(){
  stop=false;
  clickAt(rob,origin[0],origin[1]);
  if (finished) {
    clickKey(rob,KeyEvent.VK_SPACE);
  }
}

Fixed version (ground truth):
/** 
 * Start a game, either by clicking on it (at first load) or pressing space for next games.
 */
public void startGame(){
  stop=false;
  clickAt(rob,origin[0],origin[1]);
  if (isFinished()) {
    clickKey(rob,KeyEvent.VK_SPACE);
  }
}