nus-yam/ex-repair huggingface dataset:
Program: 39761
Project: 39761
Buggy source:
/** 
 * build an instance of a default sampling transformation
 * @param sg
 * @param revisiting
 * @param dimension IGNORED BY SINGLEDIMENSIONAL SAMPLING ALGORITHMS!
 * @return
 */
public static SamplingController getInstanceOf(SamplingAlgorithm sg,double scaledown,boolean revisiting,int dimension){
  SamplingController sc;
  ASampler as;
  AWalker aw;
  AWalkerController awc;
  CandidateFilter cf;
  NetworkSample ns;
  StartNodeSelector sns;
  String algorithm;
switch (sg) {
case UNIFORMSAMPLING:
    as=new VisitedNodeSampler();
  aw=new UniformRandomWalker();
cf=new CandidateFilter(revisiting);
Collection<AWalker> cw=new ArrayList<AWalker>();
cw.add(aw);
awc=new UniformSamplingWalkerController(cw,cf);
aw.setWalkerController(awc);
sns=new StartNodeSelector("String_Node_Str");
algorithm="String_Node_Str";
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
sc=new SamplingController(algorithm,awc,as,sns,scaledown,dimension,revisiting);
return sc;
}

Fixed version (ground truth):
/** 
 * build an instance of a default sampling transformation
 * @param sg
 * @param revisiting
 * @param dimension IGNORED BY SINGLEDIMENSIONAL SAMPLING ALGORITHMS!
 * @return
 */
public static SamplingController getInstanceOf(SamplingAlgorithm sg,double scaledown,boolean revisiting,int dimension){
  SamplingController sc;
  ASampler as;
  AWalker aw;
  AWalkerController awc;
  CandidateFilter cf;
  NetworkSample ns;
  StartNodeSelector sns;
  String algorithm;
switch (sg) {
case UNIFORMSAMPLING:
    as=new VisitedNodeSampler();
  aw=new UniformRandomWalker();
cf=new CandidateFilter(revisiting);
Collection<AWalker> cw=new ArrayList<AWalker>();
cw.add(aw);
awc=new UniformSamplingWalkerController(cw,cf);
aw.setWalkerController(awc);
as.setWalkerController(awc);
sns=new StartNodeSelector("String_Node_Str");
algorithm="String_Node_Str";
break;
default :
throw new IllegalArgumentException("String_Node_Str");
}
sc=new SamplingController(algorithm,awc,as,sns,scaledown,dimension,revisiting);
return sc;
}
Program: 39762
Project: 39762
Buggy source:
@Override public Graph transform(Graph g){
  if (!initialized()) {
    return g;
  }
 else {
    sampleGraph(g);
    return g;
  }
}

Fixed version (ground truth):
@Override public Graph transform(Graph g){
  if (!initialized()) {
    return g;
  }
 else {
    long startTime=System.currentTimeMillis();
    sampleGraph(g);
    long finishTime=System.currentTimeMillis();
    long duration=finishTime - startTime;
    System.out.println("String_Node_Str" + networkSample.getSampleSize() + "String_Node_Str"+ g.getNodeCount()+ "String_Node_Str"+ duration+ "String_Node_Str");
    return g;
  }
}
Program: 39763
Project: 39763
Buggy source:
/** 
 * Sample eventually nodes in the specified round
 * @param maxNodesInThisRound number of maximal added nodes
 * @param round current round
 * @return true if at least one node is sampled, else false
 */
private boolean sampleOneStep(int maxNodesInThisRound,int round){
  Collection<Node> chosenNodes=sampler.sampleOneStepNodes(maxNodesInThisRound);
  if (chosenNodes.size() > 0)   return networkSample.addNodeToSample(chosenNodes,round);
  return false;
}

Fixed version (ground truth):
/** 
 * Sample eventually nodes in the specified round
 * @param maxNodesInThisRound number of maximal added nodes
 * @param round current round
 * @return true if at least one node is sampled, else false
 */
private boolean sampleOneStep(Graph g,int maxNodesInThisRound,int round){
  Collection<Node> chosenNodes=sampler.sampleOneStepNodes(g,networkSample,maxNodesInThisRound);
  if (chosenNodes.size() > 0)   return networkSample.addNodeToSample(chosenNodes,round);
  return false;
}
Program: 39764
Project: 39764
Buggy source:
public SamplingController(String algorithm,AWalkerController awc,ASampler as,StartNodeSelector asns,double scaledown,int dimension,boolean revisiting){
  super("String_Node_Str" + algorithm + "String_Node_Str"+ awc.getValue()+ "String_Node_Str"+ as.getValue(),new Parameter[]{awc,as,asns,new DoubleParameter("String_Node_Str",scaledown),new IntParameter("String_Node_Str",dimension),new BooleanParameter("String_Node_Str",revisiting)});
  if (dimension < 1) {
    throw new IllegalArgumentException("String_Node_Str" + dimension);
  }
  if (scaledown < 0.0 || scaledown > 1.0) {
    throw new IllegalArgumentException("String_Node_Str" + scaledown);
  }
  this.scaledown=scaledown;
  this.dimension=dimension;
  this.revisiting=revisiting;
}

Fixed version (ground truth):
public SamplingController(String algorithm,AWalkerController awc,ASampler as,StartNodeSelector asns,double scaledown,int dimension,boolean revisiting){
  super("String_Node_Str",new Parameter[]{new StringParameter("String_Node_Str",algorithm),awc,as,asns,new DoubleParameter("String_Node_Str",scaledown),new IntParameter("String_Node_Str",dimension),new BooleanParameter("String_Node_Str",revisiting)});
  if (dimension < 1) {
    throw new IllegalArgumentException("String_Node_Str" + dimension);
  }
  if (scaledown < 0.0 || scaledown > 1.0) {
    throw new IllegalArgumentException("String_Node_Str" + scaledown);
  }
  this.scaledown=scaledown;
  this.dimension=dimension;
  this.revisiting=revisiting;
  this.sampler=as;
  this.walkerController=awc;
  this.startNodeSelector=asns;
  this.networkSample=new NetworkSample();
}
Program: 39765
Project: 39765
Buggy source:
@Override public boolean applicable(Graph g){
  if (!initialized()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean applicable(Graph g){
  if (!initialized()) {
    System.out.println("String_Node_Str");
    if (dimension <= 0)     System.out.println("String_Node_Str");
    if (networkSample == null)     System.out.println("String_Node_Str");
    if (walkerController == null || !walkerController.isInitialized())     System.out.println("String_Node_Str");
    if (sampler == null || !sampler.isInitialized())     System.out.println("String_Node_Str");
    if (startNodeSelector == null)     System.out.println("String_Node_Str");
    return false;
  }
  return true;
}
Program: 39766
Project: 39766
Buggy source:
public boolean sampleGraph(Graph g){
  Node[] startNodes=startNodeSelector.selectStartNodes(g,dimension);
  int targetSampleSize=(int)Math.ceil(g.getNodeCount() * scaledown);
  int maxNodesInThisRound=calculateResidualBudget(targetSampleSize);
  int round=0;
  walkerController.initialize(g,startNodes);
  sampler.initialize(walkerController,targetSampleSize);
  sampleOneStep(maxNodesInThisRound,round);
  boolean running=true;
  do {
    round++;
    walkerController.walkOneStep();
    sampleOneStep(maxNodesInThisRound,round);
    maxNodesInThisRound=calculateResidualBudget(targetSampleSize);
    running=(maxNodesInThisRound > 0) ? true : false;
  }
 while (running);
  return true;
}

Fixed version (ground truth):
public boolean sampleGraph(Graph g){
  Node[] startNodes=startNodeSelector.selectStartNodes(g,dimension);
  int targetSampleSize=(int)Math.ceil(g.getNodeCount() * scaledown);
  int maxNodesInThisRound=calculateResidualBudget(targetSampleSize);
  int round=0;
  walkerController.initialize(g,startNodes);
  sampler.initialize(g,networkSample,targetSampleSize);
  sampleOneStep(g,maxNodesInThisRound,round);
  boolean running=true;
  do {
    round++;
    walkerController.walkOneStep(g,networkSample);
    sampleOneStep(g,maxNodesInThisRound,round);
    maxNodesInThisRound=calculateResidualBudget(targetSampleSize);
    running=(maxNodesInThisRound > 0) ? true : false;
  }
 while (running);
  return true;
}
Program: 39767
Project: 39767
Buggy source:
/** 
 * Select start nodes from the original graph The default implementation choses dimension random nodes
 * @param g 			Graph
 * @param dimension		Number of chosen startnodes
 * @return				Array of chosen startnodes
 */
public Node[] selectStartNodes(Graph g,int dimension){
  Collection<Node> sn=new ArrayList<Node>();
  Random r=new Random();
  int gsize=g.getNodeCount();
  int nid;
  Node n;
  int i=0;
  while (sn.size() < dimension) {
    nid=r.nextInt() % gsize;
    n=g.getNode(nid);
    if (!sn.contains(n)) {
      sn.add(n);
    }
  }
  return sn.toArray(new Node[dimension]);
}

Fixed version (ground truth):
/** 
 * Select start nodes from the original graph The default implementation choses dimension random nodes
 * @param g 			Graph
 * @param dimension		Number of chosen startnodes
 * @return				Array of chosen startnodes
 */
public Node[] selectStartNodes(Graph g,int dimension){
  Collection<Node> sn=new ArrayList<Node>();
  Random r=new Random();
  int gsize=g.getNodeCount();
  int nid;
  Node n;
  int i=0;
  while (sn.size() < dimension) {
    nid=r.nextInt(gsize - 1);
    nid=nid % gsize;
    n=g.getNode(nid);
    if (!sn.contains(n)) {
      sn.add(n);
    }
  }
  return sn.toArray(new Node[0]);
}
Program: 39768
Project: 39768
Buggy source:
@Override protected Node selectNextNode(Collection<Node> candidates){
  Random r=new Random();
  int next=r.nextInt() % candidates.size();
  return candidates.toArray(new Node[0])[next];
}

Fixed version (ground truth):
@Override protected Node selectNextNode(Collection<Node> candidates){
  Random r=new Random();
  int next=r.nextInt(candidates.size() - 1);
  return candidates.toArray(new Node[0])[next];
}
Program: 39769
Project: 39769
Buggy source:
public static void main(String[] args){
  Config.overwrite("String_Node_Str","String_Node_Str");
  boolean get=false;
  int times=1;
  boolean b=false;
  boolean r=false;
  Network nw0=new Regular(1000,3,r,b,null);
  Network nw1=new Regular(2000,3,r,b,null);
  Network nw2=new Regular(3000,3,r,b,null);
  Network nw3=new Regular(4000,3,r,b,null);
  Network nw4=new Regular(5000,3,r,b,null);
  Network nw5=new Regular(6000,3,r,b,null);
  Network nw6=new Regular(7000,3,r,b,null);
  Network nw7=new Regular(8000,3,r,b,null);
  Network nw8=new Regular(9000,3,r,b,null);
  Network nw9=new Regular(10000,3,r,b,null);
  Network[] n=new Network[]{nw0,nw1,nw2,nw3,nw4,nw5,nw6,nw7,nw8,nw9};
  Metric[] metrics=new Metric[]{new DegreeDistribution(),new ShortestPaths(),new ClusteringCoefficient()};
  Series[] s=get ? Series.get(n,metrics) : Series.generate(n,metrics,times);
  Plotting.single(s,metrics,"String_Node_Str");
  Plotting.multi(s,metrics,"String_Node_Str");
  for (  Network i : n) {
    System.out.println("String_Node_Str" + i.getKey() + "String_Node_Str"+ i.getNodes()+ "String_Node_Str");
    plot(i,"String_Node_Str" + i.getKey() + "String_Node_Str"+ i.getNodes(),times);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Config.overwrite("String_Node_Str","String_Node_Str");
  boolean get=false;
  int times=1;
  boolean b=false;
  boolean r=false;
  Network nw0=new Regular(100,4,r,b,null);
  Network nw1=new Regular(200,4,r,b,null);
  Network nw2=new Regular(300,4,r,b,null);
  Network nw3=new Regular(400,4,r,b,null);
  Network nw4=new Regular(500,4,r,b,null);
  Network nw5=new Regular(600,4,r,b,null);
  Network nw6=new Regular(700,4,r,b,null);
  Network nw7=new Regular(800,4,r,b,null);
  Network nw8=new Regular(900,4,r,b,null);
  Network nw9=new Regular(1000,4,r,b,null);
  Network[] n=new Network[]{nw0,nw1,nw2,nw3,nw4,nw5,nw6,nw7,nw8,nw9};
  Metric[] metrics=new Metric[]{new DegreeDistribution(),new ShortestPaths(),new ClusteringCoefficient()};
  Series[] s=get ? Series.get(n,metrics) : Series.generate(n,metrics,times);
  Plotting.single(s,metrics,"String_Node_Str");
  Plotting.multi(s,metrics,"String_Node_Str");
  for (  Network i : n) {
    System.out.println("String_Node_Str" + i.getKey() + "String_Node_Str"+ i.getNodes()+ "String_Node_Str");
    plot(i,"String_Node_Str" + i.getKey() + "String_Node_Str"+ i.getNodes(),times);
  }
}
Program: 39771
Project: 39771
Buggy source:
public int compare(Node n1,Node n2){
  double point1=map.get(n1).doubleValue();
  double point2=map.get(n2).doubleValue();
  int result;
  if (point1 == point2) {
    result=0;
  }
 else   if (point1 > point2) {
    result=1;
  }
 else {
    result=-1;
  }
  return result;
}

Fixed version (ground truth):
public int compare(Node n1,Node n2){
  double point1=ClosenessCentralityNodeSorter.this.map.get(n1).doubleValue();
  double point2=ClosenessCentralityNodeSorter.this.map.get(n2).doubleValue();
  int result;
  if (point1 == point2) {
    result=0;
  }
 else   if (point1 > point2) {
    result=1;
  }
 else {
    result=-1;
  }
  return result;
}
Program: 39772
Project: 39772
Buggy source:
/** 
 */
private void calculate(Graph g){
  GraphSPallFloyd floyd=new GraphSPallFloyd(g);
  for (int i=0; i < g.getNodes().length; i++) {
    double sum=0;
    for (int j=0; j < g.getNodes().length; j++) {
      if (j == i) {
        continue;
      }
      if (floyd.dist(i,j) < floyd.INF) {
        sum+=floyd.dist(i,j);
      }
    }
    map.put(g.getNode(i),1 / sum);
  }
}

Fixed version (ground truth):
/** 
 */
private void calculate(Graph g){
  GraphSPallFloyd floyd=new GraphSPallFloyd(g);
  for (int i=0; i < g.getNodes().length; i++) {
    double sum=0;
    for (int j=0; j < g.getNodes().length; j++) {
      if (floyd.dist(i,j) < floyd.INF) {
        sum+=floyd.dist(i,j);
      }
    }
    map.put(g.getNode(i),1.0 / sum);
  }
}
Program: 39773
Project: 39773
Buggy source:
/** 
 * @param g
 */
public GraphSPallFloyd(Graph g){
  super(g);
  int V=g.getNodes().length;
  p=new Edge[V][V];
  d=new int[V][V];
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    for (int t=0; t < V; t++) {
      d[s][t]=INF;
    }
  }
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    for (int t=0; t < V; t++) {
      if (g.getEdges().contains(s,t)) {
        p[s][t]=g.getEdges().getEdge(s,t);
        d[s][t]=1;
      }
    }
  }
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    d[s][s]=0;
  }
  System.out.println("String_Node_Str");
  for (int i=0; i < V; i++) {
    System.out.println("String_Node_Str" + i);
    for (int s=0; s < V; s++) {
      if (p[s][i] != null) {
        for (int t=0; t < V; t++) {
          if (s != t) {
            if (d[s][t] > d[s][i] + d[i][t]) {
              p[s][t]=p[s][i];
              d[s][t]=d[s][i] + d[i][t];
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param g
 */
public GraphSPallFloyd(Graph g){
  super(g);
  int V=g.getNodes().length;
  p=new Edge[V][V];
  d=new int[V][V];
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    for (int t=0; t < V; t++) {
      d[s][t]=INF;
    }
  }
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    for (int t=0; t < V; t++) {
      if (g.getEdges().contains(s,t)) {
        p[s][t]=g.getEdges().getEdge(s,t);
        d[s][t]=1;
      }
    }
  }
  System.out.println("String_Node_Str");
  for (int s=0; s < V; s++) {
    d[s][s]=0;
  }
  System.out.println("String_Node_Str");
  for (int i=0; i < V; i++) {
    System.out.println("String_Node_Str" + i);
    for (int s=0; s < V; s++) {
      if (p[s][i] != null) {
        for (int t=0; t < V; t++) {
          if (s != t) {
            if (d[s][t] > d[s][i] + d[i][t]) {
              p[s][t]=p[s][i];
              d[s][t]=d[s][i] + d[i][t];
            }
          }
        }
      }
    }
  }
  System.out.println("String_Node_Str");
  for (int i=0; i < V; i++) {
    for (int j=0; j < V; j++) {
      System.out.println("String_Node_Str" + i + "String_Node_Str"+ j+ "String_Node_Str"+ d[i][j]);
    }
  }
}
Program: 39774
Project: 39774
Buggy source:
public static void main(String[] args){
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
  u.printCentrality(GraphDistance.CLOSENESS);
  NodeSorter sorter=new ClosenessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (  Node n : g.getNodes()) {
    System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(n));
  }
}
Program: 39775
Project: 39775
Buggy source:
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Network nw=new ErdosRenyi(1000,10,true,null);
  Graph g=nw.generate();
  System.out.println("String_Node_Str");
  Node[] nodes=g.getNodes();
  NodeSorter sorter=new BetweennessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  Node[] sorted=sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (int i=0; i < nodes.length; i++) {
    System.out.println(i + "String_Node_Str" + nodes[i]);
  }
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  for (int i=0; i < sorted.length; i++) {
    System.out.println(i + "String_Node_Str" + sorted[i]);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  Node[] nodes=g.getNodes();
  NodeSorter sorter=new ClosenessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  Node[] sorted=sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (int i=0; i < nodes.length; i++) {
    System.out.println(i + "String_Node_Str" + nodes[i]);
  }
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  for (int i=0; i < sorted.length; i++) {
    System.out.println(i + "String_Node_Str" + sorted[i]+ "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(g.getNode(i)));
  }
  System.out.println("String_Node_Str");
  for (  Node n : g.getNodes()) {
    System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(n));
  }
  u.printCentrality(GraphDistance.CLOSENESS);
}
Program: 39777
Project: 39777
Buggy source:
/** 
 * Creates the graph for this network by first placing the hotspots, then placing the nodes within those hotspots. The coordinates of the nodes are stored in an <code>IdentifierSpace</code>, which is added as "ID_SPACE_0" to the attributes of the graph. In the end, the nodes are connected based on that id-space.
 */
@Override public Graph generate(){
  Point center=new Point(getNodeBoxWidth() / 2,getNodeBoxHeight() / 2);
  Point[] hotspotCoords=hotspotPlacer.place(hotspots,center,center,getHotspotBoxWidth(),getHotspotBoxHeight());
  PlanePartitionSimple[] coords=new PlanePartitionSimple[nodes];
  int[] nodesPerSpot=partitioner.partition(nodes,hotspots);
  int temp=0;
  int curNodes;
  for (int i=0; i < hotspots; i++) {
    curNodes=nodesPerSpot[i];
    addNodeCoords(coords,nodePlacer.place(curNodes,hotspotCoords[i],center,getNodeBoxWidth(),getNodeBoxHeight()),temp);
    temp+=curNodes;
  }
  Graph g=new Graph(this.getDescription());
  idSpace=new PlaneIdentifierSpaceSimple(coords,getNodeBoxWidth(),getNodeBoxHeight(),false);
  g.addProperty(g.getNextKey("String_Node_Str"),idSpace);
  Node[] nodes=Node.init(this.getNodes(),g);
  connector.connect(nodes,idSpace,g);
  g.setNodes(nodes);
  return g;
}

Fixed version (ground truth):
/** 
 * Creates the graph for this network by first placing the hotspots, then placing the nodes within those hotspots. The coordinates of the nodes are stored in an <code>IdentifierSpace</code>, which is added as "ID_SPACE_0" to the attributes of the graph. In the end, the nodes are connected based on that id-space.
 */
@Override public Graph generate(){
  Point center=new Point(getNodeBoxWidth() / 2,getNodeBoxHeight() / 2);
  Point[] hotspotCoords=hotspotPlacer.place(hotspots,center,center,getHotspotBoxWidth(),getHotspotBoxHeight());
  PlanePartitionSimple[] coords=new PlanePartitionSimple[nodes];
  idSpace=new PlaneIdentifierSpaceSimple(coords,getNodeBoxWidth(),getNodeBoxHeight(),false);
  int[] nodesPerSpot=partitioner.partition(nodes,hotspots);
  int temp=0;
  int curNodes;
  for (int i=0; i < hotspots; i++) {
    curNodes=nodesPerSpot[i];
    addNodeCoords(coords,nodePlacer.place(curNodes,hotspotCoords[i],center,getNodeBoxWidth(),getNodeBoxHeight()),temp);
    temp+=curNodes;
  }
  Graph g=new Graph(this.getDescription());
  g.addProperty(g.getNextKey("String_Node_Str"),idSpace);
  Node[] nodes=Node.init(this.getNodes(),g);
  connector.connect(nodes,idSpace,g);
  g.setNodes(nodes);
  return g;
}
Program: 39779
Project: 39779
Buggy source:
public static void main(String[] args){
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
  u.printCentrality(GraphDistance.CLOSENESS);
  NodeSorter sorter=new ClosenessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (  Node n : g.getNodes()) {
    System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(n));
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
  NodeSorter sorter=new ClosenessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (  Node n : g.getNodes()) {
    System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(n));
  }
}
Program: 39780
Project: 39780
Buggy source:
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Utils u=new Utils();
  Graph g=u.importGraphFromFile("String_Node_Str");
  System.out.println("String_Node_Str");
  Node[] nodes=g.getNodes();
  NodeSorter sorter=new ClosenessCentralityNodeSorter(NodeSorter.NodeSorterMode.ASC);
  Node[] sorted=sorter.sort(g,new Random());
  System.out.println("String_Node_Str");
  for (int i=0; i < nodes.length; i++) {
    System.out.println(i + "String_Node_Str" + nodes[i]);
  }
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  for (int i=0; i < sorted.length; i++) {
    System.out.println(i + "String_Node_Str" + sorted[i]+ "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(g.getNode(i)));
  }
  System.out.println("String_Node_Str");
  for (  Node n : g.getNodes()) {
    System.out.println("String_Node_Str" + n.toString() + "String_Node_Str"+ ((ClosenessCentralityNodeSorter)sorter).getCentrality(n));
  }
  u.printCentrality(GraphDistance.CLOSENESS);
}

Fixed version (ground truth):
public static void main(String[] args){
  NodeSortingTest.test1();
}
Program: 39781
Project: 39781
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  int times=1;
  Metric greedy=new Routing(new Greedy());
  Metric lookahead=new Routing(new LookaheadSimple());
  Metric[] metrics=new Metric[]{greedy,lookahead};
  Network[] nw=Chord.get(new int[]{1000,2000,3000,4000},128,IDSelection.RANDOM,null);
  Series[] series=Series.generate(nw,metrics,times);
  Plotting.multi(series,metrics,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  Config.overwrite("String_Node_Str","String_Node_Str");
  Config.overwrite("String_Node_Str","String_Node_Str");
  int times=1;
  Metric greedy=new Routing(new Greedy());
  Metric lookahead=new Routing(new LookaheadSimple());
  Metric[] metrics=new Metric[]{greedy,lookahead};
  Network[] nw=Chord.get(new int[]{1000,2000,3000,4000},128,0,IDSelection.RANDOM,null);
  Series[] series=Series.generate(nw,metrics,times);
  Plotting.multi(series,metrics,"String_Node_Str");
}
Program: 39782
Project: 39782
Buggy source:
@Override public void computeData(Graph graph,Network network,HashMap<String,Metric> metrics){
  this.ra.preprocess(graph);
  Random rand=new Random();
  this.routes=new Route[graph.getNodes().length * this.routesPerNode];
  int index=0;
  for (  Node start : graph.getNodes()) {
    for (int i=0; i < this.routesPerNode; i++) {
      this.routes[index++]=ra.routeToRandomTarget(graph,start.getIndex(),rand);
    }
  }
  RoutingThread[] threads=new RoutingThread[Config.getInt("String_Node_Str")];
  for (int i=0; i < threads.length; i++) {
    int start=graph.getNodes().length / threads.length * i;
    int end=graph.getNodes().length / threads.length * (i + 1) - 1;
    if (i == threads.length - 1) {
      end=graph.getNodes().length - 1;
    }
    threads[i]=new RoutingThread(start,end,this.routesPerNode,graph,ra,rand);
    threads[i].start();
  }
  index=0;
  for (  RoutingThread t : threads) {
    try {
      t.join();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    for (    Route r : t.getRoutes()) {
      this.routes[index++]=r;
    }
  }
  this.hopDistribution=this.computeHopDistribution();
  this.hopDistributionAbsolute=this.computeHopDistributionAbsolute();
  this.betweennessCentrality=this.computeBetweennessCentrality(graph.getNodes().length);
  this.successRate=this.computeSuccessRate();
  this.failureRate=1 - this.successRate;
}

Fixed version (ground truth):
@Override public void computeData(Graph graph,Network network,HashMap<String,Metric> metrics){
  this.ra.preprocess(graph);
  Random rand=new Random();
  this.routes=new Route[graph.getNodes().length * this.routesPerNode];
  int index=0;
  int parallel=Config.getInt("String_Node_Str");
  if (parallel > 1) {
    for (    Node start : graph.getNodes()) {
      for (int i=0; i < this.routesPerNode; i++) {
        this.routes[index++]=ra.routeToRandomTarget(graph,start.getIndex(),rand);
      }
    }
  }
 else {
    RoutingThread[] threads=new RoutingThread[parallel];
    for (int i=0; i < threads.length; i++) {
      int start=graph.getNodes().length / threads.length * i;
      int end=graph.getNodes().length / threads.length * (i + 1) - 1;
      if (i == threads.length - 1) {
        end=graph.getNodes().length - 1;
      }
      threads[i]=new RoutingThread(start,end,this.routesPerNode,graph,ra,rand);
      threads[i].start();
    }
    index=0;
    for (    RoutingThread t : threads) {
      try {
        t.join();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
      for (      Route r : t.getRoutes()) {
        this.routes[index++]=r;
      }
    }
  }
  this.hopDistribution=this.computeHopDistribution();
  this.hopDistributionAbsolute=this.computeHopDistributionAbsolute();
  this.betweennessCentrality=this.computeBetweennessCentrality(graph.getNodes().length);
  this.successRate=this.computeSuccessRate();
  this.failureRate=1 - this.successRate;
}
Program: 39783
Project: 39783
Buggy source:
public static SingleList read(Metric metric,String filename){
  if (!(new File(filename)).exists()) {
    return null;
  }
  Filereader fr=new Filereader(filename);
  ArrayList<Single> list=new ArrayList<Single>();
  String line=null;
  String delimiter=Config.get("String_Node_Str");
  while ((line=fr.readLine()) != null) {
    if (line.trim().length() == 0) {
      continue;
    }
    String[] temp=line.split("String_Node_Str");
    if (temp[1].contains(delimiter)) {
      String[] temp2=temp[1].split(delimiter);
      double[] data=new double[temp2.length];
      for (int i=0; i < temp2.length; i++) {
        data[i]=Double.parseDouble(temp2[i]);
      }
      list.add(new Single(temp[0],Double.parseDouble(temp2[0]),data));
    }
 else {
      list.add(new Single(temp[0],Double.parseDouble(temp[1])));
    }
  }
  return new SingleList(metric,list);
}

Fixed version (ground truth):
public static SingleList read(Metric metric,String filename){
  if (!(new File(filename)).exists()) {
    return null;
  }
  Filereader fr=new Filereader(filename);
  ArrayList<Single> list=new ArrayList<Single>();
  String line=null;
  String delimiter=Config.get("String_Node_Str");
  while ((line=fr.readLine()) != null) {
    if (line.trim().length() == 0) {
      continue;
    }
    String[] temp=line.split("String_Node_Str");
    if (temp[1].contains(delimiter)) {
      String[] temp2=temp[1].split(delimiter);
      double[] data=new double[temp2.length];
      for (int i=0; i < temp2.length; i++) {
        data[i]=Double.parseDouble(temp2[i]);
      }
      list.add(new Single(temp[0],Double.parseDouble(temp2[0]),data));
    }
 else {
      list.add(new Single(temp[0],Double.parseDouble(temp[1])));
    }
  }
  fr.close();
  return new SingleList(metric,list);
}
Program: 39784
Project: 39784
Buggy source:
@Override public Node[] sort(Graph g,Random rand){
  Node[] sorted=this.clone(g.getNodes());
  this.roles=(RoleList)g.getProperty("String_Node_Str");
  RolesAsc asc=new RolesAsc(this.order,this.roles);
  Arrays.sort(sorted,asc);
  this.randomize(sorted,rand);
  return sorted;
}

Fixed version (ground truth):
@Override public Node[] sort(Graph g,Random rand){
  Node[] sorted=this.clone(g.getNodes());
  this.roles=(RoleList)g.getProperty("String_Node_Str" + this.key + "String_Node_Str");
  RolesAsc asc=new RolesAsc(this.order,this.roles);
  Arrays.sort(sorted,asc);
  this.randomize(sorted,rand);
  return sorted;
}
Program: 39786
Project: 39786
Buggy source:
public ReadableFolder(String name,String folder,String srcFolder,String extension,Parameter[] parameters,Transformation[] t){
  super(ReadableFolder.key(name,folder),ReadableFolder.getNodes(srcFolder,extension),parameters,t);
  File d=new File(srcFolder);
  if (!d.exists()) {
    this.files=new ArrayList<String>();
  }
 else {
    File[] f=d.listFiles();
    this.files=new ArrayList<String>();
    for (int i=0; i < f.length; i++) {
      if (f[i].getName().endsWith(extension)) {
        this.files.add(f[i].getAbsolutePath());
      }
    }
  }
  this.index=-1;
}

Fixed version (ground truth):
public ReadableFolder(String name,String folder,String srcFolder,String suffix,Parameter[] parameters,Transformation[] t){
  super(ReadableFolder.key(name,folder),ReadableFolder.getNodes(srcFolder,suffix),parameters,t);
  File d=new File(srcFolder);
  if (!d.exists()) {
    this.files=new File[0];
  }
 else {
    this.files=d.listFiles(new SuffixFilenameFilter(suffix));
    Arrays.sort(this.files);
  }
  this.index=0;
}
Program: 39787
Project: 39787
Buggy source:
private static int getNodes(String srcFolder,String extension){
  File d=new File(srcFolder);
  if (!d.exists()) {
    return 0;
  }
  File[] f=d.listFiles();
  if (f.length == 0) {
    return 0;
  }
  int index=0;
  while (!f[index].getName().endsWith(extension)) {
    index++;
  }
  return new GtnaGraphReader().nodes(f[index].getAbsolutePath());
}

Fixed version (ground truth):
private static int getNodes(String srcFolder,String suffix){
  File d=new File(srcFolder);
  if (!d.exists()) {
    return 0;
  }
  File[] f=d.listFiles(new SuffixFilenameFilter(suffix));
  if (f.length == 0) {
    return 0;
  }
  return new GtnaGraphReader().nodes(f[0].getAbsolutePath());
}
Program: 39788
Project: 39788
Buggy source:
public Graph generate(){
  if (this.files.size() == 0) {
    return null;
  }
  this.index=(this.index + 1) % this.files.size();
  Graph graph=new GtnaGraphReader().readWithProperties(this.files.get(this.index));
  graph.setName(this.getDescription());
  return graph;
}

Fixed version (ground truth):
public Graph generate(){
  if (this.files.length == 0) {
    return null;
  }
  Graph graph=new GtnaGraphReader().readWithProperties(this.files[this.index].getAbsolutePath());
  graph.setName(this.getDescription());
  this.incIndex();
  return graph;
}
Program: 39789
Project: 39789
Buggy source:
public ArrayList<String> getFiles(){
  return this.files;
}

Fixed version (ground truth):
public File[] getFiles(){
  return this.files;
}
Program: 39790
Project: 39790
Buggy source:
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  double newID=this.getDecision(rand,q);
  if (this.partnerID != -1) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(newID);
}

Fixed version (ground truth):
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  int newID=this.getDecision(rand,q);
  if (this.partnerID != -1) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(ids[newID]);
}
Program: 39791
Project: 39791
Buggy source:
/** 
 * init IdSpace from a graph g
 * @param g
 */
public void initIds(Graph g){
  GraphProperty[] gp=g.getProperties("String_Node_Str");
  GraphProperty p=gp[gp.length - 1];
  DIdentifierSpace idSpaceD=(DIdentifierSpace)p;
  this.ids=new RingIdentifier[g.getNodes().length];
  for (int i=0; i < ids.length; i++) {
    ids[i]=(RingIdentifier)idSpaceD.getPartitions()[i].getRepresentativeID();
  }
}

Fixed version (ground truth):
/** 
 * init IdSpace from a graph g
 * @param g
 */
public void initIds(){
  DIdentifierSpace idSpaceD=this.getIdspace();
  this.ids=new RingIdentifier[idSpaceD.getPartitions().length];
  for (int i=0; i < ids.length; i++) {
    ids[i]=(RingIdentifier)idSpaceD.getPartitions()[i].getRepresentativeID();
  }
}
Program: 39793
Project: 39793
Buggy source:
@Override protected AttackableEmbeddingNode[] generateNodes(Graph g,Random rand){
  AttackableEmbeddingNode[] nodes=new AttackableEmbeddingNode[g.getNodes().length];
  HashSet<Integer> map=this.getAttackers(g,rand);
  for (int i=0; i < g.getNodes().length; i++) {
    if (map.contains(i)) {
      nodes[i]=new KleinbergNode(i,g,this,true);
    }
 else {
      nodes[i]=new KleinbergNode(i,g,this,false);
    }
  }
  this.init(g,nodes);
  this.initIds(g);
  return nodes;
}

Fixed version (ground truth):
@Override protected AttackableEmbeddingNode[] generateNodes(Graph g,Random rand){
  AttackableEmbeddingNode[] nodes=new AttackableEmbeddingNode[g.getNodes().length];
  HashSet<Integer> map=this.getAttackers(g,rand);
  for (int i=0; i < g.getNodes().length; i++) {
    if (map.contains(i)) {
      nodes[i]=new KleinbergNode(i,g,this,true);
    }
 else {
      nodes[i]=new KleinbergNode(i,g,this,false);
    }
  }
  this.init(g,nodes);
  this.initIds();
  return nodes;
}
Program: 39794
Project: 39794
Buggy source:
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  int newID=this.getDecision(rand,q);
  if (this.partnerID != -1) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(ids[newID]);
}

Fixed version (ground truth):
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  int newID=this.getDecision(rand,q);
  if (this.partnerID != -1 && q[newID] != this.id) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(ids[newID]);
}
Program: 39795
Project: 39795
Buggy source:
@Override protected double[][] swap(double callerID,double[] neighborsID,int ttl,Random rand){
  if (this.isAttacker) {
    double[][] res=new double[2][];
    AttackerIQDEmbedding attEmbedding=(AttackerIQDEmbedding)this.embedding;
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.CONTRACTION) {
      res[0]=new double[]{this.ask(rand,this)};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.DIVERGENCE) {
      res[0]=new double[]{rand.nextDouble()};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.REJECTION) {
      res[0]=new double[]{(maxMiddle(neighborsID) + rand.nextDouble() * close) % 1.0};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    return res;
  }
 else {
    return super.swap(callerID,neighborsID,ttl,rand);
  }
}

Fixed version (ground truth):
@Override protected double[][] swap(double callerID,double[] neighborsID,int ttl,Random rand){
  if (this.isAttacker) {
    double[][] res=new double[2][];
    AttackerIQDEmbedding attEmbedding=(AttackerIQDEmbedding)this.embedding;
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.CONTRACTION) {
      res[0]=new double[]{this.ask(rand,this),-1};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.DIVERGENCE) {
      res[0]=new double[]{rand.nextDouble(),-1};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    if (attEmbedding.getAttackertype() == AttackerIQDEmbedding.AttackerType.REJECTION) {
      res[0]=new double[]{(maxMiddle(neighborsID) + rand.nextDouble() * close) % 1.0,-1};
      res[1]=new double[this.knownIDs.length];
      for (int i=0; i < res[1].length; i++) {
        res[1][i]=(callerID + close * rand.nextDouble()) % 1;
      }
    }
    return res;
  }
 else {
    return super.swap(callerID,neighborsID,ttl,rand);
  }
}
Program: 39797
Project: 39797
Buggy source:
@Override public double[] getQuality(Random rand,double[] ids){
  double[] q=new double[ids.length];
  for (int i=0; i < ids.length; i++) {
    q[i]=1;
    for (int j=0; j < this.knownIDs.length; j++) {
      if (ids[i] != this.knownIDs[j])       q[i]=q[i] * this.embedding.computeDistance(this.knownIDs[j],ids[i]);
    }
    if (this.embedding.getIdMethod() == IQDEmbedding.IdentifierMethod.SWAPPING) {
      for (int k=0; k < this.swapped.length; k++) {
        if (ids[i] != this.swapped[k])         q[i]=q[i] * this.embedding.computeDistance(this.swapped[k],ids[i]);
      }
    }
    q[i]=1 / q[i];
  }
  return q;
}

Fixed version (ground truth):
@Override public double[] getQuality(Random rand,double[] ids){
  double[] q=new double[ids.length];
  for (int i=0; i < ids.length; i++) {
    q[i]=1;
    for (int j=0; j < this.knownIDs.length; j++) {
      if (ids[i] != this.knownIDs[j]) {
        q[i]=q[i] * this.embedding.computeDistance(ids[i],this.knownIDs[j]);
      }
 else {
        q[i]=q[i] * this.embedding.computeDistance(ids[i],ids[(i + 1) % 2]);
      }
    }
    if (this.embedding.getIdMethod() == IQDEmbedding.IdentifierMethod.SWAPPING) {
      for (int k=0; k < this.swapped.length; k++) {
        if (ids[i] != this.swapped[k]) {
          q[i]=q[i] * this.embedding.computeDistance(ids[(i + 1) % 2],this.swapped[k]);
        }
 else {
          q[i]=q[i] * this.embedding.computeDistance(ids[i],ids[(i + 1) % 2]);
        }
      }
    }
    q[i]=1 / q[i];
  }
  return q;
}
Program: 39798
Project: 39798
Buggy source:
public LMCEmbedding(int iterations,Distance distance,double epsilon,AttackerType type,AttackerSelection selection,int attackercount){
  super("String_Node_Str",iterations,IQDEmbedding.IdentifierMethod.ONERANDOM,IQDEmbedding.DecisionMethod.METROPOLIS,distance,epsilon,false,false,type,selection,attackercount);
}

Fixed version (ground truth):
public LMCEmbedding(int iterations,Distance distance,double epsilon,AttackerType type,AttackerSelection selection,int attackercount){
  super(iterations,IQDEmbedding.IdentifierMethod.ONERANDOM,IQDEmbedding.DecisionMethod.METROPOLIS,distance,epsilon,false,false,type,selection,attackercount);
}
Program: 39799
Project: 39799
Buggy source:
public SwappingEmbedding(int iterations,Distance distance,double epsilon,AttackerType type,AttackerSelection selection,int attackercount){
  super("String_Node_Str",iterations,IQDEmbedding.IdentifierMethod.SWAPPING,IQDEmbedding.DecisionMethod.METROPOLIS,distance,epsilon,false,false,type,selection,attackercount);
}

Fixed version (ground truth):
public SwappingEmbedding(int iterations,Distance distance,double epsilon,AttackerType type,AttackerSelection selection,int attackercount){
  super(iterations,IQDEmbedding.IdentifierMethod.SWAPPING,IQDEmbedding.DecisionMethod.METROPOLIS,distance,epsilon,false,false,type,selection,attackercount);
}
Program: 39800
Project: 39800
Buggy source:
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  int newID=this.getDecision(rand,q);
  if (this.partnerID != -1 && q[newID] != this.id) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(ids[newID]);
}

Fixed version (ground truth):
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  int newID=this.getDecision(rand,q);
  if (this.partnerID != -1 && ids[newID] != this.id) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(ids[newID]);
}
Program: 39801
Project: 39801
Buggy source:
public void setID(double id){
  this.id=id;
}

