nus-yam/ex-repair huggingface dataset:
Program: 59249
Project: 59249
Buggy source:
@Test public void CountToJSON() throws Exception {
  Aggregates<Integer> ref=count;
  Schema s=new SchemaComposer().addResource("String_Node_Str").resolved();
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  AggregateSerializer.serialize(ref,baos,s,FORMAT.JSON,new Converters.FromCount(s));
  String output=new String(baos.toByteArray(),"String_Node_Str");
  try (JsonParser p=new JsonFactory().createJsonParser(output)){
    ObjectMapper mapper=new ObjectMapper();
    JsonNode n=mapper.readTree(p);
    assertEquals(ref.lowX(),n.get("String_Node_Str").getIntValue());
    assertEquals(ref.lowY(),n.get("String_Node_Str").getIntValue());
    assertEquals(ref.highX(),n.get("String_Node_Str").getIntValue());
    assertEquals(ref.highY(),n.get("String_Node_Str").getIntValue());
  }
 }

Fixed version (ground truth):
@Test public void CountToJSON() throws Exception {
  Aggregates<Integer> ref=count;
  Schema s=new SchemaComposer().addResource("String_Node_Str").resolved();
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  AggregateSerializer.serialize(ref,baos,s,FORMAT.JSON,new Converters.FromCount(s));
  String output=new String(baos.toByteArray(),"String_Node_Str");
  try (JsonParser p=new JsonFactory().createJsonParser(output)){
    ObjectMapper mapper=new ObjectMapper();
    JsonNode n=mapper.readTree(p);
    int xOffset=n.get("String_Node_Str").getIntValue();
    int yOffset=n.get("String_Node_Str").getIntValue();
    int highX=n.get("String_Node_Str").getIntValue() + xOffset;
    int highY=n.get("String_Node_Str").getIntValue() + yOffset;
    assertEquals(ref.lowX(),xOffset);
    assertEquals(ref.lowY(),yOffset);
    assertEquals(ref.highX(),highX);
    assertEquals(ref.highY(),highY);
  }
 }
Program: 59250
Project: 59250
Buggy source:
@BeforeClass public static void load() throws Exception {
  Glyphset<Rectangle2D,Color> glyphs=GlyphsetUtils.autoLoad(new File("String_Node_Str"),.1,DynamicQuadTree.<Rectangle2D,Color>make());
  Renderer r=new ParallelRenderer();
  AffineTransform vt=new AffineTransform(241.4615556310524,0.0,0.0,241.4615556310524,238.49100176586487,236.13546883394775);
  Selector<Rectangle2D> s=TouchesPixel.make(glyphs);
  count=r.aggregate(glyphs,s,new Numbers.Count<Object>(),vt,500,500);
  rles=r.aggregate(glyphs,s,new Categories.CountCategories<Color>(Util.COLOR_SORTER),vt,500,500);
}

Fixed version (ground truth):
@BeforeClass public static void load() throws Exception {
  Glyphset<Rectangle2D,Color> glyphs=GlyphsetUtils.autoLoad(new File("String_Node_Str"),.1,DynamicQuadTree.<Rectangle2D,Color>make());
  Renderer r=new ParallelRenderer();
  AffineTransform vt=new AffineTransform(241.4615556310524,0.0,0.0,241.4615556310524,238.49100176586487,236.13546883394775);
  Selector<Rectangle2D> s=TouchesPixel.make(glyphs);
  count=r.aggregate(glyphs,s,new Numbers.Count<Object>(),vt,500,500);
  cocs=r.aggregate(glyphs,s,new Categories.CountCategories<Color>(Util.COLOR_SORTER),vt,500,500);
}
Program: 59251
Project: 59251
Buggy source:
/** 
 * What bounding box closely contains all of the glyphs passed.
 */
public static Rectangle2D bounds(Rectangle2D... rs){
  Rectangle2D bounds=new Rectangle2D.Double(0,0,-1,-1);
  for (  Rectangle2D r : rs) {
    if (r != null) {
      add(bounds,r);
    }
  }
  return bounds;
}

Fixed version (ground truth):
/** 
 * What bounding box closely contains all of the glyphs passed.
 */
public static Rectangle2D bounds(Rectangle2D... rs){
  Rectangle2D bounds=rs[0].getBounds2D();
  for (  Rectangle2D r : rs) {
    if (r != null) {
      add(bounds,r);
    }
  }
  return bounds;
}
Program: 59252
Project: 59252
Buggy source:
/** 
 * After carving out seams, any crossing seams need to be straightened to preserve the 1:1 matching between rows. If items are matched like so and A is carved .... A   B            B \ /     ===>   / / \           /  C   D            C Notice that B now points off the grid and C has no match.  But it is easy to patch up, all diagonals happen in pairs, so Just set B to match DOWN instead of LEFT and you are fixed.  Fixes only need to happen along the old seam where the link was not down.
 * @param seam  The seam removed
 * @param oldMatching What the matching values were (used to check for non-down links)
 * @param newMatching The post-carved links (updated in place)
 */
public static Aggregates<Integer> repairMatching(final int[] seam,Aggregates<Integer> oldMatching,Aggregates<Integer> newMatching){
  for (int i=0; i < seam.length; i++) {
    int x=seam[i];
    int y=i + oldMatching.lowY();
    int oldDir=oldMatching.get(x,y);
    if (oldDir == 1) {
      newMatching.set(x - 1,y,ZERO);
    }
 else     if (oldDir == -1) {
      newMatching.set(x,y,ZERO);
    }
  }
  return newMatching;
}

Fixed version (ground truth):
/** 
 * After carving out seams, any crossing seams need to be straightened to preserve the 1:1 matching between rows. If items are matched like so and A is carved .... A   B            B \ /     ===>   / / \           /  C   D            C Notice that B now points off the grid and C has no match.  But it is easy to patch up, all diagonals happen in pairs, so Just set B to match DOWN instead of LEFT and you are fixed.  Fixes only need to happen along the old seam where the link was not down.
 * @param seam  The seam removed
 * @param oldMatching What the matching values were (used to check for non-down links)
 * @param newMatching The post-carved links (updated in place)
 */
