nus-yam/ex-repair huggingface dataset:
Program: 150921
Project: 150921
Buggy source:
private <T extends ImageBase>void currentOutsideBackground(ImageType<T> imageType){
  T frame=imageType.createImage(width,height);
  ImageUInt8 segmented=new ImageUInt8(width,height);
  BackgroundModelMoving<T,Homography2D_F32> alg=create(frame.getImageType());
  Homography2D_F32 homeToWorld=new Homography2D_F32();
  alg.initialize(width,height,homeToWorld);
  Homography2D_F32 homeToCurrent=new Homography2D_F32();
  homeToCurrent.a13=5;
  alg.updateBackground(homeToCurrent,frame);
  alg.segment(homeToCurrent,frame,segmented);
  homeToCurrent.a13=-5;
  alg.updateBackground(homeToCurrent,frame);
  alg.segment(homeToCurrent,frame,segmented);
  homeToCurrent.a13=0;
  homeToCurrent.a23=5;
  alg.updateBackground(homeToCurrent,frame);
  alg.segment(homeToCurrent,frame,segmented);
  homeToCurrent.a23=-5;
  alg.updateBackground(homeToCurrent,frame);
  alg.segment(homeToCurrent,frame,segmented);
}

Fixed version (ground truth):
private <T extends ImageBase>void currentOutsideBackground(ImageType<T> imageType){
  T frame=imageType.createImage(width,height);
  ImageUInt8 segmented=new ImageUInt8(width,height);
  BackgroundModelMoving<T,Homography2D_F32> alg=create(frame.getImageType());
  Homography2D_F32 homeToWorld=new Homography2D_F32();
  alg.initialize(width,height,homeToWorld);
  alg.setUnknownValue(2);
  double translationTol=backgroundOutsideTol / 2;
  Homography2D_F32 homeToCurrent=new Homography2D_F32();
  homeToCurrent.a13=5;
  checkTransform(frame,segmented,alg,homeToCurrent,translationTol);
  homeToCurrent.a13=-5;
  checkTransform(frame,segmented,alg,homeToCurrent,translationTol);
  homeToCurrent.a13=0;
  homeToCurrent.a23=5;
  checkTransform(frame,segmented,alg,homeToCurrent,translationTol);
  homeToCurrent.a23=-5;
  checkTransform(frame,segmented,alg,homeToCurrent,translationTol);
  homeToCurrent.set(1.5f,0.1f,4,-0.05f,0.9f,-1f,0,0,1);
  checkTransform(frame,segmented,alg,homeToCurrent,backgroundOutsideTol);
}
Program: 150923
Project: 150923
Buggy source:
private static void from_NBU8_to_IF32(InterleavedF32 dst,byte[] srcData,int srcOffset,int srcStrideDiff){
  int length=dst.width * dst.numBands;
  for (int y=0; y < dst.height; y++) {
    int indexDst=dst.startIndex + dst.stride * y;
    int indexSrc=srcOffset + y * (dst.stride + srcStrideDiff);
    int indexDstEnd=indexDst + length;
    while (indexDst < indexDstEnd) {
      dst.data[indexDst]=srcData[indexSrc] & 0xFF;
      indexDst++;
      indexSrc++;
    }
  }
}

Fixed version (ground truth):
private static void from_NBU8_to_IF32(InterleavedF32 dst,byte[] srcData,int srcOffset,int srcStrideDiff){
  int length=dst.width * dst.numBands;
  for (int y=0; y < dst.height; y++) {
    int indexDst=dst.startIndex + dst.stride * y;
    int indexSrc=srcOffset + y * (length + srcStrideDiff);
    int indexDstEnd=indexDst + length;
    while (indexDst < indexDstEnd) {
      dst.data[indexDst]=srcData[indexSrc] & 0xFF;
      indexDst++;
      indexSrc++;
    }
  }
}
Program: 150924
Project: 150924
Buggy source:
private static void from_NBU8_to_IU8(InterleavedU8 dst,byte[] srcData,int srcOffset,int srcStrideDiff){
  int length=dst.width * dst.numBands;
  for (int y=0; y < dst.height; y++) {
    int indexDst=dst.startIndex + dst.stride * y;
    int indexSrc=srcOffset + y * (dst.stride + srcStrideDiff);
    System.arraycopy(srcData,indexSrc,dst.data,indexDst,length);
  }
}

Fixed version (ground truth):
private static void from_NBU8_to_IU8(InterleavedU8 dst,byte[] srcData,int srcOffset,int srcStrideDiff){
  int length=dst.width * dst.numBands;
  for (int y=0; y < dst.height; y++) {
    int indexDst=dst.startIndex + dst.stride * y;
    int indexSrc=srcOffset + y * (length + srcStrideDiff);
    System.arraycopy(srcData,indexSrc,dst.data,indexDst,length);
  }
}
Program: 150925
Project: 150925
Buggy source:
/** 
 * Use reflections to test all the functions.
 */
@Test public void performTests(){
  Method methods[]=ConvertRaster.class.getMethods();
  int numFound=0;
  for (  Method m : methods) {
    if (!isTestMethod(m))     continue;
    System.out.println("String_Node_Str" + m.getName());
    if (m.getName().contains("String_Node_Str"))     testBufferedTo(m);
 else     if (m.getName().contains("String_Node_Str"))     testImageTo(m);
 else     throw new RuntimeException("String_Node_Str");
    numFound++;
  }
  if (numMethods != numFound)   throw new RuntimeException("String_Node_Str" + numFound + "String_Node_Str"+ numMethods);
}

Fixed version (ground truth):
/** 
 * Use reflections to test all the functions.
 */
@Test public void performTests(){
  Method methods[]=ConvertRaster.class.getMethods();
  int numFound=0;
  for (  Method m : methods) {
    if (!isTestMethod(m))     continue;
    if (m.getName().contains("String_Node_Str"))     testBufferedTo(m);
 else     if (m.getName().contains("String_Node_Str"))     testImageTo(m);
 else     throw new RuntimeException("String_Node_Str");
    numFound++;
  }
  if (numMethods != numFound)   throw new RuntimeException("String_Node_Str" + numFound + "String_Node_Str"+ numMethods);
}
Program: 150926
Project: 150926
Buggy source:
private ImageBase createImage(Method m,Class imageType,BufferedImage inputBuff){
  int numBands=inputBuff.getRaster().getNumBands();
  ImageBase output;
  if (ImageSingleBand.class.isAssignableFrom(imageType)) {
    output=GeneralizedImageOps.createSingleBand(imageType,inputBuff.getWidth(),inputBuff.getHeight());
  }
 else {
    Class type;
    if (m.getName().contains("String_Node_Str")) {
      type=ImageUInt8.class;
    }
 else     if (m.getName().contains("String_Node_Str")) {
      type=ImageFloat32.class;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + m.getName());
    }
    output=new MultiSpectral(type,inputBuff.getWidth(),inputBuff.getHeight(),numBands);
  }
  return output;
}

