nus-yam/ex-repair huggingface dataset:
Program: 38578
Project: 38578
Buggy source:
public Edge[] generateEdgesBidirectional(){
  int index=0;
  Edge[] edges=new Edge[this.parent.length * 2 - 2];
  for (int i=0; i < this.parent.length; i++) {
    if (i != -1) {
      edges[index++]=new Edge(this.parent[i],i);
      edges[index++]=new Edge(i,this.parent[i]);
    }
  }
  return edges;
}

Fixed version (ground truth):
public Edge[] generateEdgesBidirectional(){
  int index=0;
  Edge[] edges=new Edge[this.parent.length * 2 - 2];
  for (int i=0; i < this.parent.length; i++) {
    if (this.parent[i] != -1) {
      edges[index++]=new Edge(this.parent[i],i);
      edges[index++]=new Edge(i,this.parent[i]);
    }
  }
  return edges;
}
Program: 38579
Project: 38579
Buggy source:
@Override public int compareTo(PlaneIdentifier o){
  return 0;
}

Fixed version (ground truth):
@Override public int compareTo(MDIdentifier o){
  return 0;
}
Program: 38580
Project: 38580
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  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" + false);
  Network nw1=new ReadableFile("String_Node_Str","String_Node_Str","String_Node_Str",null,null);
  Network nw2=new ReadableFolder("String_Node_Str","String_Node_Str","String_Node_Str",null,null);
  Network nw3=new ReadableList("String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},null,null);
  Series s1=Series.generate(nw1,1);
  Series s2=Series.generate(nw2,10);
  Series s3=Series.generate(nw3,17);
  Plot.multiAvg(s1,"String_Node_Str");
  Network er=new ErdosRenyi(100,10,false,null,null);
  GraphWriter.write(er.generate(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  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" + false);
  Network nw1=new ReadableFile("String_Node_Str","String_Node_Str","String_Node_Str",null,null);
  Network nw2=new ReadableFolder("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",null,null);
  Network nw3=new ReadableList("String_Node_Str","String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},null,null);
  Series s1=Series.generate(nw1,1);
  Series s2=Series.generate(nw2,10);
  Series s3=Series.generate(nw3,17);
  Plot.multiAvg(s1,"String_Node_Str");
  Network er=new ErdosRenyi(100,10,false,null,null);
  GraphWriter.write(er.generate(),"String_Node_Str");
}
Program: 38581
Project: 38581
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: 38582
Project: 38582
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: 38583
Project: 38583
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: 38584
Project: 38584
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: 38585
Project: 38585
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: 38586
Project: 38586
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: 38587
Project: 38587
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: 38588
Project: 38588
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: 38589
Project: 38589
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: 38590
Project: 38590
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: 38591
Project: 38591
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: 38592
Project: 38592
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: 38593
Project: 38593
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: 38595
Project: 38595
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: 38596
Project: 38596
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: 38597
Project: 38597
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: 38598
Project: 38598
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: 38599
Project: 38599
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: 38600
Project: 38600
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: 38601
Project: 38601
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: 38602
Project: 38602
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: 38603
Project: 38603
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: 38604
Project: 38604
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: 38605
Project: 38605
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: 38606
Project: 38606
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: 38607
Project: 38607
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: 38608
Project: 38608
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: 38609
Project: 38609
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: 38610
Project: 38610
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: 38611
Project: 38611
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: 38612
Project: 38612
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: 38613
Project: 38613
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: 38615
Project: 38615
Buggy source:
private synchronized void singleMapping(){
  SingleMappingHandler mcs;
  mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchBonds(),isMatchRings());
  clearMaps();
  getMCSList().addAll(mcs.getAllAtomMapping());
}

Fixed version (ground truth):
private synchronized void singleMapping(){
  SingleMappingHandler mcs;
  mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchRings());
  clearMaps();
  getMCSList().addAll(mcs.getAllAtomMapping());
}
Program: 38616
Project: 38616
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph=false;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    singleMapping(isMatchBonds());
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraph() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
    VF2 mapper;
    List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
    if (getQuery() instanceof IQueryAtomContainer) {
      mapper=new VF2((IQueryAtomContainer)getQuery(),getTarget());
    }
 else {
      mapper=new VF2(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
    }
    isSubgraph=mapper.isSubgraph();
    List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
    if (isSubgraph) {
      mappingsVF2.addAll(atomMappings);
    }
 else {
      return false;
    }
    setVFMappings(mappingsVF2);
  }
  return isSubgraph;
}
Program: 38617
Project: 38617
Buggy source:
private synchronized void singleMapping(boolean shouldMatchBonds){
  SingleMappingHandler mcs;
  if (!(getQuery() instanceof IQueryAtomContainer) && !(getTarget() instanceof IQueryAtomContainer)) {
    mcs=new SingleMappingHandler(getQuery(),getTarget(),shouldMatchBonds,isMatchRings());
  }
 else {
    mcs=new SingleMappingHandler((IQueryAtomContainer)getQuery(),getTarget());
  }
  getMCSList().addAll(mcs.getAllAtomMapping());
}

Fixed version (ground truth):
private synchronized boolean singleMapping(){
  SingleMappingHandler mcs;
  if (!(getQuery() instanceof IQueryAtomContainer) && !(getTarget() instanceof IQueryAtomContainer)) {
    mcs=new SingleMappingHandler(getQuery(),getTarget(),isMatchRings());
  }
 else {
    mcs=new SingleMappingHandler((IQueryAtomContainer)getQuery(),getTarget());
  }
  return mcs.getAllAtomMapping() != null && !mcs.getAllAtomMapping().isEmpty();
}