public static Aggregates<Integer> repairMatching(final int[] seam,Aggregates<Integer> oldMatching,Aggregates<Integer> newMatching){
  for (int i=0; i < seam.length; i++) {
    int x=seam[i];
    int y=i + oldMatching.lowY();
    int oldDir=oldMatching.get(x,y);
    if (oldDir == 1) {
      newMatching.set(x,y,ZERO);
    }
 else     if (oldDir == -1) {
      newMatching.set(x - 1,y,ZERO);
    }
  }
  return newMatching;
}
Program: 59253
Project: 59253
Buggy source:
public Aggregates<A> vertical(Aggregates<? extends A> aggregates,Renderer rend){
  Aggregates<Double> pixelEnergy=rend.transfer(aggregates,new Energy<>(delta));
  EdgeEnergy energy=new EdgeEnergy(pixelEnergy);
  Aggregates<Integer> matchings=AggregateUtils.make(aggregates,Integer.MIN_VALUE);
  for (int k=aggregates.lowY(); k < aggregates.highY(); k++) {
    double F1=0, F2=0, F3=0;
    for (int m=aggregates.lowX(); m < aggregates.highX(); m++) {
      double CZ=energy.between(m,k,m,k + 1);
      double CY=energy.between(m,k,m - 1,k + 1);
      double BZ=energy.between(m - 1,k,m,k + 1);
      double AX=energy.between(m - 2,k,m - 2,k + 1);
      if (matchings.get(m - 2,k) == m - 1) {
        double FA=F1 + CZ;
        double FB=F3 + CY + BZ+ AX;
        if (FA > FB) {
          matchings.set(k,m,0);
          F3=F2;
          F2=F1;
          F1=FA;
        }
 else {
          matchings.set(k,m,-1);
          matchings.set(k,m - 1,1);
          matchings.set(k,m - 2,0);
          F3=F2;
          F2=F1;
          F1=FB;
        }
      }
 else {
        double FA=F1 + CZ;
        double FB=F2 + CY + BZ;
        if (FA > FB) {
          matchings.set(k,m,0);
          F3=F2;
          F2=F1;
          F1=FA;
        }
 else {
          matchings.set(k,m,-1);
          matchings.set(k,m - 1,1);
          F3=F2;
          F2=F1;
          F1=FB;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Aggregates<A> vertical(Aggregates<? extends A> aggregates,Renderer rend){
  Aggregates<Double> pixelEnergy=rend.transfer(aggregates,new Energy<>(delta));
  EdgeEnergy energy=new EdgeEnergy(pixelEnergy);
  Aggregates<Integer> matchings=matchings(pixelEnergy,energy);
  double[] seamEnergies=new double[pixelEnergy.highX() - pixelEnergy.lowX()];
  for (int x=pixelEnergy.lowX(); x < pixelEnergy.highX(); x++) {
    int sourceX=x;
    for (int y=pixelEnergy.lowY(); y < pixelEnergy.highY(); y++) {
      int targetX=sourceX + matchings.get(sourceX,y);
      seamEnergies[x]+=energy.between(sourceX,y,targetX,y + 1);
      sourceX=targetX;
    }
  }
  SortedMap<Double,List<Integer>> seamOrder=new TreeMap<>();
  for (int i=0; i < seamEnergies.length; ++i) {
    Double seamEnergy=seamEnergies[i];
    List<Integer> idxs=seamOrder.get(seamEnergy);
    if (idxs == null) {
      idxs=new ArrayList<>();
    }
    int size=idxs.size() + 1;
    idxs.add(((size + 1) * 7253) % size,i);
    seamOrder.put(seamEnergy,idxs);
  }
  @SuppressWarnings("String_Node_Str") Aggregates<A> result=(Aggregates<A>)aggregates;
  for (int i=0; i < seams; i++) {
    List<Integer> headList=seamOrder.get(seamOrder.firstKey());
    int targetSeam=headList.get(0);
    headList.remove(0);
    if (headList.size() == 0) {
      seamOrder.remove(seamOrder.firstKey());
    }
    int[] seam=compileVSeam(targetSeam,matchings);
    result=carve(result,seam);
    matchings=carve(matchings,seam);
  }
  return result;
}
Program: 59254
Project: 59254
Buggy source:
public LocalCarve(Delta<A> delta,Direction dir,A empty,int seams){
  this.delta=delta;
  this.empty=empty;
  this.dir=dir;
  this.seams=seams;
}

Fixed version (ground truth):
/** 
 * @param delta Comparison function used to compute the energy matrix
 * @param dir Direction seams run
 * @param empty 
 * @param seams How many seams to remove
 */
public LocalCarve(Delta<A> delta,Direction dir,A empty,int seams){
  this.delta=delta;
  this.empty=empty;
  this.dir=dir;
  this.seams=seams;
}
Program: 59255
Project: 59255
Buggy source:
@Test public void testMidSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)Math.abs(x - cumEng.highX() / 2));
    }
  }
  int[] seam=SeamCarving.Carve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (  int e : seam) {
    assertThat(e,is(4));
  }
}

Fixed version (ground truth):
@Test public void testMidSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)Math.abs(x - cumEng.highX() / 2));
    }
  }
  int[] seam=SeamCarving.OptimalCarve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (  int e : seam) {
    assertThat(e,is(4));
  }
}
Program: 59256
Project: 59256
Buggy source:
@Test public void testFindRightSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)-x);
    }
  }
  int[] seam=SeamCarving.Carve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat("String_Node_Str" + i,seam[i],is(cumEng.highX() - 1));
  }
}

Fixed version (ground truth):
@Test public void testFindRightSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)-x);
    }
  }
  int[] seam=SeamCarving.OptimalCarve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat("String_Node_Str" + i,seam[i],is(cumEng.highX() - 1));
  }
}
Program: 59257
Project: 59257
Buggy source:
@Test public void testFindLeftSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)x);
    }
  }
  int[] seam=SeamCarving.Carve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat("String_Node_Str" + i,seam[i],is(0));
  }
}

Fixed version (ground truth):
@Test public void testFindLeftSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,0d);
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
      cumEng.set(x,y,(double)x);
    }
  }
  int[] seam=SeamCarving.OptimalCarve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat("String_Node_Str" + i,seam[i],is(0));
  }
}
Program: 59258
Project: 59258
Buggy source:
@Test public void testDiagSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,10d);
  for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
    cumEng.set(y,y,0d);
  }
  int[] seam=SeamCarving.Carve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat(seam[i],is(i));
  }
}

Fixed version (ground truth):
@Test public void testDiagSeam(){
  Aggregates<Double> cumEng=AggregateUtils.make(9,9,10d);
  for (int y=cumEng.lowY(); y < cumEng.highY(); y++) {
    cumEng.set(y,y,0d);
  }
  int[] seam=SeamCarving.OptimalCarve.findVSeam(cumEng);
  assertThat(seam.length,is(cumEng.highY() - cumEng.lowY()));
  for (int i=0; i < seam.length; i++) {
    assertThat(seam[i],is(i));
  }
}
Program: 59259
Project: 59259
Buggy source:
/** 
 * Remove N seams.
 * @param aggregates Item to carve
 * @param dropList List of items to remove.  For x=int[A][B], x is the B'th x index to drop in row A (i.e., a sorted transpose of a seam list).
 */