Fixed version (ground truth):
private ImageBase createImage(Method m,Class imageType,BufferedImage inputBuff){
  int numBands=inputBuff.getRaster().getNumBands();
  ImageBase output;
  if (ImageSingleBand.class.isAssignableFrom(imageType)) {
    output=GeneralizedImageOps.createSingleBand(imageType,inputBuff.getWidth(),inputBuff.getHeight());
  }
 else   if (ImageInterleaved.class.isAssignableFrom(imageType)) {
    if (m.getName().contains("String_Node_Str")) {
      output=GeneralizedImageOps.createInterleaved(imageType,inputBuff.getWidth(),inputBuff.getHeight(),1);
    }
 else {
      output=GeneralizedImageOps.createInterleaved(imageType,inputBuff.getWidth(),inputBuff.getHeight(),numBands);
    }
  }
 else {
    Class type;
    if (m.getName().contains("String_Node_Str")) {
      type=ImageUInt8.class;
    }
 else     if (m.getName().contains("String_Node_Str")) {
      type=ImageFloat32.class;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + m.getName());
    }
    output=new MultiSpectral(type,inputBuff.getWidth(),inputBuff.getHeight(),numBands);
  }
  return output;
}
Program: 150927
Project: 150927
Buggy source:
public void performBufferedTo(Method m,BufferedImage input,ImageBase output){
  try {
    if (Raster.class.isAssignableFrom(m.getParameterTypes()[0])) {
      m.invoke(null,input.getRaster(),output);
      if (ImageMultiBand.class.isAssignableFrom(output.getClass()))       BoofTesting.checkEquals(input.getRaster(),(MultiSpectral)output,1);
 else       BoofTesting.checkEquals(input,output,false,1f);
    }
 else {
      m.invoke(null,input,output);
      BoofTesting.checkEquals(input,output,false,1f);
    }
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void performBufferedTo(Method m,BufferedImage input,ImageBase output){
  try {
    if (Raster.class.isAssignableFrom(m.getParameterTypes()[0])) {
      m.invoke(null,input.getRaster(),output);
      if (ImageMultiBand.class.isAssignableFrom(output.getClass()))       BoofTesting.checkEquals(input.getRaster(),(ImageMultiBand)output,1);
 else       BoofTesting.checkEquals(input,output,false,1f);
    }
 else {
      m.invoke(null,input,output);
      BoofTesting.checkEquals(input,output,false,1f);
    }
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e);
  }
}
Program: 150928
Project: 150928
Buggy source:
private void testBufferedTo(Method m){
  Class paramTypes[]=m.getParameterTypes();
  BufferedImage input[];
  input=createBufferedTestImages(paramTypes[0]);
  for (int i=0; i < input.length; i++) {
    ImageBase output=createImage(m,paramTypes[1],input[i]);
    BoofTesting.checkSubImage(this,"String_Node_Str",true,m,input[i],output);
    BufferedImage subimage=input[i].getSubimage(1,2,imgWidth - 1,imgHeight - 2);
    output=createImage(m,paramTypes[1],subimage);
    BoofTesting.checkSubImage(this,"String_Node_Str",true,m,subimage,output);
  }
}

Fixed version (ground truth):
private void testBufferedTo(Method m){
  Class paramTypes[]=m.getParameterTypes();
  BufferedImage input[];
  input=createBufferedTestImages(paramTypes[0]);
  boolean canSubImage=true;
  if (paramTypes[0] == SunWritableRaster.class) {
    canSubImage=false;
  }
  for (int i=0; i < input.length; i++) {
    ImageBase output=createImage(m,paramTypes[1],input[i]);
    BoofTesting.checkSubImage(this,"String_Node_Str",true,m,input[i],output);
    if (canSubImage) {
      BufferedImage subimage=input[i].getSubimage(1,2,imgWidth - 1,imgHeight - 2);
      output=createImage(m,paramTypes[1],subimage);
      BoofTesting.checkSubImage(this,"String_Node_Str",true,m,subimage,output);
    }
  }
}
Program: 150930
Project: 150930
Buggy source:
/** 
 * Change the image being displayed.
 * @param image The new image which will be displayed.
 */
public void setBufferedImage(BufferedImage image){
  this.img=image;
  Dimension prev=getPreferredSize();
  int w=0, h=0;
  if (img != null) {
    w=(int)Math.ceil(img.getWidth() * scale);
    h=(int)Math.ceil(img.getHeight() * scale);
  }
  if (prev.getWidth() != w || prev.getHeight() != h) {
    panel.setPreferredSize(new Dimension(w,h));
    getViewport().setView(panel);
  }
}

Fixed version (ground truth):
/** 
 * Change the image being displayed.
 * @param image The new image which will be displayed.
 */
public synchronized void setBufferedImage(BufferedImage image){
  this.img=image;
  Dimension prev=getPreferredSize();
  int w=0, h=0;
  if (img != null) {
    w=(int)Math.ceil(img.getWidth() * scale);
    h=(int)Math.ceil(img.getHeight() * scale);
  }
  if (prev.getWidth() != w || prev.getHeight() != h) {
    panel.setPreferredSize(new Dimension(w,h));
    getViewport().setView(panel);
  }
}
Program: 150931
Project: 150931
Buggy source:
public void setScale(double scale){
  Rectangle r=panel.getVisibleRect();
  double centerX=(r.x + r.width / 2.0) / this.scale;
  double centerY=(r.y + r.height / 2.0) / this.scale;
  this.scale=scale;
  int w=0, h=0;
  if (img != null) {
    w=(int)Math.ceil(img.getWidth() * scale);
    h=(int)Math.ceil(img.getHeight() * scale);
  }
  panel.setPreferredSize(new Dimension(w,h));
  getViewport().setView(panel);
  centerView(centerX,centerY);
}

Fixed version (ground truth):
public synchronized void setScale(double scale){
  Rectangle r=panel.getVisibleRect();
  double centerX=(r.x + r.width / 2.0) / this.scale;
  double centerY=(r.y + r.height / 2.0) / this.scale;
  this.scale=scale;
  int w=0, h=0;
  if (img != null) {
    w=(int)Math.ceil(img.getWidth() * scale);
    h=(int)Math.ceil(img.getHeight() * scale);
  }
  panel.setPreferredSize(new Dimension(w,h));
  getViewport().setView(panel);
  centerView(centerX,centerY);
}
Program: 150932
Project: 150932
Buggy source:
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (img == null)   return;
  Graphics2D g2=(Graphics2D)g;
  AffineTransform tran=AffineTransform.getScaleInstance(scale,scale);
  g2.drawImage(img,tran,null);
  paintInPanel(tran,g2);
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (img == null)   return;
  Graphics2D g2=(Graphics2D)g;
synchronized (ImageZoomPanel.this) {
    AffineTransform tran=AffineTransform.getScaleInstance(scale,scale);
    g2.drawImage(img,tran,null);
    paintInPanel(tran,g2);
  }
}
Program: 150933
Project: 150933
Buggy source:
public void centerView(double cx,double cy){
  Rectangle r=panel.getVisibleRect();
  int x=(int)(cx * scale - r.width / 2);
  int y=(int)(cy * scale - r.height / 2);
  getHorizontalScrollBar().setValue(x);
  getVerticalScrollBar().setValue(y);
}