Fixed version (ground truth):
public void setID(Node caller,double id){
  this.id=id;
}
Program: 39802
Project: 39802
Buggy source:
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  this.setID(ids[this.getDecision(rand,q)]);
}

Fixed version (ground truth):
@Override public void turn(Random rand){
  double[] ids=this.getIdentifiers(rand);
  double[] q=this.getQuality(rand,ids);
  double newID=this.getDecision(rand,q);
  if (this.partnerID != -1) {
    ((IQDNode)this.getGraph().getNode(this.partnerID)).setID(this,this.getID());
  }
  this.setID(newID);
}
Program: 39803
Project: 39803
Buggy source:
protected double[][] swap(double callerID,double[] neighborsID,int ttl,Random rand){
  if (ttl <= 1) {
    double[][] res=new double[2][];
    res[0]=new double[]{this.getID()};
    res[1]=this.knownIDs;
    return res;
  }
 else {
    int[] out=this.getOutgoingEdges();
    return ((IdentifierNode)this.getGraph().getNode(out[rand.nextInt(out.length)])).swap(callerID,neighborsID,ttl - 1,rand);
  }
}

Fixed version (ground truth):
protected double[][] swap(double callerID,double[] neighborsID,int ttl,Random rand){
  if (ttl <= 1) {
    double[][] res=new double[2][];
    res[0]=new double[]{this.getID(),this.getIndex()};
    res[1]=this.knownIDs;
    return res;
  }
 else {
    int[] out=this.getOutgoingEdges();
    return ((IdentifierNode)this.getGraph().getNode(out[rand.nextInt(out.length)])).swap(callerID,neighborsID,ttl - 1,rand);
  }
}
Program: 39806
Project: 39806
Buggy source:
@Override public double[] getQuality(Random rand,double[] ids){
  double[] res=new double[ids.length];
  double log2=Math.log(2);
  double dist;
  int r;
  int max=((RegionCoverageEmbedding)this.embedding).getMax();
  for (int i=0; i < res.length; i++) {
    Vector<Integer> numb=new Vector<Integer>(this.knownIDs.length);
    for (int j=0; j < this.knownIDs.length; j++) {
      dist=this.embedding.computeDistance(this.knownIDs[j],ids[i]);
      r=(int)(Math.min(Math.ceil(-Math.log(Math.abs(dist)) / log2),max) * Math.signum(dist));
      if (!numb.contains(r)) {
        numb.add(r);
      }
      if (this.embedding.getDistance() == Distance.SIGNED && numb.size() == 2 * (max - 1)) {
        break;
      }
      if (this.embedding.getDistance() == Distance.RING && numb.size() == (max - 1)) {
        break;
      }
      if (this.embedding.getDistance() == Distance.CLOCKWISE && numb.size() == max) {
        break;
      }
    }
    res[i]=numb.size();
  }
  return res;
}