public static <A>Aggregates<A> carveN(final Aggregates<? extends A> aggregates,final int[][] dropList){
  Aggregates<A> result=AggregateUtils.make(aggregates,(A)aggregates.defaultValue());
  for (int y=aggregates.lowY(); y < aggregates.highY(); y++) {
    int i=y - aggregates.lowY();
    int dropCount=0;
    for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
      if (dropList[i][dropCount] == x) {
        dropCount++;
        continue;
      }
      result.set(x - dropCount,y,aggregates.get(x,y));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Remove N seams.
 * @param aggregates Item to carve
 * @param dropList List of items to remove.  For x=int[A][B], x is the B'th x index to drop in row A (i.e., a sorted transpose of a seam list).
 */
public static <A>Aggregates<A> carveN(final Aggregates<? extends A> aggregates,final int[][] dropList){
  Aggregates<A> result=AggregateUtils.make(aggregates.lowX(),aggregates.lowY(),aggregates.highX() - dropList[0].length,aggregates.highY(),(A)aggregates.defaultValue());
  for (int y=aggregates.lowY(); y < aggregates.highY(); y++) {
    int i=y - aggregates.lowY();
    int dropCount=0;
    for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
      if (dropList[i][dropCount] == x) {
        dropCount++;
        continue;
      }
      result.set(x - dropCount,y,aggregates.get(x,y));
    }
  }
  return result;
}
Program: 59261
Project: 59261
Buggy source:
/** 
 * Tool to aggregate of pairs into pair of aggregates. In some ways, this is the converse of wrapping two aggregates into a composite with a Pairer. TODO: Is it possible to test if aggs already is a CompositeWrapper with the requested left/right values?
 */
public static final <L,R>CompositeWrapper<L,R,Pair<L,R>> convert(Aggregates<Pair<L,R>> aggs,L leftEmpty,R rightEmpty){
  Aggregates<L> leftAggs=AggregateUtils.make(aggs,leftEmpty);
  Aggregates<R> rightAggs=AggregateUtils.make(aggs,rightEmpty);
  for (int x=aggs.lowX(); x < aggs.highX(); x++) {
    for (int y=aggs.lowY(); y < aggs.lowY(); y++) {
      Pair<L,R> v=aggs.get(x,y);
      leftAggs.set(x,y,v.left);
      rightAggs.set(x,y,v.right);
    }
  }
  return new CompositeWrapper<>(leftAggs,rightAggs,new Pairer<L,R>());
}

Fixed version (ground truth):
/** 
 * Tool to aggregate of pairs into pair of aggregates. In some ways, this is the converse of wrapping two aggregates into a composite with a Pairer. TODO: Is it possible to test if aggs already is a CompositeWrapper with the requested left/right values?
 */
public static final <L,R>CompositeWrapper<L,R,Pair<L,R>> convert(Aggregates<Pair<L,R>> aggs,L leftEmpty,R rightEmpty){
  Aggregates<L> leftAggs=AggregateUtils.make(aggs,leftEmpty);
  Aggregates<R> rightAggs=AggregateUtils.make(aggs,rightEmpty);
  for (int x=aggs.lowX(); x < aggs.highX(); x++) {
    for (int y=aggs.lowY(); y < aggs.highY(); y++) {
      Pair<L,R> v=aggs.get(x,y);
      leftAggs.set(x,y,v.left);
      rightAggs.set(x,y,v.right);
    }
  }
  return new CompositeWrapper<>(leftAggs,rightAggs,new Pairer<L,R>());
}
Program: 59263
Project: 59263
Buggy source:
public boolean validPoint(int x,int y){
  return x >= pixelEnergy.lowX() && x < pixelEnergy.highX() && y >= pixelEnergy.lowY() && x < pixelEnergy.highY();
}

Fixed version (ground truth):
public boolean validPoint(int x,int y){
  return x >= pixelEnergy.lowX() && x < pixelEnergy.highX() && y >= pixelEnergy.lowY() && y < pixelEnergy.highY();
}
Program: 59264
Project: 59264
Buggy source:
public Aggregates<A> vertical(Aggregates<? extends A> aggregates,Renderer rend){
  Aggregates<Double> pixelEnergy=rend.transfer(aggregates,new Energy<>(delta));
  EdgeEnergy energy=new EdgeEnergy(pixelEnergy);
  Aggregates<Integer> matchings=matchings(pixelEnergy,energy);
  double[] seamEnergies=new double[pixelEnergy.highX() - pixelEnergy.lowX()];
  for (int x=pixelEnergy.lowX(); x < pixelEnergy.highX(); x++) {
    int sourceX=x;
    for (int y=pixelEnergy.lowY(); y < pixelEnergy.highY(); y++) {
      int targetX=sourceX + matchings.get(sourceX,y);
      seamEnergies[x]+=energy.between(sourceX,y,targetX,y + 1);
      sourceX=targetX;
    }
  }
  SortedMap<Double,List<Integer>> seamOrder=new TreeMap<>();
  for (int i=0; i < seamEnergies.length; ++i) {
    Double seamEnergy=seamEnergies[i];
    List<Integer> idxs=seamOrder.get(seamEnergy);
    if (idxs == null) {
      idxs=new ArrayList<>();
    }
    int size=idxs.size() + 1;
    idxs.add(((size + 1) * 7253) % size,i);
    seamOrder.put(seamEnergy,idxs);
  }
  @SuppressWarnings("String_Node_Str") Aggregates<A> result=(Aggregates<A>)aggregates;
  for (int i=0; i < seams; i++) {
    List<Integer> headList=seamOrder.get(seamOrder.firstKey());
    int targetSeam=headList.get(0);
    headList.remove(0);
    if (headList.size() == 0) {
      seamOrder.remove(seamOrder.firstKey());
    }
    int[] seam=compileVSeam(targetSeam,matchings);
    result=carve(result,seam);
    matchings=carve(matchings,seam);
  }
  return result;
}

Fixed version (ground truth):
public Aggregates<A> vertical(Aggregates<? extends A> aggregates,Renderer rend){
  Aggregates<Double> pixelEnergy=rend.transfer(aggregates,new Energy<>(delta));
  EdgeEnergy energy=new EdgeEnergy(pixelEnergy);
  Aggregates<Integer> matchings=matchings(pixelEnergy,energy);
  double[] seamEnergies=new double[pixelEnergy.highX() - pixelEnergy.lowX()];
  for (int x=pixelEnergy.lowX(); x < pixelEnergy.highX(); x++) {
    int sourceX=x;
    for (int y=pixelEnergy.lowY(); y < pixelEnergy.highY() - 1; y++) {
      int targetX=sourceX + matchings.get(sourceX,y);
      seamEnergies[x]+=energy.between(sourceX,y,targetX,y + 1);
      sourceX=targetX;
    }
  }
  SortedMap<Double,List<Integer>> seamOrder=new TreeMap<>();
  for (int i=0; i < seamEnergies.length; ++i) {
    Double seamEnergy=seamEnergies[i];
    List<Integer> idxs=seamOrder.get(seamEnergy);
    if (idxs == null) {
      idxs=new ArrayList<>();
    }
    int size=idxs.size() + 1;
    idxs.add(((size + 1) * 7253) % size,i);
    seamOrder.put(seamEnergy,idxs);
  }
  @SuppressWarnings("String_Node_Str") Aggregates<A> result=(Aggregates<A>)aggregates;
  for (int i=0; i < seams; i++) {
    List<Integer> headList=seamOrder.get(seamOrder.firstKey());
    int targetSeam=headList.get(0);
    headList.remove(0);
    if (headList.size() == 0) {
      seamOrder.remove(seamOrder.firstKey());
    }
    int[] seam=compileVSeam(targetSeam,matchings);
    result=carve(result,seam);
    matchings=carve(matchings,seam);
  }
  return result;
}
Program: 59265
Project: 59265
Buggy source:
public static final int[] compileVSeam(int x,Aggregates<Integer> matchings){
  final int[] seam=new int[matchings.highY() - matchings.lowY()];
  for (int y=0; y < seam.length; y++) {
    seam[y]=x;
    x=x + matchings.get(x,y);
  }
  return seam;
}

Fixed version (ground truth):
public static final int[] compileVSeam(int x,Aggregates<Integer> matchings){
  final int[] seam=new int[matchings.highY() - matchings.lowY()];
  for (int y=matchings.lowY(); y < seam.length; y++) {
    seam[y]=x;
    x=x + matchings.get(x,y);
  }
  return seam;
}
Program: 59267
Project: 59267
Buggy source:
public void transferDefaults(){
  OptionDataset od=datasets.getItemAt(datasets.getSelectedIndex());
  aggregators.setSelectedItem(od.defaultAggregator());
  transferBuilder.configureTo(od.defaultTransfers());
  actionProvider.fireActionListeners();
}

Fixed version (ground truth):
public void transferDefaults(){
  OptionDataset<?,?> od=datasets.getItemAt(datasets.getSelectedIndex());
  aggregators.setSelectedItem(od.defaultAggregator());
  transferBuilder.configureTo(od.defaultTransfers());
  actionProvider.fireActionListeners();
}
Program: 59268
Project: 59268
Buggy source:
public void configureTo(final List<OptionTransfer> transfers){
  for (  TransferRow tr : transferRows) {
    center.remove(tr);
  }
  transferRows.clear();
  for (int i=0; i < transfers.size(); i++) {
    TransferRow tr=addTransferRow();
    tr.setTransfer(transfers.get(i));
  }
}

Fixed version (ground truth):
public void configureTo(final List<OptionTransfer<?>> transfers){
  for (  TransferRow tr : transferRows) {
    center.remove(tr);
  }
  transferRows.clear();
  for (int i=0; i < transfers.size(); i++) {
    TransferRow tr=addTransferRow();
    tr.setTransfer(transfers.get(i));
  }
}
Program: 59269
Project: 59269
Buggy source:
/** 
 * Write a buffered image to a file.
 */
public static void writeImage(BufferedImage img,File f){
  try {
    if (f.getParentFile() != null && !f.getParentFile().exists()) {
      f.getParentFile().mkdirs();
    }
    if (!f.getName().toUpperCase().endsWith("String_Node_Str")) {
      f=new File(f.getName() + "String_Node_Str");
    }
    if (!ImageIO.write(img,"String_Node_Str",f)) {
      throw new RuntimeException("String_Node_Str" + f.getName());
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Write a buffered image to a file.
 */
public static void writeImage(final BufferedImage src,File f){
  try {
    if (f.getParentFile() != null && !f.getParentFile().exists()) {
      f.getParentFile().mkdirs();
    }
    BufferedImage noAlpha=new BufferedImage(src.getWidth(),src.getHeight(),BufferedImage.TYPE_INT_RGB);
    Color bgColor=Color.white;
    for (int x=0; x < src.getWidth(); x++) {
      for (int y=0; y < src.getHeight(); y++) {
        Color fgColor=new Color(src.getRGB(x,y),true);
        int r, g, b;
        r=fgColor.getRed() * fgColor.getAlpha() + bgColor.getRed() * (255 - fgColor.getAlpha());
        g=fgColor.getGreen() * fgColor.getAlpha() + bgColor.getGreen() * (255 - fgColor.getAlpha());
        b=fgColor.getBlue() * fgColor.getAlpha() + bgColor.getBlue() * (255 - fgColor.getAlpha());
        Color result=new Color(r / 255,g / 255,b / 255);
        noAlpha.setRGB(x,y,result.getRGB());
      }
    }
    if (!f.getName().toUpperCase().endsWith("String_Node_Str")) {
      f=new File(f.getName() + "String_Node_Str");
    }
    if (!ImageIO.write(noAlpha,"String_Node_Str",f)) {
      throw new RuntimeException("String_Node_Str" + f.getName());
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 59270
Project: 59270
Buggy source:
public <A,B>void changeDisplay() throws Exception {
  ARComponent old=this.display;
  if (old != null) {
    frame.remove(old);
  }
  Aggregates<?> aggs=remoteRender(host,port,dataset(),aggregate(),remoteTransfers());
  ARComponent newDisplay=new SimpleDisplay(aggs,localTransfer(),renderer);
  frame.add(newDisplay,BorderLayout.CENTER);
  this.display=newDisplay;
  frame.revalidate();
}

Fixed version (ground truth):
public <A,B>void changeDisplay() throws Exception {
  ARComponent old=this.display;
  if (old != null) {
    frame.remove(old);
  }
  Aggregates<?> aggs=remoteRender(host,port,dataset(),aggregate(),remoteTransfers());
  ARComponent newDisplay=new TransferDisplay(aggs,localTransfer(),renderer);
  frame.add(newDisplay,BorderLayout.CENTER);
  this.display=newDisplay;
  frame.revalidate();
}
Program: 59271
Project: 59271
Buggy source:
@SuppressWarnings("String_Node_Str") public static <T>T convert(Number v,Class<T> t){
  if (t.equals(Double.class)) {
    return (T)(Double)v.doubleValue();
  }
  if (t.equals(Integer.class)) {
    return (T)(Integer)v.intValue();
  }
  if (t.equals(Float.class)) {
    return (T)(Float)v.floatValue();
  }
  if (t.equals(Long.class)) {
    return (T)(Long)v.longValue();
  }
  if (t.equals(Short.class)) {
    return (T)(Short)v.shortValue();
  }
  if (t.equals(Boolean.class)) {
    return (T)Boolean.FALSE;
  }
  throw new UnsupportedOperationException("String_Node_Str" + t.getSimpleName());
}

Fixed version (ground truth):
public static <T>T convert(Number v,Class<T> t){
  if (t.equals(Double.class)) {
    return (T)(Double)v.doubleValue();
  }
  if (t.equals(Integer.class)) {
    return (T)(Integer)v.intValue();
  }
  if (t.equals(Float.class)) {
    return (T)(Float)v.floatValue();
  }
  if (t.equals(Long.class)) {
    return (T)(Long)v.longValue();
  }
  if (t.equals(Short.class)) {
    return (T)(Short)v.shortValue();
  }
  if (t.equals(Boolean.class)) {
    return (T)Boolean.FALSE;
  }
  throw new UnsupportedOperationException("String_Node_Str" + t.getSimpleName());
}
Program: 59272
Project: 59272
Buggy source:
@SuppressWarnings("String_Node_Str") protected static <IN,MID,OUT>Transfer extend(Transfer<IN,MID> first,Transfer<MID,OUT> second){
  if (first == null) {
    return second;
  }
  if (second == null) {
    return first;
  }
  if (first instanceof Seq) {
    return ((Seq<IN,?,MID>)first).then(second);
  }
  return new Seq<>(first,second);
}

Fixed version (ground truth):
protected static <IN,MID,OUT>Transfer extend(Transfer<IN,MID> first,Transfer<MID,OUT> second){
  if (first == null) {
    return second;
  }
  if (second == null) {
    return first;
  }
  if (first instanceof Seq) {
    return ((Seq<IN,?,MID>)first).then(second);
  }
  return new Seq<>(first,second);
}
Program: 59273
Project: 59273
Buggy source:
public Controls(){
  super("String_Node_Str");
  this.setLayout(new GridLayout(1,0));
  add(new LabeledItem("String_Node_Str",spinner));
  add(aboveColor);
  add(belowColor);
  spinner.addChangeListener(actionProvider.changeDelegate());
  aboveColor.addActionListener(actionProvider.actionDelegate());
  belowColor.addActionListener(actionProvider.actionDelegate());
}

Fixed version (ground truth):
public Controls(){
  super("String_Node_Str");
  add(new LabeledItem("String_Node_Str",spinner));
  spinner.addChangeListener(actionProvider.changeDelegate());
}
Program: 59274
Project: 59274
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  OptionDataset od=datasets.getItemAt(datasets.getSelectedIndex());
  aggregators.setSelectedItem(od.defaultAggregator());
  transfers.configureTo(od.defaultTransfers());
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  OptionDataset od=datasets.getItemAt(datasets.getSelectedIndex());
  aggregators.setSelectedItem(od.defaultAggregator());
  transfers.configureTo(od.defaultTransfers());
  actionProvider.fireActionListeners();
}
Program: 59275
Project: 59275
Buggy source:
public SequentialComposer(){
  AppUtil.loadStaticItems(datasets,OptionDataset.class,OptionDataset.class,"String_Node_Str");
  AppUtil.loadStaticItems(aggregators,OptionAggregator.class,OptionAggregator.class,"String_Node_Str");
  this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  datasets.addActionListener(actionProvider.actionDelegate());
  datasets.addItemListener(actionProvider.itemDelegate());
  aggregators.addActionListener(actionProvider.actionDelegate());
  aggregators.addItemListener(actionProvider.itemDelegate());
  transfers.addActionListener(actionProvider.actionDelegate());
  JPanel ds=new JPanel();
  ds.setLayout(new BorderLayout());
  ds.add(datasets,BorderLayout.CENTER);
  ds.add(transferDefaults,BorderLayout.EAST);
  this.add(new LabeledItem("String_Node_Str",ds));
  this.add(new LabeledItem("String_Node_Str",aggregators));
  this.add(new LabeledItem("String_Node_Str",transfers));
  transferDefaults.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      OptionDataset od=datasets.getItemAt(datasets.getSelectedIndex());
      aggregators.setSelectedItem(od.defaultAggregator());
      transfers.configureTo(od.defaultTransfers());
    }
  }
);
}

Fixed version (ground truth):
public SequentialComposer(){
  AppUtil.loadStaticItems(datasets,OptionDataset.class,OptionDataset.class,"String_Node_Str");
  AppUtil.loadStaticItems(aggregators,OptionAggregator.class,OptionAggregator.class,"String_Node_Str");
  this.setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  datasets.addActionListener(actionProvider.actionDelegate());
  datasets.addItemListener(actionProvider.itemDelegate());
  aggregators.addActionListener(actionProvider.actionDelegate());
  aggregators.addItemListener(actionProvider.itemDelegate());
  transfers.addActionListener(actionProvider.actionDelegate());
  JPanel ds=new JPanel();
  ds.setLayout(new BorderLayout());
  ds.add(datasets,BorderLayout.CENTER);
  ds.add(transferDefaults,BorderLayout.EAST);
  this.add(new LabeledItem("String_Node_Str",ds));
  this.add(new LabeledItem("String_Node_Str",aggregators));
  this.add(new LabeledItem("String_Node_Str",transfers));
  transferDefaults.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      OptionDataset od=datasets.getItemAt(datasets.getSelectedIndex());
      aggregators.setSelectedItem(od.defaultAggregator());
      transfers.configureTo(od.defaultTransfers());
      actionProvider.fireActionListeners();
    }
  }
);
}
Program: 59276
Project: 59276
Buggy source:
public void dataset(Glyphset<?,?> data,Aggregator<?,?> aggregator,Transfer<?,?> transfer){
  this.dataset=data;
  this.aggregator=aggregator;
  this.transfer(transfer);
  this.aggregates=null;
  this.repaint();
}