Fixed version (ground truth):
public synchronized void centerView(double cx,double cy){
  Rectangle r=panel.getVisibleRect();
  int x=(int)(cx * scale - r.width / 2);
  int y=(int)(cy * scale - r.height / 2);
  getHorizontalScrollBar().setValue(x);
  getVerticalScrollBar().setValue(y);
}
Program: 150935
Project: 150935
Buggy source:
@Override protected void updateAlg(MultiSpectral<I> frame,BufferedImage buffImage){
  undistorter.apply(frame,undistorted);
  GConvertImage.average(undistorted,gray);
  detector.process(gray);
  System.out.println(count + "String_Node_Str" + detector.getFound().size);
  if (count == 212) {
    UtilImageIO.saveImage(buffImage,"String_Node_Str");
  }
  count++;
  processedInputImage=true;
}

Fixed version (ground truth):
@Override protected void updateAlg(MultiSpectral<I> frame,BufferedImage buffImage){
  GConvertImage.average(frame,gray);
  detector.process(gray);
  System.out.println(count + "String_Node_Str" + detector.getFound().size);
  if (count == 212) {
    UtilImageIO.saveImage(buffImage,"String_Node_Str");
  }
  count++;
  processedInputImage=true;
}
Program: 150936
Project: 150936
Buggy source:
public static void main(String[] args){
  Class type=ImageUInt8.class;
  VideoPolygonDetectionApp app=new VideoPolygonDetectionApp(type);
  app.setBaseDirectory("String_Node_Str");
  app.loadInputData("String_Node_Str");
  while (!app.getHasProcessedImage()) {
    Thread.yield();
  }
  ShowImages.showWindow(app,"String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  Class type=ImageUInt8.class;
  VideoPolygonDetectionApp app=new VideoPolygonDetectionApp(type);
  app.setBaseDirectory("String_Node_Str");
  app.loadInputData("String_Node_Str");
  while (!app.getHasProcessedImage()) {
    Thread.yield();
  }
  ShowImages.showWindow(app,"String_Node_Str",true);
}
Program: 150937
Project: 150937
Buggy source:
@Override protected void updateAlgGUI(MultiSpectral<I> frame,BufferedImage imageGUI,double fps){
  if (firstFrame) {
    panel.setPreferredSize(new Dimension(imageGUI.getWidth(),imageGUI.getHeight()));
    firstFrame=false;
  }
  ConvertBufferedImage.convertTo(undistorted,imageGUI,true);
  Graphics2D g2=imageGUI.createGraphics();
  FastQueue<Polygon2D_F64> found=detector.getFound();
  g2.setColor(new Color(255,0,0,200));
  g2.setStroke(new BasicStroke(4));
  for (int i=0; i < found.size(); i++) {
    VisualizeShapes.drawPolygon(found.get(i),true,g2);
  }
  panel.setBufferedImageSafe(imageGUI);
  panel.repaint();
}

Fixed version (ground truth):
@Override protected void updateAlgGUI(MultiSpectral<I> frame,BufferedImage imageGUI,double fps){
  if (firstFrame) {
    panel.setPreferredSize(new Dimension(imageGUI.getWidth(),imageGUI.getHeight()));
    firstFrame=false;
  }
  Graphics2D g2=imageGUI.createGraphics();
  FastQueue<Polygon2D_F64> found=detector.getFound();
  g2.setColor(new Color(255,0,0,200));
  g2.setStroke(new BasicStroke(4));
  for (int i=0; i < found.size(); i++) {
    Polygon2D_F64 poly=found.get(i);
    for (int j=0; j < poly.size(); j++) {
      Point2D_F64 p=poly.get(j);
      pointUndistToDist.compute(p.x,p.y,p);
    }
    VisualizeShapes.drawPolygon(found.get(i),true,g2);
  }
  panel.setBufferedImageSafe(imageGUI);
  panel.repaint();
}
Program: 150938
Project: 150938
Buggy source:
@Override public void changeInput(String name,int index){
  stopWorker();
  processedInputImage=false;
  String videoName=inputRefs.get(index).getPath();
  String path=videoName.substring(0,videoName.lastIndexOf('/'));
  intrinsic=UtilIO.loadXML(media.openFile(path + "String_Node_Str"));
  undistorted.reshape(intrinsic.width,intrinsic.height);
  undistorter=LensDistortionOps.imageRemoveDistortion(AdjustmentType.EXPAND,BorderType.EXTENDED,intrinsic,intrinsicUndist,undistorted.getImageType());
  undistorted.reshape(intrinsic.width,intrinsic.height);
  gray.reshape(intrinsic.width,intrinsic.height);
  SimpleImageSequence<MultiSpectral<I>> video=media.openVideo(videoName,ImageType.ms(3,imageClass));
  process(video);
}

Fixed version (ground truth):
@Override public void changeInput(String name,int index){
  stopWorker();
  processedInputImage=false;
  String videoName=inputRefs.get(index).getPath();
  String path=videoName.substring(0,videoName.lastIndexOf('/'));
  intrinsic=UtilIO.loadXML(media.openFile(path + "String_Node_Str"));
  gray.reshape(intrinsic.width,intrinsic.height);
  this.pointUndistToDist=LensDistortionOps.transform_F64(AdjustmentType.FULL_VIEW,intrinsic,null,true);
  PointTransform_F32 pointDistToUndist=LensDistortionOps.transform_F32(AdjustmentType.FULL_VIEW,intrinsic,null,false);
  PointTransform_F32 pointUndistToDist=LensDistortionOps.transform_F32(AdjustmentType.FULL_VIEW,intrinsic,null,true);
  PixelTransform_F32 distToUndist=new PointToPixelTransform_F32(pointDistToUndist);
  PixelTransform_F32 undistToDist=new PointToPixelTransform_F32(pointUndistToDist);
  distToUndist=new PixelTransformCached_F32(intrinsic.width,intrinsic.height,distToUndist);
  undistToDist=new PixelTransformCached_F32(intrinsic.width,intrinsic.height,undistToDist);
  detector.setLensDistortion(intrinsic.width,intrinsic.height,distToUndist,undistToDist);
  SimpleImageSequence<MultiSpectral<I>> video=media.openVideo(videoName,ImageType.ms(3,imageClass));
  process(video);
}
Program: 150939
Project: 150939
Buggy source:
public VideoPolygonDetectionApp(Class<I> imageType){
  super(0,ImageType.ms(3,imageType));
  this.imageClass=imageType;
  gray=GeneralizedImageOps.createSingleBand(imageType,1,1);
  panel.setPreferredSize(new Dimension(640,480));
  panel.setFocusable(true);
  panel.addMouseListener(new MouseListener(){
    @Override public void mouseClicked(    MouseEvent e){
      isPaused=!isPaused;
    }
    @Override public void mousePressed(    MouseEvent e){
    }
    @Override public void mouseReleased(    MouseEvent e){
    }
    @Override public void mouseEntered(    MouseEvent e){
    }
    @Override public void mouseExited(    MouseEvent e){
    }
  }
);
  setMainGUI(panel);
  periodSpinner.setValue(33);
  undistorted=new MultiSpectral<I>(imageType,1,1,3);
  ConfigPolygonDetector config=new ConfigPolygonDetector(4);
  config.refineWithLines=true;
  config.refineWithCorners=false;
  InputToBinary<I> inputToBinary=FactoryThresholdBinary.globalOtsu(0,256,true,imageType);
  detector=FactoryShapeDetector.polygon(inputToBinary,config,imageType);
}

Fixed version (ground truth):
public VideoPolygonDetectionApp(Class<I> imageType){
  super(0,ImageType.ms(3,imageType));
  this.imageClass=imageType;
  gray=GeneralizedImageOps.createSingleBand(imageType,1,1);
  panel.setPreferredSize(new Dimension(640,480));
  panel.setFocusable(true);
  panel.addMouseListener(new MouseListener(){
    @Override public void mouseClicked(    MouseEvent e){
      isPaused=!isPaused;
    }
    @Override public void mousePressed(    MouseEvent e){
    }
    @Override public void mouseReleased(    MouseEvent e){
    }
    @Override public void mouseEntered(    MouseEvent e){
    }
    @Override public void mouseExited(    MouseEvent e){
    }
  }
);
  setMainGUI(panel);
  periodSpinner.setValue(33);
  ConfigPolygonDetector config=new ConfigPolygonDetector(4);
  config.refineWithLines=true;
  config.refineWithCorners=false;
  InputToBinary<I> inputToBinary=FactoryThresholdBinary.globalOtsu(0,256,true,imageType);
  detector=FactoryShapeDetector.polygon(inputToBinary,config,imageType);
}
Program: 150940
Project: 150940
Buggy source:
public static void convertFromRGB(PImage input,ImageBase output){
  if (output instanceof ImageUInt8) {
    convert_RGB_U8(input,(ImageUInt8)output);
  }
 else   if (output instanceof ImageFloat32) {
    convert_RGB_F32(input,(ImageFloat32)output);
  }
 else   if (output instanceof MultiSpectral) {
    Class bandType=((MultiSpectral)output).getType();
    if (bandType == ImageFloat32.class) {
      convert_RGB_MSF32(input,(MultiSpectral)output);
    }
 else     if (bandType == ImageUInt8.class) {
      convert_RGB_MSU8(input,(MultiSpectral)output);
    }
  }
}

Fixed version (ground truth):
public static void convertFromRGB(PImage input,ImageBase output){
  if (output instanceof ImageUInt8) {
    convert_RGB_U8(input,(ImageUInt8)output);
  }
 else   if (output instanceof ImageFloat32) {
    convert_RGB_F32(input,(ImageFloat32)output);
  }
 else   if (output instanceof MultiSpectral) {
    Class bandType=((MultiSpectral)output).getBandType();
    if (bandType == ImageFloat32.class) {
      convert_RGB_MSF32(input,(MultiSpectral)output);
    }
 else     if (bandType == ImageUInt8.class) {
      convert_RGB_MSU8(input,(MultiSpectral)output);
    }
  }
}
Program: 150941
Project: 150941
Buggy source:
public PImage convert(){
  PImage out=new PImage(image.width,image.height,PConstants.RGB);
  if (image.getType() == ImageFloat32.class) {
    ConvertProcessing.convert_MSF32_RGB(image,out);
  }
 else   if (image.getType() == ImageUInt8.class) {
    ConvertProcessing.convert_MSU8_RGB(image,out);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return out;
}

Fixed version (ground truth):
public PImage convert(){
  PImage out=new PImage(image.width,image.height,PConstants.RGB);
  if (image.getBandType() == ImageFloat32.class) {
    ConvertProcessing.convert_MSF32_RGB(image,out);
  }
 else   if (image.getBandType() == ImageUInt8.class) {
    ConvertProcessing.convert_MSU8_RGB(image,out);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return out;
}
Program: 150942
Project: 150942
Buggy source:
/** 
 * <p>Specifies transforms which can be used to change coordinates from distorted to undistorted and the opposite coordinates.  The undistorted image is never explicitly created.</p> <p> WARNING: The undistorted image must have the same bounds as the distorted input image.  This is because several of the bounds checks use the image shape.  This are simplified greatly by this assumption. </p>
 * @param width Input image width.  Used in sanity check only.
 * @param height Input image height.  Used in sanity check only.
 * @param toUndistorted Transform from undistorted to distorted image.
 * @param toDistorted Transform from distorted to undistorted image.
 */
public void setLensDistortion(int width,int height,PixelTransform_F32 toUndistorted,PixelTransform_F32 toDistorted){
  this.toUndistorted=toUndistorted;
  this.toDistorted=toDistorted;
  RectangleLength2D_F32 rect=DistortImageOps.boundBox_F32(width,height,toUndistorted);
  float x1=rect.x0 + rect.width;
  float y1=rect.y0 + rect.height;
  float tol=1e-4f;
  if (rect.getX() < -tol || rect.getY() < -tol || x1 > width + tol || y1 > height + tol) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  if (refineLine != null) {
    refineLine.getSnapToEdge().setTransform(toDistorted);
  }
}

Fixed version (ground truth):
/** 
 * <p>Specifies transforms which can be used to change coordinates from distorted to undistorted and the opposite coordinates.  The undistorted image is never explicitly created.</p> <p> WARNING: The undistorted image must have the same bounds as the distorted input image.  This is because several of the bounds checks use the image shape.  This are simplified greatly by this assumption. </p>
 * @param width Input image width.  Used in sanity check only.
 * @param height Input image height.  Used in sanity check only.
 * @param toUndistorted Transform from undistorted to distorted image.
 * @param toDistorted Transform from distorted to undistorted image.
 */
public void setLensDistortion(int width,int height,PixelTransform_F32 toUndistorted,PixelTransform_F32 toDistorted){
  this.toUndistorted=toUndistorted;
  this.toDistorted=toDistorted;
  RectangleLength2D_F32 rect=DistortImageOps.boundBox_F32(width,height,toUndistorted);
  float x1=rect.x0 + rect.width;
  float y1=rect.y0 + rect.height;
  float tol=1e-4f;
  if (rect.getX() < -tol || rect.getY() < -tol || x1 > width + tol || y1 > height + tol) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  if (refineLine != null) {
    refineLine.getSnapToEdge().setTransform(toDistorted);
  }
  if (refineCorner != null) {
    refineCorner.getSnapToEdge().setTransform(toDistorted);
  }
}
Program: 150943
Project: 150943
Buggy source:
/** 
 * See if it uses the provided lens distortion transforms correctly.  The distortion applied is actually the affine transform instead of lens distortion.  It should find the original rectangles.
 */
@Test public void usingSetLensDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  transform.set(0.8,0,0,0.8,1,2);
  transform=transform.invert(null);
  for (  Class imageType : imageTypes) {
    checkDetected_LensDistortion(imageType,0.5);
  }
}

Fixed version (ground truth):
/** 
 * See if it uses the provided lens distortion transforms correctly.  The distortion applied is actually the affine transform instead of lens distortion.  It should find the original rectangles.
 */
@Test public void usingSetLensDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  transform.set(0.8,0,0,0.8,1,2);
  transform=transform.invert(null);
  for (  Class imageType : imageTypes) {
    checkDetected_LensDistortion(imageType,true,0.5);
    checkDetected_LensDistortion(imageType,false,0.5);
  }
}
Program: 150944
Project: 150944
Buggy source:
@Test public void rejectShapes_circle(){
  BufferedImage work=new BufferedImage(200,220,BufferedImage.TYPE_INT_RGB);
  Graphics2D g2=work.createGraphics();
  g2.setColor(Color.WHITE);
  g2.fillRect(0,0,200,220);
  g2.setColor(Color.BLACK);
  g2.fillOval(30,30,40,50);
  ImageUInt8 gray=ConvertBufferedImage.convertFrom(work,(ImageUInt8)null);
  for (int i=3; i <= 6; i++) {
    BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,i);
    alg.process(gray);
    assertEquals("String_Node_Str" + i,0,alg.getFound().size());
  }
}