Fixed version (ground truth):
@Override public double[] getQuality(Random rand,double[] ids){
  double[] res=new double[ids.length];
  double log2=Math.log(2);
  double dist;
  int r;
  int max=((RegionCoverageEmbedding)this.embedding).getMax();
  for (int i=0; i < res.length; i++) {
    Vector<Integer> numb=new Vector<Integer>(this.knownIDs.length);
    for (int j=0; j < this.knownIDs.length; j++) {
      if (ids[i] != this.knownIDs[j]) {
        dist=this.embedding.computeDistance(ids[i],this.knownIDs[j]);
      }
 else {
        dist=this.embedding.computeDistance(ids[i],ids[(i + 1) % 2]);
      }
      r=(int)(Math.min(Math.ceil(-Math.log(Math.abs(dist)) / log2),max) * Math.signum(dist));
      if (!numb.contains(r)) {
        numb.add(r);
      }
      if (this.embedding.getDistance() == Distance.SIGNED && numb.size() == 2 * (max - 1)) {
        break;
      }
      if (this.embedding.getDistance() == Distance.RING && numb.size() == (max - 1)) {
        break;
      }
      if (this.embedding.getDistance() == Distance.CLOCKWISE && numb.size() == max) {
        break;
      }
    }
    res[i]=numb.size();
    if (this.embedding.getIdMethod() == IdentifierMethod.SWAPPING) {
      numb=new Vector<Integer>(this.swapped.length);
      for (int j=0; j < this.swapped.length; j++) {
        if (ids[i] != this.swapped[j]) {
          dist=this.embedding.computeDistance(ids[(i + 1) % 2],this.swapped[j]);
        }
 else {
          dist=this.embedding.computeDistance(ids[(i + 1) % 2],ids[i]);
        }
        r=(int)(Math.min(Math.ceil(-Math.log(Math.abs(dist)) / log2),max) * Math.signum(dist));
        if (!numb.contains(r)) {
          numb.add(r);
        }
        if (this.embedding.getDistance() == Distance.SIGNED && numb.size() == 2 * (max - 1)) {
          break;
        }
        if (this.embedding.getDistance() == Distance.RING && numb.size() == (max - 1)) {
          break;
        }
        if (this.embedding.getDistance() == Distance.CLOCKWISE && numb.size() == max) {
          break;
        }
      }
      res[i]=res[i] + numb.size();
    }
  }
  return res;
}
Program: 39807
Project: 39807
Buggy source:
private static Parameter[] combineParameter(IdentifierMethod idMethod,DecisionMethod deMethod,Distance distance,double epsilon,boolean checkold,boolean adjustone,Parameter[] parameters){
  Parameter[] res=new Parameter[parameters.length + 6];
  res[0]=new StringParameter("String_Node_Str",idMethod.toString());
  res[1]=new StringParameter("String_Node_Str",deMethod.toString());
  res[2]=new DoubleParameter("String_Node_Str",epsilon);
  res[3]=new BooleanParameter("String_Node_Str",checkold);
  res[4]=new StringParameter("String_Node_Str",distance.toString());
  res[5]=new BooleanParameter("String_Node_Str",adjustone);
  for (int i=6; i < res.length; i++) {
    res[i]=parameters[i - 4];
  }
  return res;
}

Fixed version (ground truth):
private static Parameter[] combineParameter(IdentifierMethod idMethod,DecisionMethod deMethod,Distance distance,double epsilon,boolean checkold,boolean adjustone,Parameter[] parameters){
  Parameter[] res=new Parameter[parameters.length + 6];
  res[0]=new StringParameter("String_Node_Str",idMethod.toString());
  res[1]=new StringParameter("String_Node_Str",deMethod.toString());
  res[2]=new DoubleParameter("String_Node_Str",epsilon);
  res[3]=new BooleanParameter("String_Node_Str",checkold);
  res[4]=new StringParameter("String_Node_Str",distance.toString());
  res[5]=new BooleanParameter("String_Node_Str",adjustone);
  for (int i=6; i < res.length; i++) {
    res[i]=parameters[i - 6];
  }
  return res;
}
Program: 39808
Project: 39808
Buggy source:
public static String key(String name,String folder){
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",folder);
  return "String_Node_Str" + folder;
}

Fixed version (ground truth):
public static String key(String name,String folder){
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",name);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",folder);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",folder);
  Config.overwrite("String_Node_Str" + folder + "String_Node_Str",folder);
  return "String_Node_Str" + folder;
}