Fixed version (ground truth):
public void dataset(Glyphset<?,?> data,Aggregator<?,?> aggregator,Transfer<?,?> transfer){
  this.dataset=data;
  this.aggregator=aggregator;
  this.transfer(transfer);
  aggregates(null,null);
  fullRender=true;
  renderError=false;
  this.repaint();
}
Program: 59277
Project: 59277
Buggy source:
@Override public CategoricalCounts<T> identity(){
  return new CategoricalCounts<>();
}

Fixed version (ground truth):
@Override public CategoricalCounts<T> identity(){
  return new CategoricalCounts<>(comp);
}
Program: 59278
Project: 59278
Buggy source:
public Aggregates<? extends OUT> process(Aggregates<? extends IN> aggregates);

Fixed version (ground truth):
public Aggregates<OUT> process(Aggregates<? extends IN> aggregates);
Program: 59279
Project: 59279
Buggy source:
/** 
 * From a set of color aggregates, make a new image.
 */
public static BufferedImage asImage(Aggregates<Color> aggs,int width,int height,Color background){
  if (aggs instanceof ImageAggregates) {
    return ((ImageAggregates)aggs).image();
  }
  BufferedImage i=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics g=i.getGraphics();
  g.setColor(background);
  g.fillRect(0,0,width,height);
  g.dispose();
  for (int x=Math.max(0,aggs.lowX()); x < Math.min(width,aggs.highX()); x++) {
    for (int y=Math.max(0,aggs.lowY()); y < Math.min(height,aggs.highY()); y++) {
      Color c=aggs.get(x,y);
      if (c != null) {
        i.setRGB(x,y,c.getRGB());
      }
    }
  }
  return i;
}