Fixed version (ground truth):
@Test public void rejectShapes_circle(){
  BufferedImage work=new BufferedImage(200,220,BufferedImage.TYPE_INT_RGB);
  Graphics2D g2=work.createGraphics();
  g2.setColor(Color.WHITE);
  g2.fillRect(0,0,200,220);
  g2.setColor(Color.BLACK);
  g2.fillOval(30,30,40,50);
  ImageUInt8 gray=ConvertBufferedImage.convertFrom(work,(ImageUInt8)null);
  for (int i=3; i <= 6; i++) {
    BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,i,true);
    alg.process(gray);
    assertEquals("String_Node_Str" + i,0,alg.getFound().size());
  }
}
Program: 150945
Project: 150945
Buggy source:
/** 
 * Should sanity check transforms to make sure they don't go outside the image
 */
@Test public void setTransform_input(){
  Affine2D_F32 a=new Affine2D_F32();
  transform.set(1.2,0,0,1.2,0,0);
  UtilAffine.convert(transform,a);
  PixelTransform_F32 tranFrom=new PixelTransformAffine_F32(a);
  PixelTransform_F32 tranTo=new PixelTransformAffine_F32(a.invert(null));
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4);
  alg.setLensDistortion(width,height,tranTo,tranFrom);
  try {
    alg.setLensDistortion(width,height,tranFrom,tranTo);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ignore) {
  }
}