Fixed version (ground truth):
/** 
 * From a set of color aggregates, make a new image.
 */
public static BufferedImage asImage(Aggregates<? extends Color> aggs,int width,int height,Color background){
  if (aggs instanceof ImageAggregates) {
    return ((ImageAggregates)aggs).image();
  }
  BufferedImage i=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics g=i.getGraphics();
  g.setColor(background);
  g.fillRect(0,0,width,height);
  g.dispose();
  for (int x=Math.max(0,aggs.lowX()); x < Math.min(width,aggs.highX()); x++) {
    for (int y=Math.max(0,aggs.lowY()); y < Math.min(height,aggs.highY()); y++) {
      Color c=aggs.get(x,y);
      if (c != null) {
        i.setRGB(x,y,c.getRGB());
      }
    }
  }
  return i;
}
Program: 59280
Project: 59280
Buggy source:
public <IN,OUT>Aggregates<OUT> transfer(Aggregates<? extends IN> aggregates,Transfer.Specialized<IN,OUT> t){
  if (t instanceof Transfer.ControlFlow) {
    return (Aggregates<OUT>)((Transfer.ControlFlow<IN,OUT>)t).process(aggregates);
  }
 else {
    Aggregates<OUT> result=AggregateUtils.make(aggregates,t.emptyValue());
    long taskSize=Math.max(TRANSFER_TASK_MIN,AggregateUtils.size(aggregates) / pool.getParallelism());
    PixelParallelTransfer<IN,OUT> task=new PixelParallelTransfer<>(aggregates,result,t,taskSize,aggregates.lowX(),aggregates.lowY(),aggregates.highX(),aggregates.highY());
    pool.invoke(task);
    return result;
  }
}

Fixed version (ground truth):
public <IN,OUT>Aggregates<OUT> transfer(Aggregates<? extends IN> aggregates,Transfer.Specialized<IN,OUT> t){
  if (t instanceof Transfer.ControlFlow) {
    return ((Transfer.ControlFlow<IN,OUT>)t).process(aggregates);
  }
 else {
    Aggregates<OUT> result=AggregateUtils.make(aggregates,t.emptyValue());
    long taskSize=Math.max(TRANSFER_TASK_MIN,AggregateUtils.size(aggregates) / pool.getParallelism());
    PixelParallelTransfer<IN,OUT> task=new PixelParallelTransfer<>(aggregates,result,t,taskSize,aggregates.lowX(),aggregates.lowY(),aggregates.highX(),aggregates.highY());
    pool.invoke(task);
    return result;
  }
}
Program: 59281
Project: 59281
Buggy source:
@Override public Aggregates<A> process(Aggregates<? extends A> aggregates){
  return (Aggregates<A>)cache.get(aggregates);
}

Fixed version (ground truth):
@Override public Aggregates<A> process(Aggregates<? extends A> aggregates){
  return cache.get(aggregates);
}
Program: 59282
Project: 59282
Buggy source:
public Aggregates<? extends A> vertical(Aggregates<? extends A> aggs){
  Transfer<A,Double> energy=new Seq<>(new Energy<>(delta),new CumulativeEnergy());
  Aggregates<Double> cumEng=Resources.DEFAULT_RENDERER.transfer(aggs,energy.specialize(aggs));
  int[] vseam=findVSeam(cumEng);
  Aggregates<A> rslt=AggregateUtils.make(aggs.lowX(),aggs.lowY(),aggs.highX() - 1,aggs.highY(),(A)aggs.defaultValue());
  for (int y=aggs.lowY(); y < aggs.highY(); y++) {
    int split=vseam[y - aggs.lowY()];
    for (int x=aggs.lowX(); x < split; x++) {
      rslt.set(x,y,aggs.get(x,y));
    }
    for (int x=split; x < aggs.highX(); x++) {
      rslt.set(x,y,aggs.get(x + 1,y));
    }
  }
  return rslt;
}

Fixed version (ground truth):
public Aggregates<A> vertical(Aggregates<? extends A> aggs){
  Transfer<A,Double> energy=new Seq<>(new Energy<>(delta),new CumulativeEnergy());
  Aggregates<? extends Double> cumEng=Resources.DEFAULT_RENDERER.transfer(aggs,energy.specialize(aggs));
  int[] vseam=findVSeam(cumEng);
  Aggregates<A> rslt=AggregateUtils.make(aggs.lowX(),aggs.lowY(),aggs.highX() - 1,aggs.highY(),(A)aggs.defaultValue());
  for (int y=aggs.lowY(); y < aggs.highY(); y++) {
    int split=vseam[y - aggs.lowY()];
    for (int x=aggs.lowX(); x < split; x++) {
      rslt.set(x,y,aggs.get(x,y));
    }
    for (int x=split; x < aggs.highX(); x++) {
      rslt.set(x,y,aggs.get(x + 1,y));
    }
  }
  return rslt;
}
Program: 59283
Project: 59283
Buggy source:
public static int[] findVSeam(Aggregates<Double> cumEng){
  int[] vseam=new int[cumEng.highY() - cumEng.lowY()];
  double min=Integer.MAX_VALUE;
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    Double eng=cumEng.get(x,cumEng.highY() - 1);
    if (min > eng) {
      min=eng;
      vseam[vseam.length - 1]=x;
    }
  }
  for (int y=cumEng.highY() - 2; y >= cumEng.lowY(); y--) {
    int x=vseam[y - cumEng.lowY() + 1];
    double upLeft=x - 1 >= cumEng.lowX() ? cumEng.get(x - 1,y) : Double.MAX_VALUE;
    double up=cumEng.get(x,y);
    double upRight=x + 1 < cumEng.highX() ? cumEng.get(x + 1,y) : Double.MAX_VALUE;
    if (upLeft < up && upLeft < upRight) {
      x=x - 1;
    }
 else     if (up > upRight) {
      x=x + 1;
    }
    vseam[y - cumEng.lowY()]=x;
  }
  return vseam;
}