Fixed version (ground truth):
/** 
 * Should sanity check transforms to make sure they don't go outside the image
 */
@Test public void setTransform_input(){
  Affine2D_F32 a=new Affine2D_F32();
  transform.set(1.2,0,0,1.2,0,0);
  UtilAffine.convert(transform,a);
  PixelTransform_F32 tranFrom=new PixelTransformAffine_F32(a);
  PixelTransform_F32 tranTo=new PixelTransformAffine_F32(a.invert(null));
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4,true);
  alg.setLensDistortion(width,height,tranTo,tranFrom);
  try {
    alg.setLensDistortion(width,height,tranFrom,tranTo);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ignore) {
  }
}
Program: 150946
Project: 150946
Buggy source:
private void checkDetected(Class imageType,double tol){
  renderDistortedRectangle(imageType);
  int numberOfSides=4;
  BinaryPolygonConvexDetector alg=createDetector(imageType,numberOfSides);
  alg.process(dist);
  FastQueue<Polygon2D_F64> found=alg.getFound();
  assertEquals(rectangles.size(),found.size);
  for (int i=0; i < found.size; i++) {
    assertEquals(1,findMatches(found.get(i),tol));
  }
}

Fixed version (ground truth):
private void checkDetected(Class imageType,boolean useLines,double tol){
  renderDistortedRectangle(imageType);
  int numberOfSides=4;
  BinaryPolygonConvexDetector alg=createDetector(imageType,numberOfSides,useLines);
  alg.process(dist);
  FastQueue<Polygon2D_F64> found=alg.getFound();
  assertEquals(rectangles.size(),found.size);
  for (int i=0; i < found.size; i++) {
    assertEquals(1,findMatches(found.get(i),tol));
  }
}
Program: 150947
Project: 150947
Buggy source:
@Test public void rejectShapes_triangle(){
  BufferedImage work=new BufferedImage(200,220,BufferedImage.TYPE_INT_RGB);
  Graphics2D g2=work.createGraphics();
  g2.setColor(Color.WHITE);
  g2.fillRect(0,0,200,220);
  g2.setColor(Color.BLACK);
  g2.fillPolygon(new int[]{10,50,30},new int[]{10,10,40},3);
  ImageUInt8 gray=ConvertBufferedImage.convertFrom(work,(ImageUInt8)null);
  for (int i=3; i <= 6; i++) {
    BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,i);
    alg.process(gray);
    if (i == 3) {
      double tol=0.5;
      assertEquals(1,alg.getFound().size());
      Polygon2D_F64 found=(Polygon2D_F64)alg.getFound().get(0);
      assertEquals(10,found.get(0).x,tol);
      assertEquals(10,found.get(0).y,tol);
      assertEquals(30,found.get(1).x,tol);
      assertEquals(40,found.get(1).y,tol);
      assertEquals(50,found.get(2).x,tol);
      assertEquals(10,found.get(2).y,tol);
    }
 else     assertEquals(0,alg.getFound().size());
  }
}

Fixed version (ground truth):
@Test public void rejectShapes_triangle(){
  BufferedImage work=new BufferedImage(200,220,BufferedImage.TYPE_INT_RGB);
  Graphics2D g2=work.createGraphics();
  g2.setColor(Color.WHITE);
  g2.fillRect(0,0,200,220);
  g2.setColor(Color.BLACK);
  g2.fillPolygon(new int[]{10,50,30},new int[]{10,10,40},3);
  ImageUInt8 gray=ConvertBufferedImage.convertFrom(work,(ImageUInt8)null);
  for (int i=3; i <= 6; i++) {
    BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,i,true);
    alg.process(gray);
    if (i == 3) {
      double tol=0.5;
      assertEquals(1,alg.getFound().size());
      Polygon2D_F64 found=(Polygon2D_F64)alg.getFound().get(0);
      assertEquals(10,found.get(0).x,tol);
      assertEquals(10,found.get(0).y,tol);
      assertEquals(30,found.get(1).x,tol);
      assertEquals(40,found.get(1).y,tol);
      assertEquals(50,found.get(2).x,tol);
      assertEquals(10,found.get(2).y,tol);
    }
 else     assertEquals(0,alg.getFound().size());
  }
}
Program: 150948
Project: 150948
Buggy source:
@Test public void easyTestNoDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  for (  Class imageType : imageTypes) {
    checkDetected(imageType,1e-8);
  }
}

Fixed version (ground truth):
@Test public void easyTestNoDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  for (  Class imageType : imageTypes) {
    checkDetected(imageType,true,1e-8);
    checkDetected(imageType,false,1e-8);
  }
}
Program: 150949
Project: 150949
Buggy source:
@Test public void touchesBorder_false(){
  List<Point2D_I32> contour=new ArrayList<Point2D_I32>();
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4);
  alg.getBinary().reshape(20,30);
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(10,1));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(10,28));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(1,15));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(18,15));
  assertFalse(alg.touchesBorder(contour));
}

Fixed version (ground truth):
@Test public void touchesBorder_false(){
  List<Point2D_I32> contour=new ArrayList<Point2D_I32>();
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4,true);
  alg.getBinary().reshape(20,30);
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(10,1));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(10,28));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(1,15));
  assertFalse(alg.touchesBorder(contour));
  contour.add(new Point2D_I32(18,15));
  assertFalse(alg.touchesBorder(contour));
}
Program: 150950
Project: 150950
Buggy source:
private void checkDetected_LensDistortion(Class imageType,double tol){
  renderDistortedRectangle(imageType);
  Affine2D_F32 a=new Affine2D_F32();
  UtilAffine.convert(transform,a);
  PixelTransform_F32 tranFrom=new PixelTransformAffine_F32(a);
  PixelTransform_F32 tranTo=new PixelTransformAffine_F32(a.invert(null));
  int numberOfSides=4;
  BinaryPolygonConvexDetector alg=createDetector(imageType,numberOfSides);
  alg.setLensDistortion(dist.width,dist.height,tranTo,tranFrom);
  alg.process(dist);
  FastQueue<Polygon2D_F64> found=alg.getFound();
  assertEquals(rectangles.size(),found.size);
  for (int i=0; i < found.size; i++) {
    assertEquals(1,findMatchesOriginal(found.get(i),tol));
  }
}

Fixed version (ground truth):
private void checkDetected_LensDistortion(Class imageType,boolean useLines,double tol){
  renderDistortedRectangle(imageType);
  Affine2D_F32 a=new Affine2D_F32();
  UtilAffine.convert(transform,a);
  PixelTransform_F32 tranFrom=new PixelTransformAffine_F32(a);
  PixelTransform_F32 tranTo=new PixelTransformAffine_F32(a.invert(null));
  int numberOfSides=4;
  BinaryPolygonConvexDetector alg=createDetector(imageType,numberOfSides,useLines);
  alg.setLensDistortion(dist.width,dist.height,tranTo,tranFrom);
  alg.process(dist);
  FastQueue<Polygon2D_F64> found=alg.getFound();
  assertEquals(rectangles.size(),found.size);
  for (int i=0; i < found.size; i++) {
    assertEquals(1,findMatchesOriginal(found.get(i),tol));
  }
}
Program: 150951
Project: 150951
Buggy source:
private BinaryPolygonConvexDetector createDetector(Class imageType,int numberOfSides){
  InputToBinary inputToBinary=FactoryThresholdBinary.globalFixed(100,true,imageType);
  return FactoryShapeDetector.polygon(inputToBinary,new ConfigPolygonDetector(numberOfSides),imageType);
}