Fixed version (ground truth):
public static int[] findVSeam(Aggregates<? extends Double> cumEng){
  int[] vseam=new int[cumEng.highY() - cumEng.lowY()];
  double min=Integer.MAX_VALUE;
  for (int x=cumEng.lowX(); x < cumEng.highX(); x++) {
    Double eng=cumEng.get(x,cumEng.highY() - 1);
    if (min > eng) {
      min=eng;
      vseam[vseam.length - 1]=x;
    }
  }
  for (int y=cumEng.highY() - 2; y >= cumEng.lowY(); y--) {
    int x=vseam[y - cumEng.lowY() + 1];
    double upLeft=x - 1 >= cumEng.lowX() ? cumEng.get(x - 1,y) : Double.MAX_VALUE;
    double up=cumEng.get(x,y);
    double upRight=x + 1 < cumEng.highX() ? cumEng.get(x + 1,y) : Double.MAX_VALUE;
    if (upLeft < up && upLeft < upRight) {
      x=x - 1;
    }
 else     if (up > upRight) {
      x=x + 1;
    }
    vseam[y - cumEng.lowY()]=x;
  }
  return vseam;
}
Program: 59284
Project: 59284
Buggy source:
public Aggregates<? extends A> horizontal(Aggregates<? extends A> aggs){
  return TransposeWrapper.transpose(vertical(TransposeWrapper.transpose(aggs)));
}

Fixed version (ground truth):
public Aggregates<A> horizontal(Aggregates<? extends A> aggs){
  return TransposeWrapper.transpose(vertical(TransposeWrapper.transpose(aggs)));
}
Program: 59285
Project: 59285
Buggy source:
@Override public Aggregates<? extends Double> build(Aggregates<? extends Double> aggregates){
  Aggregates<Double> cached=AggregateUtils.make(aggregates,0d);
  for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
    cached.set(x,aggregates.lowY(),aggregates.get(x,aggregates.lowY()));
  }
  for (int y=aggregates.lowY() + 1; y < aggregates.highY(); y++) {
    for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
      double upLeft=x - 1 >= aggregates.lowX() ? cached.get(x - 1,y - 1) : Double.MAX_VALUE;
      double up=cached.get(x,y - 1);
      double upRight=x + 1 < aggregates.highX() ? cached.get(x + 1,y - 1) : Double.MAX_VALUE;
      double min=Math.min(upRight,Math.min(upLeft,up));
      cached.set(x,y,min + aggregates.get(x,y));
    }
  }
  return cached;
}

Fixed version (ground truth):
@Override public Aggregates<Double> build(Aggregates<? extends Double> aggregates){
  Aggregates<Double> cached=AggregateUtils.make(aggregates,0d);
  for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
    cached.set(x,aggregates.lowY(),aggregates.get(x,aggregates.lowY()));
  }
  for (int y=aggregates.lowY() + 1; y < aggregates.highY(); y++) {
    for (int x=aggregates.lowX(); x < aggregates.highX(); x++) {
      double upLeft=x - 1 >= aggregates.lowX() ? cached.get(x - 1,y - 1) : Double.MAX_VALUE;
      double up=cached.get(x,y - 1);
      double upRight=x + 1 < aggregates.highX() ? cached.get(x + 1,y - 1) : Double.MAX_VALUE;
      double min=Math.min(upRight,Math.min(upLeft,up));
      cached.set(x,y,min + aggregates.get(x,y));
    }
  }
  return cached;
}
Program: 59286
Project: 59286
Buggy source:
@Override public Aggregates<? extends OUT> build(Aggregates<? extends IN> aggs){
  Aggregates<OUT> left=null;
  for (int i=0; i < specialized.length; i++) {
    Aggregates<OUT> right=renderer.transfer(aggs,specialized[i]);
    left=AggregationStrategies.horizontalRollup(left,right,merge);
  }
  return left;
}

Fixed version (ground truth):
@Override public Aggregates<OUT> build(Aggregates<? extends IN> aggs){
  Aggregates<OUT> left=null;
  for (int i=0; i < specialized.length; i++) {
    Aggregates<OUT> right=renderer.transfer(aggs,specialized[i]);
    left=AggregationStrategies.horizontalRollup(left,right,merge);
  }
  return left;
}
Program: 59287
Project: 59287
Buggy source:
public Aggregates<? extends IN> build(Aggregates<? extends IN> aggs){
  for (int i=0; i < n; i++) {
    Transfer.Specialized<IN,IN> spec=op.specialize(aggs);
    aggs=renderer.transfer(aggs,spec);
  }
  return aggs;
}

Fixed version (ground truth):
public Aggregates<IN> build(Aggregates<? extends IN> aggs){
  Transfer.Specialized<IN,IN> spec=op.specialize(aggs);
  Aggregates<IN> out=renderer.transfer(aggs,spec);
  for (int i=0; i < n - 1; i++) {
    spec=op.specialize(out);
    out=renderer.transfer(out,spec);
  }
  return out;
}
Program: 59288
Project: 59288
Buggy source:
public Aggregates<? extends IN> build(Aggregates<? extends IN> aggs){
  while (!pred.value(aggs)) {
    aggs=renderer.transfer(aggs,op);
  }
  return aggs;
}

Fixed version (ground truth):
public Aggregates<IN> build(Aggregates<? extends IN> aggs){
  Aggregates<IN> out=renderer.transfer(aggs,op);
  while (!pred.value(out)) {
    out=renderer.transfer(out,op);
  }
  return out;
}
Program: 59289
Project: 59289
Buggy source:
public void set(Aggregates<? extends IN> key,Aggregates<? extends OUT> cache){
synchronized (guard) {
    this.key=key;
    this.cache=cache;
  }
}

Fixed version (ground truth):
public void set(Aggregates<? extends IN> key,Aggregates<OUT> cache){
synchronized (guard) {
    this.key=key;
    this.cache=cache;
  }
}
Program: 59290
Project: 59290
Buggy source:
public Aggregates<? extends OUT> build(Aggregates<? extends IN> aggs);

Fixed version (ground truth):
public Aggregates<OUT> build(Aggregates<? extends IN> aggs);
Program: 59291
Project: 59291
Buggy source:
public Aggregates<? extends OUT> get(Aggregates<? extends IN> key){
synchronized (guard) {
    if (this.key != key) {
      cache=target.build(key);
      this.key=key;
    }
  }
  return cache;
}

Fixed version (ground truth):
public Aggregates<OUT> get(Aggregates<? extends IN> key){
synchronized (guard) {
    if (this.key != key) {
      cache=target.build(key);
      this.key=key;
    }
  }
  return cache;
}
Program: 59292
Project: 59292
Buggy source:
public String toString(){
  return String.format("String_Node_Str",min,max,mean,stdev);
}

Fixed version (ground truth):
public String toString(){
  if (min instanceof Integer || min instanceof Long) {
    return String.format("String_Node_Str",min,max,mean,stdev);
  }
 else {
    return String.format("String_Node_Str",min,max,mean,stdev);
  }
}
Program: 59293
Project: 59293
Buggy source:
public Spread(V empty,Spreader<V> spreader,Aggregator<V,V> combiner){
  this.empty=empty;
  this.spreader=spreader;
  this.combiner=combiner;
}