Fixed version (ground truth):
private BinaryPolygonConvexDetector createDetector(Class imageType,int numberOfSides,boolean useLines){
  InputToBinary inputToBinary=FactoryThresholdBinary.globalFixed(100,true,imageType);
  ConfigPolygonDetector config=new ConfigPolygonDetector(numberOfSides);
  config.refineWithLines=useLines;
  config.refineWithCorners=!useLines;
  return FactoryShapeDetector.polygon(inputToBinary,config,imageType);
}
Program: 150952
Project: 150952
Buggy source:
@Test public void someAffineDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  transform.set(1.1,0.2,0.12,1.3,10.2,20.3);
  for (  Class imageType : imageTypes) {
    checkDetected(imageType,0.3);
  }
}

Fixed version (ground truth):
@Test public void someAffineDistortion(){
  rectangles.add(new Rectangle2D_I32(30,30,60,60));
  rectangles.add(new Rectangle2D_I32(90,30,120,60));
  rectangles.add(new Rectangle2D_I32(30,90,60,120));
  rectangles.add(new Rectangle2D_I32(90,90,120,120));
  transform.set(1.1,0.2,0.12,1.3,10.2,20.3);
  for (  Class imageType : imageTypes) {
    checkDetected(imageType,true,0.3);
    checkDetected(imageType,false,0.35);
  }
}
Program: 150953
Project: 150953
Buggy source:
@Test public void touchesBorder_true(){
  List<Point2D_I32> contour=new ArrayList<Point2D_I32>();
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4);
  alg.getBinary().reshape(20,30);
  contour.add(new Point2D_I32(10,0));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(10,29));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(0,15));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(19,15));
  assertTrue(alg.touchesBorder(contour));
}

Fixed version (ground truth):
@Test public void touchesBorder_true(){
  List<Point2D_I32> contour=new ArrayList<Point2D_I32>();
  BinaryPolygonConvexDetector alg=createDetector(ImageUInt8.class,4,true);
  alg.getBinary().reshape(20,30);
  contour.add(new Point2D_I32(10,0));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(10,29));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(0,15));
  assertTrue(alg.touchesBorder(contour));
  contour.clear();
  contour.add(new Point2D_I32(19,15));
  assertTrue(alg.touchesBorder(contour));
}
Program: 150956
Project: 150956
Buggy source:
private void insertFiducial(int row,int col,ImageUInt8 binary,String inputName){
  System.out.println("String_Node_Str" + row + "String_Node_Str"+ col);
  out.print("String_Node_Str" + (col * pageLength) + "String_Node_Str"+ "String_Node_Str"+ (row * pageLength)+ "String_Node_Str"+ "String_Node_Str");
  out.println();
  out.println("String_Node_Str");
  if (displayInfo) {
    out.print("String_Node_Str" + "String_Node_Str" + (pageLength - 10) + "String_Node_Str"+ inputName+ "String_Node_Str"+ width+ "String_Node_Str");
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
}

Fixed version (ground truth):
private void insertFiducial(int row,int col,String inputName){
  out.print("String_Node_Str" + (col * pageLength) + "String_Node_Str"+ "String_Node_Str"+ (row * pageLength)+ "String_Node_Str"+ "String_Node_Str");
  out.println();
  out.println("String_Node_Str");
  if (displayInfo) {
    out.print("String_Node_Str" + "String_Node_Str" + (pageLength - 10) + "String_Node_Str"+ inputName+ "String_Node_Str"+ width+ "String_Node_Str");
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
}
Program: 150957
Project: 150957
Buggy source:
/** 
 * Performs bubble sort on the first 4 lines to ensure they are in a contour order
 */
protected static void bubbleSortLines(FastQueue<Segment> segments){
  for (int i=0; i < 4; i++) {
    int bestValue=segments.get(i).index0;
    int bestIndex=i;
    for (int j=i + 1; j < 4; j++) {
      Segment b=segments.get(j);
      if (b.index0 < bestValue) {
        bestIndex=j;
        bestValue=b.index0;
      }
    }
    if (bestIndex != i) {
      Segment tmp=segments.data[i];
      segments.data[i]=segments.data[bestIndex];
      segments.data[bestIndex]=tmp;
    }
  }
}

Fixed version (ground truth):
/** 
 * Performs bubble sort on the first 4 lines to ensure they are in a contour order
 */
protected static void bubbleSortLines(FastQueue<Segment> segments){
  for (int i=0; i < 4; i++) {
    int bestValue=segments.get(i).index0;
    int bestIndex=i;
    for (int j=i + 1; j < segments.size; j++) {
      Segment b=segments.get(j);
      if (b.index0 < bestValue) {
        bestIndex=j;
        bestValue=b.index0;
      }
    }
    if (bestIndex != i) {
      Segment tmp=segments.data[i];
      segments.data[i]=segments.data[bestIndex];
      segments.data[bestIndex]=tmp;
    }
  }
}
Program: 150958
Project: 150958
Buggy source:
@Test public void bubbleSortLines(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void bubbleSortLines(){
  ReduceCornersInContourPolygon alg=new ReduceCornersInContourPolygon(4,10,true);
  List<Integer> indexes=new ArrayList<Integer>();
  for (int i=0; i < 10; i++) {
    indexes.add(i);
  }
  for (int i=0; i < 20; i++) {
    Collections.shuffle(indexes,rand);
    alg.segments.reset();
    for (    Integer index : indexes) {
      alg.segments.grow().index0=index;
    }
    ReduceCornersInContourPolygon.bubbleSortLines(alg.segments);
    assertEquals(0,alg.segments.get(0).index0);
    assertEquals(1,alg.segments.get(1).index0);
    assertEquals(2,alg.segments.get(2).index0);
    assertEquals(3,alg.segments.get(3).index0);
  }
}
Program: 150959
Project: 150959
Buggy source:
@Test public void checkPolygonCornerDistance(){
  fail("String_Node_Str");
}

Fixed version (ground truth):
@Test public void checkPolygonCornerDistance(){
  List<Point2D_I32> contour=new ArrayList<Point2D_I32>();
  for (int i=0; i < 20; i++) {
    contour.add(new Point2D_I32(rand.nextInt(),rand.nextInt()));
  }
  contour.get(3).set(10,10);
  contour.get(4).set(13,10);
  contour.get(8).set(20,10);
  contour.get(12).set(20,20);
  contour.get(18).set(10,20);
  GrowQueue_I32 corners=new GrowQueue_I32();
  corners.add(3);
  corners.add(4);
  corners.add(8);
  corners.add(12);
  corners.add(18);
  Polygon2D_F64 poly=new Polygon2D_F64(10,10,20,10,20,20,10,20);
  ReduceCornersInContourPolygon alg=new ReduceCornersInContourPolygon(4,2,true);
  assertTrue(alg.checkPolygonCornerDistance(poly,contour,corners));
  contour.get(3).set(8,10);
  assertTrue(alg.checkPolygonCornerDistance(poly,contour,corners));
  contour.get(3).set(7,10);
  assertFalse(alg.checkPolygonCornerDistance(poly,contour,corners));
}
Program: 150962
Project: 150962
Buggy source:
public void print(){
  for (int i=0; i < width; i++) {
  }
  System.out.println();
}

Fixed version (ground truth):
public void print(){
  for (int i=0; i < width; i++) {
    System.out.printf("String_Node_Str",data[i]);
  }
  System.out.println();
}
Program: 150963
Project: 150963
Buggy source:
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @return A new kernel.
 */
public static Kernel1D_F32 wrap(float data[],int width){
  Kernel1D_F32 ret=new Kernel1D_F32();
  ret.data=data;
  ret.width=width;
  ret.offset=width / 2;
  return ret;
}

Fixed version (ground truth):
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @param offset Location of the origin in the array
 * @return A new kernel.
 */
public static Kernel1D_F32 wrap(float data[],int width,int offset){
  Kernel1D_F32 ret=new Kernel1D_F32();
  ret.data=data;
  ret.width=width;
  ret.offset=offset;
  return ret;
}
Program: 150964
Project: 150964
Buggy source:
public void print(){
  for (int i=0; i < width; i++) {
  }
  System.out.println();
}

Fixed version (ground truth):
public void print(){
  for (int i=0; i < width; i++) {
    System.out.printf("String_Node_Str",data[i]);
  }
  System.out.println();
}
Program: 150965
Project: 150965
Buggy source:
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @return A new kernel.
 */
public static Kernel1D_F64 wrap(double data[],int width){
  Kernel1D_F64 ret=new Kernel1D_F64();
  ret.data=data;
  ret.width=width;
  ret.offset=width / 2;
  return ret;
}

Fixed version (ground truth):
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @param offset Location of the origin in the array
 * @return A new kernel.
 */
public static Kernel1D_F64 wrap(double data[],int width,int offset){
  Kernel1D_F64 ret=new Kernel1D_F64();
  ret.data=data;
  ret.width=width;
  ret.offset=offset;
  return ret;
}
Program: 150966
Project: 150966
Buggy source:
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @return A new kernel.
 */
public static Kernel1D_I32 wrap(int data[],int width){
  Kernel1D_I32 ret=new Kernel1D_I32();
  ret.data=data;
  ret.width=width;
  ret.offset=width / 2;
  return ret;
}

Fixed version (ground truth):
/** 
 * Creates a kernel whose elements are the specified data array and has the specified width.
 * @param data  The array who will be the kernel's data.  Reference is saved.
 * @param width The kernel's width.
 * @param offset Location of the origin in the array
 * @return A new kernel.
 */
public static Kernel1D_I32 wrap(int data[],int width,int offset){
  Kernel1D_I32 ret=new Kernel1D_I32();
  ret.data=data;
  ret.width=width;
  ret.offset=offset;
  return ret;
}
Program: 150967
Project: 150967
Buggy source:
@Override public boolean isInteger(){
  return false;
}

Fixed version (ground truth):
@Override public boolean isInteger(){
  return true;
}
Program: 150968
Project: 150968
Buggy source:
public void compareMethod(Method target,String validationName,int radius,int offset){
  this.kernelWidth=radius * 2 + 1;
  this.kernelRadius=radius;
  this.offset=offset;
  super.compareMethod(target,validationName);
}

Fixed version (ground truth):
public void compareMethod(Method target,String validationName,int width,int offset){
  this.kernelWidth=width;
  this.offset=offset;
  super.compareMethod(target,validationName);
}
Program: 150969
Project: 150969
Buggy source:
private KernelBase createKernel(Class<?> paramType){
  KernelBase kernel;
  if (Kernel1D_F32.class == paramType) {
    kernel=FactoryKernel.random1D_F32(kernelWidth,kernelRadius,-1,1,rand);
  }
 else   if (Kernel1D_F64.class == paramType) {
    kernel=FactoryKernel.random1D_F64(kernelWidth,kernelRadius,0,5,rand);
  }
 else   if (Kernel1D_I32.class == paramType) {
    kernel=FactoryKernel.random1D_I32(kernelWidth,kernelRadius,0,5,rand);
  }
 else   if (Kernel2D_I32.class == paramType) {
    kernel=FactoryKernel.random2D_I32(kernelWidth,kernelRadius,-1,1,rand);
  }
 else   if (Kernel2D_F32.class == paramType) {
    kernel=FactoryKernel.random2D_F32(kernelWidth,kernelRadius,0,5,rand);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  kernel.offset=offset;
  return kernel;
}

Fixed version (ground truth):
private KernelBase createKernel(Class<?> paramType){
  KernelBase kernel;
  if (Kernel1D_F32.class == paramType) {
    kernel=FactoryKernel.random1D_F32(kernelWidth,offset,-1,1,rand);
  }
 else   if (Kernel1D_F64.class == paramType) {
    kernel=FactoryKernel.random1D_F64(kernelWidth,offset,0,5,rand);
  }
 else   if (Kernel1D_I32.class == paramType) {
    kernel=FactoryKernel.random1D_I32(kernelWidth,offset,0,5,rand);
  }
 else   if (Kernel2D_I32.class == paramType) {
    kernel=FactoryKernel.random2D_I32(kernelWidth,offset,-1,1,rand);
  }
 else   if (Kernel2D_F32.class == paramType) {
    kernel=FactoryKernel.random2D_F32(kernelWidth,offset,0,5,rand);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return kernel;
}