Fixed version (ground truth):
public Spread(Spreader<V> spreader,Aggregator<V,V> combiner){
  this.spreader=spreader;
  this.combiner=combiner;
}
Program: 59294
Project: 59294
Buggy source:
private static byte[] encodeArray(Number[] nums,TYPE[] types){
  int recordLength=recordLength(types);
  byte[] rslt=new byte[recordLength];
  int offset=0;
  for (int i=0; i < nums.length; i++) {
    byte[] nb=encode(nums[i],types[i]);
    System.arraycopy(nb,0,rslt,offset,nb.length);
    offset+=nb.length;
  }
  return rslt;
}

Fixed version (ground truth):
private static byte[] encodeArray(Number[] nums,TYPE[] types){
  int recordLength=recordLength(types);
  byte[] rslt=new byte[recordLength];
  int offset=0;
  for (int i=0; i < nums.length; i++) {
    if (types[i] == TYPE.CHAR) {
      continue;
    }
    byte[] nb=encode(nums[i],types[i]);
    System.arraycopy(nb,0,rslt,offset,nb.length);
    offset+=nb.length;
  }
  return rslt;
}
Program: 59295
Project: 59295
Buggy source:
public static TYPE typeFor(char t){
  if (t == 'i') {
    return TYPE.INT;
  }
 else   if (t == 'l') {
    return TYPE.LONG;
  }
 else   if (t == 's') {
    return TYPE.SHORT;
  }
 else   if (t == 'd') {
    return TYPE.DOUBLE;
  }
 else   if (t == 'f') {
    return TYPE.FLOAT;
  }
 else   if (t == 'b') {
    return TYPE.BYTE;
  }
 else   if (t == 'x') {
    return TYPE.X;
  }
 else {
    throw new RuntimeException(String.format("String_Node_Str",t));
  }
}

Fixed version (ground truth):
public static TYPE typeFor(char t){
  if (t == 'i') {
    return TYPE.INT;
  }
 else   if (t == 'l') {
    return TYPE.LONG;
  }
 else   if (t == 's') {
    return TYPE.SHORT;
  }
 else   if (t == 'd') {
    return TYPE.DOUBLE;
  }
 else   if (t == 'f') {
    return TYPE.FLOAT;
  }
 else   if (t == 'b') {
    return TYPE.BYTE;
  }
 else   if (t == 'c') {
    return TYPE.CHAR;
  }
 else   if (t == 'x') {
    return TYPE.X;
  }
 else {
    throw new RuntimeException(String.format("String_Node_Str",t));
  }
}
Program: 59297
Project: 59297
Buggy source:
@Test public void testValueCircle4(){
  Renderer r=new ParallelGlyphs();
  Aggregator<Integer,Integer> combiner=new Numbers.Count<>();
  Aggregates<Integer> aggs=new FlatAggregates<Integer>(9,9,0);
  aggs.set(4,4,4);
  Spreader<Integer> spread2=new General.Spread.ValueCircle<>();
  General.Spread<Integer> transfer2=new General.Spread<Integer>(0,spread2,combiner);
  Specialized<Integer,Integer> s2=transfer2.specialize(aggs);
  Aggregates<Integer> rslt=r.transfer(aggs,s2);
  System.out.println(AggregateUtils.toString(rslt));
  assertThat(String.format("String_Node_Str",0,0),rslt.get(0,0),is(0));
  assertThat(String.format("String_Node_Str",1,1),rslt.get(1,1),is(0));
  assertThat(String.format("String_Node_Str",3,3),rslt.get(3,3),is(4));
  assertThat(String.format("String_Node_Str",3,5),rslt.get(3,5),is(4));
  assertThat(String.format("String_Node_Str",3,6),rslt.get(3,6),is(4));
  assertThat(String.format("String_Node_Str",5,5),rslt.get(5,5),is(4));
  assertThat(String.format("String_Node_Str",5,6),rslt.get(5,6),is(4));
  assertThat(String.format("String_Node_Str",6,6),rslt.get(6,6),is(4));
  assertThat(String.format("String_Node_Str",8,8),rslt.get(8,8),is(0));
}

Fixed version (ground truth):
@Test public void testValueCircle4(){
  Renderer r=new ParallelGlyphs();
  Aggregator<Integer,Integer> combiner=new Numbers.Count<>();
  Aggregates<Integer> aggs=new FlatAggregates<Integer>(9,9,0);
  aggs.set(4,4,4);
  Spreader<Integer> spread2=new General.Spread.ValueCircle<>();
  General.Spread<Integer> transfer2=new General.Spread<Integer>(0,spread2,combiner);
  Specialized<Integer,Integer> s2=transfer2.specialize(aggs);
  Aggregates<Integer> rslt=r.transfer(aggs,s2);
  assertThat(String.format("String_Node_Str",0,0),rslt.get(0,0),is(0));
  assertThat(String.format("String_Node_Str",1,1),rslt.get(1,1),is(0));
  assertThat(String.format("String_Node_Str",3,3),rslt.get(3,3),is(4));
  assertThat(String.format("String_Node_Str",3,5),rslt.get(3,5),is(4));
  assertThat(String.format("String_Node_Str",3,6),rslt.get(3,6),is(4));
  assertThat(String.format("String_Node_Str",5,5),rslt.get(5,5),is(4));
  assertThat(String.format("String_Node_Str",5,6),rslt.get(5,6),is(4));
  assertThat(String.format("String_Node_Str",6,6),rslt.get(6,6),is(4));
  assertThat(String.format("String_Node_Str",8,8),rslt.get(8,8),is(0));
}
Program: 59298
Project: 59298
Buggy source:
public void actionPerformed(ActionEvent e){
  JCheckBox b=(JCheckBox)e.getSource();
  Transfer<?,?> old=target.transfer();
  if (b.isSelected() && !(old instanceof Advise.OverUnder)) {
    target.transfer(new Advise.OverUnder(Color.BLACK,Color.gray,old,10));
  }
 else   if (!b.isSelected() && (old instanceof Advise.OverUnder)) {
    target.transfer(((Advise.OverUnder)old).baseTransfer());
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void actionPerformed(ActionEvent e){
  JCheckBox b=(JCheckBox)e.getSource();
  Transfer<?,?> old=target.transfer();
  if (b.isSelected() && !(old instanceof Advise.OverUnder)) {
    target.transfer(new Advise.OverUnder(Color.BLACK,Color.gray,old,10));
  }
 else   if (!b.isSelected() && (old instanceof Advise.OverUnder)) {
    target.transfer(((Advise.OverUnder)old).baseTransfer());
  }
}