nus-yam/ex-repair huggingface dataset:
Program: 31799
Project: 31799
Buggy source:
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
}

Fixed version (ground truth):
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
  freq_lower_bound_for_log=sampleRate / fftLen;
  float freq_lower_bound_local=0;
  if (spectrumPlot.axisX.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  RectF axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,spectrumPlot.axisY.vHigherBound);
  Log.i(TAG,"String_Node_Str" + canvasWidth + "String_Node_Str"+ canvasHeight+ "String_Node_Str"+ spectrumPlot.axisY.vHigherBound);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  spectrogramPlot.setupSpectrogram(sampleRate,fftLen,timeDurationE,nAve);
  freq_lower_bound_local=0;
  if (spectrogramPlot.axisFreq.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  if (spectrogramPlot.showFreqAlongX) {
    axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve);
  }
 else {
    axisBounds=new RectF(0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve,freq_lower_bound_local);
  }
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
}
Program: 31800
Project: 31800
Buggy source:
public void switch2Spectrum(){
  Log.v(TAG,"String_Node_Str");
  if (showMode == 0) {
    return;
  }
  showMode=0;
  if (showFreqAlongX) {
  }
 else {
    xShift=1 - yShift - 1 / yZoom;
    xZoom=yZoom;
  }
  yShift=oldYShift;
  yZoom=oldYZoom;
}

Fixed version (ground truth):
public void switch2Spectrum(){
  Log.v(TAG,"String_Node_Str");
  if (showMode == 0) {
    return;
  }
  showMode=0;
  xZoom=spectrogramPlot.axisFreq.zoom;
  xShift=spectrogramPlot.axisFreq.shift;
  if (!spectrogramPlot.showFreqAlongX) {
    xShift=1 - 1 / xZoom - xShift;
  }
  spectrumPlot.axisX.setZoomShift(xZoom,xShift);
  yZoom=spectrumPlot.axisY.zoom;
  yShift=spectrumPlot.axisY.shift;
}
Program: 31801
Project: 31801
Buggy source:
private float clampYShift(float offset){
}

Fixed version (ground truth):
private float clampYShift(float offset){
  if (showMode == 0) {
    return clamp(offset,(maxDB - spectrumPlot.axisY.vLowerBound) / spectrumPlot.axisY.diffVBounds(),(minDB - spectrumPlot.axisY.vLowerBound) / spectrumPlot.axisY.diffVBounds() - 1 / yZoom);
  }
 else {
    return clamp(offset,0f,1 - (1 - 0.25f / canvasHeight) / yZoom);
  }
}
Program: 31802
Project: 31802
Buggy source:
public void setShowTimeAxis(boolean bSTA){
  bShowTimeAxis=bSTA;
}

Fixed version (ground truth):
public void setShowTimeAxis(boolean bSTA){
  spectrogramPlot.setShowTimeAxis(bSTA);
}
Program: 31803
Project: 31803
Buggy source:
public void setShowFreqAlongX(boolean b){
  if (showMode == 1 && showFreqAlongX != b) {
    float t;
    if (showFreqAlongX) {
      t=xShift;
      xShift=yShift;
      yShift=1 - t - 1 / xZoom;
    }
 else {
      t=yShift;
      yShift=xShift;
      xShift=1 - t - 1 / yZoom;
    }
    t=xZoom;
    xZoom=yZoom;
    yZoom=t;
  }
  showFreqAlongX=b;
}

Fixed version (ground truth):
public void setShowFreqAlongX(boolean b){
  spectrogramPlot.setShowFreqAlongX(b);
  if (showMode == 0)   return;
  if (spectrogramPlot.showFreqAlongX) {
    xZoom=spectrogramPlot.axisFreq.zoom;
    xShift=spectrogramPlot.axisFreq.shift;
    yZoom=spectrogramPlot.axisTime.zoom;
    yShift=spectrogramPlot.axisTime.shift;
  }
 else {
    xZoom=spectrogramPlot.axisTime.zoom;
    xShift=spectrogramPlot.axisTime.shift;
    yZoom=spectrogramPlot.axisFreq.zoom;
    yShift=spectrogramPlot.axisFreq.shift;
  }
}
Program: 31804
Project: 31804
Buggy source:
public void setSmoothRender(boolean b){
  if (b) {
    smoothBmpPaint=new Paint(Paint.FILTER_BITMAP_FLAG);
  }
 else {
    smoothBmpPaint=null;
  }
}

Fixed version (ground truth):
public void setSmoothRender(boolean b){
  spectrogramPlot.setSmoothRender(b);
}
Program: 31805
Project: 31805
Buggy source:
@Override protected void onDraw(Canvas c){
  fpsCounter.inc();
  isBusy=true;
  c.concat(matrix0);
  c.save();
  if (showMode == 0) {
    drawSpectrumPlot(c);
  }
 else {
    drawSpectrogramPlot(c);
  }
  isBusy=false;
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas c){
  fpsCounter.inc();
  isBusy=true;
  c.concat(matrix0);
  c.save();
  if (showMode == 0) {
    spectrumPlot.drawSpectrumPlot(c,savedDBSpectrum);
  }
 else {
    spectrogramPlot.drawSpectrogramPlot(c);
  }
  isBusy=false;
}
Program: 31806
Project: 31806
Buggy source:
public void saveSpectrum(double[] db){
}

Fixed version (ground truth):
public void saveSpectrum(double[] db){
synchronized (savedDBSpectrum) {
    if (savedDBSpectrum == null || savedDBSpectrum.length != db.length) {
      savedDBSpectrum=new double[db.length];
    }
    System.arraycopy(db,0,savedDBSpectrum,0,db.length);
  }
  if (showMode == 1)   spectrogramPlot.saveRowSpectrumAsColor(savedDBSpectrum);
}
Program: 31807
Project: 31807
Buggy source:
public void setSpectrogramModeShifting(boolean b){
  if (b) {
    showModeSpectrogram=0;
  }
 else {
    showModeSpectrogram=1;
  }
}

Fixed version (ground truth):
public void setSpectrogramModeShifting(boolean b){
  spectrogramPlot.setSpectrogramModeShifting(b);
}
Program: 31808
Project: 31808
Buggy source:
private void setup(AttributeSet attrs,Context _context){
}

Fixed version (ground truth):
private void setup(Context _context){
  context=_context;
  Log.v(TAG,"String_Node_Str");
  matrix0.reset();
  matrix0.setTranslate(0f,0f);
  matrix0.postScale(1f,1f);
  Resources res=_context.getResources();
  minDB=Float.parseFloat(res.getString(R.string.max_DB_range));
  xZoom=1f;
  xShift=0f;
  yZoom=1f;
  yShift=0f;
  canvasWidth=canvasHeight=0;
  spectrumPlot=new SpectrumPlot(context);
  spectrogramPlot=new SpectrogramPlot(context);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,null);
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,null);
  spectrumPlot.setZooms(xZoom,xShift,yZoom,yShift);
  spectrogramPlot.setZooms(xZoom,xShift,yZoom,yShift);
  spectrumPlot.axisY.vLowerBound=minDB;
}
Program: 31809
Project: 31809
Buggy source:
public void switch2Spectrogram(int sampleRate,int fftLen,double timeDurationE){
  if (showMode == 0 && canvasHeight > 0) {
    oldXShift=xShift;
    oldXZoom=xZoom;
    oldYShift=yShift;
    oldYZoom=yZoom;
    if (showFreqAlongX) {
      yZoom=1;
      yShift=0;
    }
 else {
      yZoom=xZoom;
      yShift=1 - 1 / yZoom - xShift;
      xZoom=1;
      xShift=0;
    }
  }
  setupSpectrogram(sampleRate,fftLen,timeDurationE);
  showMode=1;
}

Fixed version (ground truth):
public void switch2Spectrogram(){
  if (showMode == 0 && canvasHeight > 0) {
    if (spectrogramPlot.showFreqAlongX) {
      yZoom=spectrogramPlot.axisTime.zoom;
      yShift=spectrogramPlot.axisTime.shift;
      spectrogramPlot.axisFreq.setZoomShift(xZoom,xShift);
    }
 else {
      yZoom=xZoom;
      yShift=1 - 1 / xZoom - xShift;
      xZoom=spectrogramPlot.axisTime.zoom;
      xShift=spectrogramPlot.axisTime.shift;
      spectrogramPlot.axisFreq.setZoomShift(yZoom,yShift);
    }
  }
  showMode=1;
}
Program: 31810
Project: 31810
Buggy source:
void setAxisModeLinear(boolean b){
}

Fixed version (ground truth):
void setAxisModeLinear(boolean b){
  ScreenPhysicalMapping.Type mapType;
  if (b) {
    mapType=ScreenPhysicalMapping.Type.LINEAR;
  }
 else {
    mapType=ScreenPhysicalMapping.Type.LOG;
  }
  spectrumPlot.setFreqAxisMode(mapType,freq_lower_bound_for_log);
  spectrogramPlot.setFreqAxisMode(mapType,freq_lower_bound_for_log);
  if (showMode == 0) {
    xZoom=spectrumPlot.axisX.zoom;
    xShift=spectrumPlot.axisX.shift;
  }
 else   if (showMode == 1) {
    if (spectrogramPlot.showFreqAlongX) {
      xZoom=spectrogramPlot.axisFreq.zoom;
      xShift=spectrogramPlot.axisFreq.shift;
    }
 else {
      yZoom=spectrogramPlot.axisFreq.zoom;
      yShift=spectrogramPlot.axisFreq.shift;
    }
  }
}
Program: 31811
Project: 31811
Buggy source:
double getSampleRate(){
}

Fixed version (ground truth):
double getSampleRate(){
  return sampleRateReal;
}
Program: 31812
Project: 31812
Buggy source:
RecorderMonitor(int sampleRateIn,int bufferSampleSizeIn,String TAG1){
  sampleRate=sampleRateIn;
  bufferSampleSize=bufferSampleSizeIn;
  timeUpdateInterval=2000;
  String TAG0="String_Node_Str";
  TAG=TAG1 + TAG0;
}

Fixed version (ground truth):
RecorderMonitor(int sampleRateIn,int bufferSampleSizeIn,String TAG1){
  sampleRate=sampleRateIn;
  bufferSampleSize=bufferSampleSizeIn;
  timeUpdateInterval=2000;
  TAG=TAG1 + TAG0;
}
Program: 31813
Project: 31813
Buggy source:
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
  freq_lower_bound_for_log=(float)sampleRate / fftLen;
  float freq_lower_bound_local=0;
  if (spectrumPlot.axisX.mapType != ScreenPhysicalMapping.Type.LINEAR) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  RectF axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,spectrumPlot.axisY.vHigherBound);
  Log.i(TAG,"String_Node_Str" + canvasWidth + "String_Node_Str"+ canvasHeight+ "String_Node_Str"+ spectrumPlot.axisY.vHigherBound);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  spectrogramPlot.setupSpectrogram(sampleRate,fftLen,timeDurationE,nAve);
  freq_lower_bound_local=0;
  if (spectrogramPlot.axisFreq.mapType != ScreenPhysicalMapping.Type.LINEAR) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  if (spectrogramPlot.showFreqAlongX) {
    axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve);
  }
 else {
    axisBounds=new RectF(0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve,freq_lower_bound_local);
  }
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
}

Fixed version (ground truth):
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
  freq_lower_bound_for_log=(float)sampleRate / fftLen;
  float freq_lower_bound_local=0;
  if (spectrumPlot.axisX.mapType == ScreenPhysicalMapping.Type.LOG) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  RectF axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,spectrumPlot.axisY.vHigherBound);
  Log.i(TAG,"String_Node_Str" + canvasWidth + "String_Node_Str"+ canvasHeight+ "String_Node_Str"+ spectrumPlot.axisY.vHigherBound);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  freq_lower_bound_local=0;
  if (spectrogramPlot.axisFreq.mapType == ScreenPhysicalMapping.Type.LOG) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  if (spectrogramPlot.showFreqAlongX) {
    axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve);
  }
 else {
    axisBounds=new RectF(0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve,freq_lower_bound_local);
  }
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  spectrogramPlot.setupSpectrogram(sampleRate,fftLen,timeDurationE,nAve);
}
Program: 31814
Project: 31814
Buggy source:
public void inc(){
  frameCount++;
  long timeNow=SystemClock.uptimeMillis();
  if (timeOld + timeUpdateInterval <= timeNow) {
    fps=1000 * (double)frameCount / (timeNow - timeOld);
    Log.i(TAG_OUTSIDE,"String_Node_Str" + Math.round(100 * fps) / 100.0 + "String_Node_Str" + frameCount + "String_Node_Str" + (timeNow - timeOld) + "String_Node_Str");
    timeOld=timeNow;
    frameCount=0;
  }
}

Fixed version (ground truth):
public void inc(){
  frameCount++;
  long timeNow=SystemClock.uptimeMillis();
  if (timeOld + timeUpdateInterval <= timeNow) {
    fps=1000 * (double)frameCount / (timeNow - timeOld);
    Log.d(TAG_OUTSIDE,"String_Node_Str" + Math.round(100 * fps) / 100.0 + "String_Node_Str" + frameCount + "String_Node_Str" + (timeNow - timeOld) + "String_Node_Str");
    timeOld=timeNow;
    frameCount=0;
  }
}
Program: 31815
Project: 31815
Buggy source:
void setupSpectrogram(int sampleRate,int fftLen,double timeDurationE,int nAve){
  timeWatch=timeDurationE;
  timeMultiplier=nAve;
  double timeInc=fftLen / 2.0 / sampleRate;
synchronized (this) {
    boolean bNeedClean=nFreqPoints != fftLen / 2;
    nFreqPoints=fftLen / 2;
    nTimePoints=(int)Math.ceil(timeWatch / timeInc);
    if (spectrogramColors == null || spectrogramColors.length != nFreqPoints * nTimePoints) {
      spectrogramColors=new int[nFreqPoints * nTimePoints];
      spectrogramColorsShifting=new int[nFreqPoints * nTimePoints];
      bNeedClean=true;
    }
    if (spectrogramColorsPt >= nTimePoints) {
      Log.w(TAG,"String_Node_Str");
      bNeedClean=true;
    }
    if (bNeedClean) {
      spectrogramColorsPt=0;
      Arrays.fill(spectrogramColors,0);
    }
  }
  logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
  Log.i(TAG,"String_Node_Str" + "String_Node_Str" + sampleRate + "String_Node_Str"+ fftLen+ "String_Node_Str"+ timeDurationE);
}

Fixed version (ground truth):
void setupSpectrogram(int sampleRate,int fftLen,double timeDurationE,int nAve){
  timeWatch=timeDurationE;
  timeMultiplier=nAve;
  double timeInc=fftLen / 2.0 / sampleRate;
synchronized (this) {
    boolean bNeedClean=nFreqPoints != fftLen / 2;
    nFreqPoints=fftLen / 2;
    nTimePoints=(int)Math.ceil(timeWatch / timeInc);
    if (spectrogramColors == null || spectrogramColors.length != nFreqPoints * nTimePoints) {
      spectrogramColors=new int[nFreqPoints * nTimePoints];
      spectrogramColorsShifting=new int[nFreqPoints * nTimePoints];
      bNeedClean=true;
    }
    if (!bNeedClean && spectrogramColorsPt >= nTimePoints) {
      Log.w(TAG,"String_Node_Str");
      Log.i(TAG,"String_Node_Str" + spectrogramColorsPt + "String_Node_Str"+ nFreqPoints+ "String_Node_Str"+ nTimePoints);
      bNeedClean=true;
    }
    if (bNeedClean) {
      spectrogramColorsPt=0;
      Arrays.fill(spectrogramColors,0);
    }
  }
synchronized (this) {
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
synchronized (this) {
    logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
  Log.i(TAG,"String_Node_Str" + "String_Node_Str" + sampleRate + "String_Node_Str"+ fftLen+ "String_Node_Str"+ timeDurationE+ "String_Node_Str"+ nAve);
}
Program: 31817
Project: 31817
Buggy source:
void setCanvas(int _canvasWidth,int _canvasHeight,RectF axisBounds){
  Log.i(TAG,"String_Node_Str");
  canvasWidth=_canvasWidth;
  canvasHeight=_canvasHeight;
  if (showFreqAlongX) {
    axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
    axisTime.setNCanvasPixel(labelBeginY);
  }
 else {
    axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
    axisFreq.setNCanvasPixel(labelBeginY);
  }
  if (axisBounds != null) {
    if (showFreqAlongX) {
      axisFreq.setBounds(axisBounds.left,axisBounds.right);
      axisTime.setBounds(axisBounds.top,axisBounds.bottom);
    }
 else {
      axisTime.setBounds(axisBounds.left,axisBounds.right);
      axisFreq.setBounds(axisBounds.top,axisBounds.bottom);
    }
    if (showModeSpectrogram == 0) {
      float b1=axisTime.vLowerBound;
      float b2=axisTime.vHigherBound;
      axisTime.setBounds(b2,b1);
    }
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
  logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
}

Fixed version (ground truth):
void setCanvas(int _canvasWidth,int _canvasHeight,RectF axisBounds){
  Log.i(TAG,"String_Node_Str");
  canvasWidth=_canvasWidth;
  canvasHeight=_canvasHeight;
  if (showFreqAlongX) {
    axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
    axisTime.setNCanvasPixel(labelBeginY);
  }
 else {
    axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
    axisFreq.setNCanvasPixel(labelBeginY);
  }
  if (axisBounds != null) {
    if (showFreqAlongX) {
      axisFreq.setBounds(axisBounds.left,axisBounds.right);
      axisTime.setBounds(axisBounds.top,axisBounds.bottom);
    }
 else {
      axisTime.setBounds(axisBounds.left,axisBounds.right);
      axisFreq.setBounds(axisBounds.top,axisBounds.bottom);
    }
    if (showModeSpectrogram == 0) {
      float b1=axisTime.vLowerBound;
      float b2=axisTime.vHigherBound;
      axisTime.setBounds(b2,b1);
    }
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
synchronized (this) {
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
synchronized (this) {
    logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
}
Program: 31818
Project: 31818
Buggy source:
void draw(Canvas c){
  if (bm.length == 0 || axisFreq.nCanvasPixel == 0) {
    Log.d(TAG,"String_Node_Str");
    return;
  }
synchronized (this) {
    int[] bmTmp=bm;
    if (showModeSpectrogram == 0) {
      System.arraycopy(bm,0,bmShiftCache,(nTime - bmPt) * bmpWidth,bmPt * bmpWidth);
      System.arraycopy(bm,bmPt * bmpWidth,bmShiftCache,0,(nTime - bmPt) * bmpWidth);
      bmTmp=bmShiftCache;
    }
    for (int i=1; i < pixelAbscissa.length; i++) {
      c.save();
      float f1=(float)freqAbscissa[i - 1];
      float f2=(float)freqAbscissa[i];
      float p1=axisFreq.pixelNoZoomFromV(f1);
      float p2=axisFreq.pixelNoZoomFromV(f2);
      if (axisFreq.vLowerBound > axisFreq.vHigherBound) {
        p1=axisFreq.nCanvasPixel - p1;
        p2=axisFreq.nCanvasPixel - p2;
      }
      double widthFactor=(p2 - p1) / (pixelAbscissa[i] - pixelAbscissa[i - 1]) * (bmpWidth / axisFreq.nCanvasPixel);
      c.scale((float)widthFactor,1);
      c.drawBitmap(bmTmp,(int)pixelAbscissa[i - 1],bmpWidth,p1 / axisFreq.nCanvasPixel * bmpWidth / (float)widthFactor,0.0f,(int)(pixelAbscissa[i] - pixelAbscissa[i - 1]),nTime,false,smoothBmpPaint);
      c.restore();
    }
  }
}

Fixed version (ground truth):
void draw(Canvas c){
  if (bm.length == 0 || axisFreq.nCanvasPixel == 0) {
    Log.d(TAG,"String_Node_Str");
    return;
  }
  int i1=pixelAbscissa.length - 1;
  String st1="String_Node_Str" + (i1 - 1) + "String_Node_Str"+ pixelAbscissa[i1 - 1]+ "String_Node_Str"+ i1+ "String_Node_Str"+ pixelAbscissa[i1]+ "String_Node_Str"+ bmpWidth;
  String st2="String_Node_Str" + axisFreq.vLowerBound + "String_Node_Str"+ axisFreq.vHigherBound+ "String_Node_Str"+ axisFreq.nCanvasPixel+ "String_Node_Str"+ nTime;
  if (!st1.equals(st1old)) {
    Log.v(TAG,st1);
    Log.v(TAG,st2);
    st1old=st1;
    st2old=st2;
  }
  int[] bmTmp=bm;
  if (showModeSpectrogram == 0) {
    System.arraycopy(bm,0,bmShiftCache,(nTime - bmPt) * bmpWidth,bmPt * bmpWidth);
    System.arraycopy(bm,bmPt * bmpWidth,bmShiftCache,0,(nTime - bmPt) * bmpWidth);
    bmTmp=bmShiftCache;
  }
  for (int i=1; i < pixelAbscissa.length; i++) {
    c.save();
    float f1=(float)freqAbscissa[i - 1];
    float f2=(float)freqAbscissa[i];
    float p1=axisFreq.pixelNoZoomFromV(f1);
    float p2=axisFreq.pixelNoZoomFromV(f2);
    if (axisFreq.vLowerBound > axisFreq.vHigherBound) {
      p1=axisFreq.nCanvasPixel - p1;
      p2=axisFreq.nCanvasPixel - p2;
    }
    double widthFactor=(p2 - p1) / (pixelAbscissa[i] - pixelAbscissa[i - 1]) * (bmpWidth / axisFreq.nCanvasPixel);
    c.scale((float)widthFactor,1);
    c.drawBitmap(bmTmp,(int)pixelAbscissa[i - 1],bmpWidth,p1 / axisFreq.nCanvasPixel * bmpWidth / (float)widthFactor,0.0f,(int)(pixelAbscissa[i] - pixelAbscissa[i - 1]),nTime,false,smoothBmpPaint);
    c.restore();
  }
}
Program: 31819
Project: 31819
Buggy source:
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  axisFreq.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
  logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
}

Fixed version (ground truth):
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  axisFreq.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
synchronized (this) {
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
synchronized (this) {
    logSegBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
}
Program: 31820
Project: 31820
Buggy source:
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
  freq_lower_bound=sampleRate / fftLen;
  float freq_lower_bound_local=0;
  if (spectrumPlot.axisX.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound;
  }
  RectF axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,spectrumPlot.axisY.vHigherBound);
  Log.i(TAG,"String_Node_Str" + canvasWidth + "String_Node_Str"+ canvasHeight+ "String_Node_Str"+ spectrumPlot.axisY.vHigherBound);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  spectrogramPlot.setupSpectrogram(sampleRate,fftLen,timeDurationE,nAve);
  freq_lower_bound_local=0;
  if (spectrogramPlot.axisFreq.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound;
  }
  if (spectrogramPlot.showFreqAlongX) {
    axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve);
  }
 else {
    axisBounds=new RectF(0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve,freq_lower_bound_local);
  }
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
}

Fixed version (ground truth):
void setupPlot(int sampleRate,int fftLen,double timeDurationE,int nAve){
  freq_lower_bound_for_log=sampleRate / fftLen;
  float freq_lower_bound_local=0;
  if (spectrumPlot.axisX.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  RectF axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,spectrumPlot.axisY.vHigherBound);
  Log.i(TAG,"String_Node_Str" + canvasWidth + "String_Node_Str"+ canvasHeight+ "String_Node_Str"+ spectrumPlot.axisY.vHigherBound);
  spectrumPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
  spectrogramPlot.setupSpectrogram(sampleRate,fftLen,timeDurationE,nAve);
  freq_lower_bound_local=0;
  if (spectrogramPlot.axisFreq.mapTypeInt != ScreenPhysicalMapping.Type.LINEAR.getValue()) {
    freq_lower_bound_local=freq_lower_bound_for_log;
  }
  if (spectrogramPlot.showFreqAlongX) {
    axisBounds=new RectF(freq_lower_bound_local,0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve);
  }
 else {
    axisBounds=new RectF(0.0f,sampleRate / 2.0f,(float)timeDurationE * nAve,freq_lower_bound_local);
  }
  spectrogramPlot.setCanvas(canvasWidth,canvasHeight,axisBounds);
}
Program: 31821
Project: 31821
Buggy source:
void setAxisModeLinear(boolean b){
  ScreenPhysicalMapping.Type mapType;
  float freq_lower_bound_local;
  if (b) {
    mapType=ScreenPhysicalMapping.Type.LINEAR;
    freq_lower_bound_local=0;
  }
 else {
    mapType=ScreenPhysicalMapping.Type.LOG;
    freq_lower_bound_local=freq_lower_bound;
  }
  spectrumPlot.setFreqAxisMode(mapType,freq_lower_bound_local);
  spectrogramPlot.setFreqAxisMode(mapType,freq_lower_bound_local);
  if (showMode == 0) {
    xZoom=spectrumPlot.axisX.zoom;
    xShift=spectrumPlot.axisX.shift;
  }
 else   if (showMode == 1) {
    if (spectrogramPlot.showFreqAlongX) {
      xZoom=spectrogramPlot.axisFreq.zoom;
      xShift=spectrogramPlot.axisFreq.shift;
    }
 else {
      yZoom=spectrogramPlot.axisFreq.zoom;
      yShift=spectrogramPlot.axisFreq.shift;
    }
  }
}

Fixed version (ground truth):
void setAxisModeLinear(boolean b){
  ScreenPhysicalMapping.Type mapType;
  if (b) {
    mapType=ScreenPhysicalMapping.Type.LINEAR;
  }
 else {
    mapType=ScreenPhysicalMapping.Type.LOG;
  }
  spectrumPlot.setFreqAxisMode(mapType,freq_lower_bound_for_log);
  spectrogramPlot.setFreqAxisMode(mapType,freq_lower_bound_for_log);
  if (showMode == 0) {
    xZoom=spectrumPlot.axisX.zoom;
    xShift=spectrumPlot.axisX.shift;
  }
 else   if (showMode == 1) {
    if (spectrogramPlot.showFreqAlongX) {
      xZoom=spectrogramPlot.axisFreq.zoom;
      xShift=spectrogramPlot.axisFreq.shift;
    }
 else {
      yZoom=spectrogramPlot.axisFreq.zoom;
      yShift=spectrogramPlot.axisFreq.shift;
    }
  }
}
Program: 31822
Project: 31822
Buggy source:
void init(int _nFreq,int _nTime,ScreenPhysicalMapping _axis){
  if (bm.length != _nFreq * _nTime) {
    bm=new int[_nFreq * _nTime];
  }
  Log.i(TAG,"String_Node_Str");
  if (mapFreqToPixL.length != _nFreq) {
    Log.i(TAG,"String_Node_Str");
    mapFreqToPixL=new int[_nFreq];
    mapFreqToPixH=new int[_nFreq];
  }
  Log.i(TAG,"String_Node_Str");
  nFreq=_nFreq;
  nTime=_nTime;
  axis=_axis;
  Arrays.fill(bm,0);
  bmPt=0;
  Log.i(TAG,"String_Node_Str");
  if (axis == null) {
    Log.i(TAG,"String_Node_Str");
  }
  float dFreq=Math.max(axis.vLowerBound,axis.vHigherBound) / nFreq;
  for (int i=0; i < nFreq; i++) {
    mapFreqToPixL[i]=(int)Math.floor(axis.pixelNoZoomFromV((i + 0.5f) * dFreq) / axis.nCanvasPixel * nFreq) - 1;
    mapFreqToPixH[i]=(int)Math.floor(axis.pixelNoZoomFromV((i + 1.5f) * dFreq) / axis.nCanvasPixel * nFreq) - 1;
    if (mapFreqToPixH[i] >= nFreq)     mapFreqToPixH[i]=nFreq - 1;
    if (mapFreqToPixH[i] < 0)     mapFreqToPixH[i]=0;
    if (mapFreqToPixL[i] >= nFreq)     mapFreqToPixL[i]=nFreq - 1;
    if (mapFreqToPixL[i] < 0)     mapFreqToPixL[i]=0;
    Log.i(TAG,"String_Node_Str" + axis.pixelNoZoomFromV((i + 0.5f) * dFreq) + "String_Node_Str"+ axis.pixelNoZoomFromV((i + 1.5f) * dFreq));
  }
  Log.i(TAG,"String_Node_Str");
}

Fixed version (ground truth):
void init(int _nFreq,int _nTime,ScreenPhysicalMapping _axis){
  if (bm.length != _nFreq * _nTime) {
    bm=new int[_nFreq * _nTime];
  }
  Log.i(TAG,"String_Node_Str");
  if (mapFreqToPixL.length != _nFreq) {
    Log.i(TAG,"String_Node_Str");
    mapFreqToPixL=new int[_nFreq];
    mapFreqToPixH=new int[_nFreq];
  }
  Log.i(TAG,"String_Node_Str");
  nFreq=_nFreq;
  nTime=_nTime;
  axis=_axis;
  Arrays.fill(bm,0);
  bmPt=0;
  Log.i(TAG,"String_Node_Str");
  if (axis == null) {
    Log.i(TAG,"String_Node_Str");
  }
  float dFreq=Math.max(axis.vLowerBound,axis.vHigherBound) / nFreq;
  for (int i=0; i < nFreq; i++) {
    mapFreqToPixL[i]=(int)Math.floor(axis.pixelNoZoomFromV((i + 0.5f) * dFreq) / axis.nCanvasPixel * nFreq) - 1;
    mapFreqToPixH[i]=(int)Math.floor(axis.pixelNoZoomFromV((i + 1.5f) * dFreq) / axis.nCanvasPixel * nFreq) - 1;
    if (mapFreqToPixH[i] >= nFreq)     mapFreqToPixH[i]=nFreq - 1;
    if (mapFreqToPixH[i] < 0)     mapFreqToPixH[i]=0;
    if (mapFreqToPixL[i] >= nFreq)     mapFreqToPixL[i]=nFreq - 1;
    if (mapFreqToPixL[i] < 0)     mapFreqToPixL[i]=0;
  }
  Log.i(TAG,"String_Node_Str");
}
Program: 31823
Project: 31823
Buggy source:
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound){
  axisFreq.setMappingType(mapType,freq_lower_bound);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
}

Fixed version (ground truth):
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  axisFreq.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
    logBmp.init(nFreqPoints,nTimePoints,axisFreq);
  }
}
Program: 31825
Project: 31825
Buggy source:
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound){
  axisX.setMappingType(mapType,freq_lower_bound);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
}

Fixed version (ground truth):
void setFreqAxisMode(ScreenPhysicalMapping.Type mapType,float freq_lower_bound_for_log){
  axisX.setMappingType(mapType,freq_lower_bound_for_log);
  if (mapType == ScreenPhysicalMapping.Type.LOG) {
    fqGridLabel.setGridType(GridLabel.Type.FREQ_LOG);
  }
 else {
    fqGridLabel.setGridType(GridLabel.Type.FREQ);
  }
  Log.i(TAG,"String_Node_Str" + axisX.vLowerBound + "String_Node_Str"+ freq_lower_bound_for_log);
}
Program: 31826
Project: 31826
Buggy source:
/** 
 * Process a click on one of our selectors.
 * @param v   The view that was clicked
 * @return    true if we need to update the graph
 */
public boolean processClick(View v){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor editor=sharedPref.edit();
  String value=((TextView)v).getText().toString();
switch (v.getId()) {
case R.id.button_recording:
    bSaveWav=value.equals("String_Node_Str");
  analyzerViews.enableSaveWavView(bSaveWav);
return true;
case R.id.run:
boolean pause=value.equals("String_Node_Str");
if (samplingThread != null && samplingThread.getPause() != pause) {
samplingThread.setPause(pause);
}
return false;
case R.id.freq_scaling_mode:
isLinearFreq=value.equals("String_Node_Str");
Log.i(TAG,"String_Node_Str" + isLinearFreq);
analyzerViews.graphView.setAxisModeLinearLog(isLinearFreq);
editor.putString("String_Node_Str","String_Node_Str");
editor.commit();
return false;
case R.id.dbA:
analyzerParam.isAWeighting=!value.equals("String_Node_Str");
if (samplingThread != null) {
samplingThread.setAWeighting(analyzerParam.isAWeighting);
}
editor.putBoolean("String_Node_Str",analyzerParam.isAWeighting);
editor.commit();
return false;
case R.id.spectrum_spectrogram_mode:
if (value.equals("String_Node_Str")) {
analyzerViews.graphView.switch2Spectrum();
}
 else {
analyzerViews.graphView.switch2Spectrogram();
}
editor.putBoolean("String_Node_Str",value.equals("String_Node_Str"));
editor.commit();
return false;
default :
return true;
}
}

Fixed version (ground truth):
/** 
 * Process a click on one of our selectors.
 * @param v   The view that was clicked
 * @return    true if we need to update the graph
 */
public boolean processClick(View v){
  SharedPreferences sharedPref=PreferenceManager.getDefaultSharedPreferences(this);
  SharedPreferences.Editor editor=sharedPref.edit();
  String value=((TextView)v).getText().toString();
switch (v.getId()) {
case R.id.button_recording:
    bSaveWav=value.equals("String_Node_Str");
  analyzerViews.enableSaveWavView(bSaveWav);
return true;
case R.id.run:
boolean pause=value.equals("String_Node_Str");
if (samplingThread != null && samplingThread.getPause() != pause) {
samplingThread.setPause(pause);
}
return false;
case R.id.freq_scaling_mode:
isLinearFreq=value.equals("String_Node_Str");
Log.i(TAG,"String_Node_Str" + isLinearFreq);
analyzerViews.graphView.setAxisModeLinear(isLinearFreq);
editor.putString("String_Node_Str","String_Node_Str");
editor.commit();
return false;
case R.id.dbA:
analyzerParam.isAWeighting=!value.equals("String_Node_Str");
if (samplingThread != null) {
samplingThread.setAWeighting(analyzerParam.isAWeighting);
}
editor.putBoolean("String_Node_Str",analyzerParam.isAWeighting);
editor.commit();
return false;
case R.id.spectrum_spectrogram_mode:
if (value.equals("String_Node_Str")) {
analyzerViews.graphView.switch2Spectrum();
}
 else {
analyzerViews.graphView.switch2Spectrogram();
}
editor.putBoolean("String_Node_Str",value.equals("String_Node_Str"));
editor.commit();
return false;
default :
return true;
}
}
Program: 31827
Project: 31827
Buggy source:
public PopupWindow popupMenuCreate(String[] popUpContents,int resId){
  PopupWindow popupWindow=new PopupWindow(this);
  ListView listView=new ListView(this);
  ArrayAdapter<String> aa=popupMenuAdapter(popUpContents);
  listView.setAdapter(aa);
  listView.setOnItemClickListener(this);
  listView.setTag(resId);
  Paint mTestPaint=new Paint();
  mTestPaint.setTextSize(listItemTextSize);
  float w=0;
  float wi;
  for (int i=0; i < popUpContents.length; i++) {
    String sts[]=popUpContents[i].split("String_Node_Str");
    String st=sts[0];
    if (sts.length == 2 && sts[1].equals("String_Node_Str")) {
      mTestPaint.setTextSize(listItemTitleTextSize);
      wi=mTestPaint.measureText(st);
      mTestPaint.setTextSize(listItemTextSize);
    }
 else {
      wi=mTestPaint.measureText(st);
    }
    if (w < wi) {
      w=wi;
    }
  }
  w=w + 20 * DPRatio;
  if (w < 60) {
    w=60;
  }
  popupWindow.setFocusable(true);
  popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
  popupWindow.setWidth((int)w);
  ((Button)findViewById(resId)).setWidth((int)(w + 2 * DPRatio));
  popupWindow.setContentView(listView);
  return popupWindow;
}

Fixed version (ground truth):
public PopupWindow popupMenuCreate(String[] popUpContents,int resId){
  PopupWindow popupWindow=new PopupWindow(this);
  ListView listView=new ListView(this);
  ArrayAdapter<String> aa=popupMenuAdapter(popUpContents);
  listView.setAdapter(aa);
  listView.setOnItemClickListener(this);
  listView.setTag(resId);
  Paint mTestPaint=new Paint();
  mTestPaint.setTextSize(listItemTextSize);
  float w=0;
  float wi;
  for (int i=0; i < popUpContents.length; i++) {
    String sts[]=popUpContents[i].split("String_Node_Str");
    String st=sts[0];
    if (sts.length == 2 && sts[1].equals("String_Node_Str")) {
      mTestPaint.setTextSize(listItemTitleTextSize);
      wi=mTestPaint.measureText(st);
      mTestPaint.setTextSize(listItemTextSize);
    }
 else {
      wi=mTestPaint.measureText(st);
    }
    if (w < wi) {
      w=wi;
    }
  }
  w=w + 20 * DPRatio;
  if (w < 60) {
    w=60;
  }
  popupWindow.setFocusable(true);
  popupWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
  popupWindow.setWidth((int)w);
  ((Button)findViewById(resId)).setWidth((int)(w + 4 * DPRatio));
  popupWindow.setContentView(listView);
  return popupWindow;
}
Program: 31828
Project: 31828
Buggy source:
@SuppressWarnings("String_Node_Str") private void setTextViewFontSize(){
  TextView tv=(TextView)findViewById(R.id.textview_cur);
  Paint mTestPaint=new Paint();
  mTestPaint.setTextSize(tv.getTextSize());
  mTestPaint.setTypeface(Typeface.MONOSPACE);
  final String text="String_Node_Str";
  Display display=getWindowManager().getDefaultDisplay();
  float px=display.getWidth() - getResources().getDimension(R.dimen.textview_RMS_layout_width) - 5;
  float fs=tv.getTextSize();
  while (mTestPaint.measureText(text) > px && fs > 5) {
    fs-=0.5;
    mTestPaint.setTextSize(fs);
  }
  ((TextView)findViewById(R.id.textview_cur)).setTextSize(fs / DPRatio);
  ((TextView)findViewById(R.id.textview_peak)).setTextSize(fs / DPRatio);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void setTextViewFontSize(){
  TextView tv=(TextView)findViewById(R.id.textview_cur);
  Paint mTestPaint=new Paint();
  mTestPaint.setTextSize(tv.getTextSize());
  mTestPaint.setTypeface(Typeface.MONOSPACE);
  final String text=getString(R.string.textview_peak_text);
  Display display=getWindowManager().getDefaultDisplay();
  float px=display.getWidth() - getResources().getDimension(R.dimen.textview_RMS_layout_width) - 5;
  float fs=tv.getTextSize();
  while (mTestPaint.measureText(text) > px && fs > 5) {
    fs-=0.5;
    mTestPaint.setTextSize(fs);
  }
  ((TextView)findViewById(R.id.textview_cur)).setTextSize(fs / DPRatio);
  ((TextView)findViewById(R.id.textview_peak)).setTextSize(fs / DPRatio);
}
Program: 31829
Project: 31829
Buggy source:
/** 
 * The graph view size has been determined - update the labels accordingly.
 */
@Override public void ready(){
}

Fixed version (ground truth):
/** 
 * The graph view size has been determined - update the labels accordingly.
 */
@Override public void ready(){
  if (spectrumDBcopy != null && graphView != null) {
    graphView.replotRawSpectrum(spectrumDBcopy,1,spectrumDBcopy.length,showLines);
  }
}
Program: 31830
Project: 31830
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  isBusy=true;
  this.canvasHeight=h;
  this.canvasWidth=w;
  Log.i(TAG,"String_Node_Str" + oldw + "String_Node_Str"+ oldh+ "String_Node_Str"+ w+ "String_Node_Str"+ h+ "String_Node_Str");
  if (oldh == 0 && h > 0 && readyCallback != null) {
    readyCallback.ready();
  }
  isBusy=false;
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  isBusy=true;
  this.canvasHeight=h;
  this.canvasWidth=w;
  Log.i(TAG,"String_Node_Str" + oldw + "String_Node_Str"+ oldh+ "String_Node_Str"+ w+ "String_Node_Str"+ h+ "String_Node_Str");
  if (h > 0 && readyCallback != null) {
    readyCallback.ready();
  }
  isBusy=false;
}
Program: 31831
Project: 31831
Buggy source:
/** 
 * The graph view size has been determined - update the labels accordingly.
 */
@Override public void ready(){
  if (spectrumDBcopy != null && graphView != null) {
    graphView.replotRawSpectrum(spectrumDBcopy,1,spectrumDBcopy.length,showLines);
  }
}

Fixed version (ground truth):
/** 
 * The graph view size has been determined - update the labels accordingly.
 */
@Override public void ready(){
  Log.v(TAG,"String_Node_Str");
}
Program: 31832
Project: 31832
Buggy source:
public void setYShift(float offset){
  yShift=clampYShift(offset);
  computeMatrix();
}

Fixed version (ground truth):
public void setYShift(float offset){
  yShift=clampYShift(offset);
}
Program: 31833
Project: 31833
Buggy source:
public void setShiftScale(float x1,float y1,float x2,float y2){
  if (canvasWidth * 0.13f < xDiffOld) {
    xZoom=clamp(xZoomOld * Math.abs(x1 - x2) / xDiffOld,1f,axisBounds.width() / 200f);
  }
  xShift=clampXShift(xShiftOld + (xMidOld / xZoomOld - (x1 + x2) / 2f / xZoom) / canvasWidth);
  if (canvasHeight * 0.13f < yDiffOld) {
    yZoom=clamp(yZoomOld * Math.abs(y1 - y2) / yDiffOld,1f,-axisBounds.height() / 6f);
  }
  yShift=clampYShift(yShiftOld + (yMidOld / yZoomOld - (y1 + y2) / 2f / yZoom) / canvasHeight);
  computeMatrix();
}

Fixed version (ground truth):
public void setShiftScale(float x1,float y1,float x2,float y2){
  if (canvasWidth * 0.13f < xDiffOld) {
    xZoom=clamp(xZoomOld * Math.abs(x1 - x2) / xDiffOld,1f,axisBounds.width() / 200f);
  }
  xShift=clampXShift(xShiftOld + (xMidOld / xZoomOld - (x1 + x2) / 2f / xZoom) / canvasWidth);
  if (canvasHeight * 0.13f < yDiffOld) {
    yZoom=clamp(yZoomOld * Math.abs(y1 - y2) / yDiffOld,1f,-axisBounds.height() / 6f);
  }
  yShift=clampYShift(yShiftOld + (yMidOld / yZoomOld - (y1 + y2) / 2f / yZoom) / canvasHeight);
}
Program: 31834
Project: 31834
Buggy source:
public void setScale(float s){
  xZoom=Math.max(s,1f);
  xShift=clamp(xShift,0f,1 - 1 / xZoom);
  computeMatrix();
}

Fixed version (ground truth):
public void setScale(float s){
  xZoom=Math.max(s,1f);
  xShift=clamp(xShift,0f,1 - 1 / xZoom);
}
Program: 31835
Project: 31835
Buggy source:
public void switch2Spectrum(){
  if (showFreqAlongX) {
  }
 else {
    if (spectrogramColors != null && canvasHeight > 0) {
      xShift=1 - yShift - 1 / yZoom;
      xZoom=yZoom;
    }
  }
  yShift=oldYShift;
  yZoom=oldYZoom;
  showMode=0;
  computeMatrix();
}

Fixed version (ground truth):
public void switch2Spectrum(){
  Log.v(TAG,"String_Node_Str");
  if (showMode == 0) {
    return;
  }
  showMode=0;
  if (showFreqAlongX) {
  }
 else {
    xShift=1 - yShift - 1 / yZoom;
    xZoom=yZoom;
  }
  yShift=oldYShift;
  yZoom=oldYZoom;
}
Program: 31836
Project: 31836
Buggy source:
public void setXShift(float offset){
  xShift=clampXShift(offset);
  computeMatrix();
}

Fixed version (ground truth):
public void setXShift(float offset){
  xShift=clampXShift(offset);
}
Program: 31837
Project: 31837
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  if (state instanceof State) {
    State s=(State)state;
    super.onRestoreInstanceState(s.getSuperState());
    this.cursorFreq=s.cx;
    this.cursorDB=s.cy;
    this.xZoom=s.xZ;
    this.yZoom=s.yZ;
    this.xShift=s.xS;
    this.yShift=s.yS;
    this.axisBounds=s.bounds;
    computeMatrix();
    invalidate();
  }
 else {
    super.onRestoreInstanceState(state);
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  if (state instanceof State) {
    State s=(State)state;
    super.onRestoreInstanceState(s.getSuperState());
    this.cursorFreq=s.cx;
    this.cursorDB=s.cy;
    this.xZoom=s.xZ;
    this.yZoom=s.yZ;
    this.xShift=s.xS;
    this.yShift=s.yS;
    this.axisBounds=s.bounds;
    Log.i("String_Node_Str","String_Node_Str" + xShift + "String_Node_Str"+ xZoom+ "String_Node_Str"+ yShift+ "String_Node_Str"+ yZoom);
  }
 else {
    super.onRestoreInstanceState(state);
  }
}
Program: 31838
Project: 31838
Buggy source:
public void resetViewScale(){
  xShift=0;
  xZoom=1;
  yShift=0;
  yZoom=1;
  computeMatrix();
}

Fixed version (ground truth):
public void resetViewScale(){
  xShift=0;
  xZoom=1;
  yShift=0;
  yZoom=1;
}
Program: 31840
Project: 31840
Buggy source:
@Override protected Parcelable onSaveInstanceState(){
  Parcelable parentState=super.onSaveInstanceState();
  State state=new State(parentState);
  state.cx=cursorFreq;
  state.cy=cursorDB;
  state.xZ=xZoom;
  state.xS=xShift;
  state.bounds=axisBounds;
  return state;
}

Fixed version (ground truth):
@Override protected Parcelable onSaveInstanceState(){
  Parcelable parentState=super.onSaveInstanceState();
  State state=new State(parentState);
  state.cx=cursorFreq;
  state.cy=cursorDB;
  state.xZ=xZoom;
  state.yZ=yZoom;
  state.xS=xShift;
  state.yS=yShift;
  state.bounds=axisBounds;
  Log.i("String_Node_Str","String_Node_Str" + xShift + "String_Node_Str"+ xZoom+ "String_Node_Str"+ yShift+ "String_Node_Str"+ yZoom);
  return state;
}
Program: 31841
Project: 31841
Buggy source:
float axisY4canvasView(float y){
  return axisBounds.height() * (yShift + y / yZoom) / canvasHeight;
}

Fixed version (ground truth):
float axisY4canvasView(float y){
  return axisBounds.height() * (yShift + y / yZoom) / canvasHeight + axisBounds.top;
}
Program: 31842
Project: 31842
Buggy source:
private State(Parcel in){
  super(in);
  cx=in.readFloat();
  cy=in.readFloat();
  scale=in.readFloat();
  xlate=in.readFloat();
  bounds=RectF.CREATOR.createFromParcel(in);
}

Fixed version (ground truth):
private State(Parcel in){
  super(in);
  cx=in.readFloat();
  cy=in.readFloat();
  xZ=in.readFloat();
  yZ=in.readFloat();
  xS=in.readFloat();
  yS=in.readFloat();
  bounds=RectF.CREATOR.createFromParcel(in);
}
Program: 31843
Project: 31843
Buggy source:
public boolean setCursor(float x,float y){
  if (intersects(x,y)) {
    x=x - myLocation[0];
    y=y - myLocation[1];
    if (showMode == 0) {
      cursorFreq=axisX4canvasView(x);
      cursorDB=axisX4canvasView(y);
    }
 else {
      cursorDB=0;
      if (showFreqAlongX) {
        cursorFreq=axisBounds.width() * (xShift + (x - labelBeginX) / (canvasWidth - labelBeginX) * canvasWidth / xZoom) / canvasWidth;
      }
 else {
        cursorFreq=axisBounds.width() * (canvasHeight - yShift - y / labelBeginY * canvasHeight / yZoom) / canvasHeight;
      }
      if (cursorFreq < 0) {
        cursorFreq=0;
      }
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean setCursor(float x,float y){
  if (intersects(x,y)) {
    x=x - myLocation[0];
    y=y - myLocation[1];
    if (showMode == 0) {
      cursorFreq=axisX4canvasView(x);
      cursorDB=axisY4canvasView(y);
    }
 else {
      cursorDB=0;
      if (showFreqAlongX) {
        cursorFreq=axisBounds.width() * (xShift + (x - labelBeginX) / (canvasWidth - labelBeginX) * canvasWidth / xZoom) / canvasWidth;
      }
 else {
        cursorFreq=axisBounds.width() * (canvasHeight - yShift - y / labelBeginY * canvasHeight / yZoom) / canvasHeight;
      }
      if (cursorFreq < 0) {
        cursorFreq=0;
      }
    }
    return true;
  }
 else {
    return false;
  }
}
Program: 31844
Project: 31844
Buggy source:
@Override public void writeToParcel(Parcel out,int flags){
  super.writeToParcel(out,flags);
  out.writeFloat(cx);
  out.writeFloat(cy);
  out.writeFloat(scale);
  out.writeFloat(xlate);
  bounds.writeToParcel(out,flags);
}

Fixed version (ground truth):
@Override public void writeToParcel(Parcel out,int flags){
  super.writeToParcel(out,flags);
  out.writeFloat(cx);
  out.writeFloat(cy);
  out.writeFloat(xZ);
  out.writeFloat(yZ);
  out.writeFloat(xS);
  out.writeFloat(yS);
  bounds.writeToParcel(out,flags);
}
Program: 31845
Project: 31845
Buggy source:
@Override public void onRestoreInstanceState(Parcelable state){
  if (state instanceof State) {
    State s=(State)state;
    super.onRestoreInstanceState(s.getSuperState());
    this.cursorFreq=s.cx;
    this.cursorDB=s.cy;
    this.xZoom=s.scale;
    this.xShift=s.xlate;
    this.axisBounds=s.bounds;
    computeMatrix();
    invalidate();
  }
 else {
    super.onRestoreInstanceState(state);
  }
}

Fixed version (ground truth):
@Override public void onRestoreInstanceState(Parcelable state){
  if (state instanceof State) {
    State s=(State)state;
    super.onRestoreInstanceState(s.getSuperState());
    this.cursorFreq=s.cx;
    this.cursorDB=s.cy;
    this.xZoom=s.xZ;
    this.yZoom=s.yZ;
    this.xShift=s.xS;
    this.yShift=s.yS;
    this.axisBounds=s.bounds;
    computeMatrix();
    invalidate();
  }
 else {
    super.onRestoreInstanceState(state);
  }
}
Program: 31846
Project: 31846
Buggy source:
private void drawCursor(Canvas c){
  float cX, cY;
  if (showMode == 0) {
    cX=canvasViewX4axis(cursorFreq);
    cY=canvasViewY4axis(cursorDB);
    if (cursorFreq != 0) {
      c.drawLine(cX,0,cX,canvasHeight,cursorPaint);
    }
    if (cursorDB != 0) {
      c.drawLine(0,cY,canvasWidth,cY,cursorPaint);
    }
  }
 else {
    if (showFreqAlongX) {
      cX=(cursorFreq / axisBounds.width() * canvasWidth - xShift) * xZoom / canvasWidth * (canvasWidth - labelBeginX) + labelBeginX;
      if (cursorFreq != 0) {
        c.drawLine(cX,0,cX,labelBeginY,cursorPaint);
      }
    }
 else {
      cY=(canvasHeight - yShift - cursorFreq / axisBounds.width() * canvasHeight) * yZoom / canvasHeight * labelBeginY;
      Log.i(TAG,"String_Node_Str" + cY + "String_Node_Str"+ labelBeginX+ "String_Node_Str"+ canvasWidth);
      if (cursorFreq != 0) {
        c.drawLine(labelBeginX,cY,canvasWidth,cY,cursorPaint);
      }
    }
  }
}

Fixed version (ground truth):
private void drawCursor(Canvas c){
  float cX, cY;
  if (showMode == 0) {
    cX=canvasViewX4axis(cursorFreq);
    cY=canvasViewY4axis(cursorDB);
    if (cursorFreq != 0) {
      c.drawLine(cX,0,cX,canvasHeight,cursorPaint);
    }
    if (cursorDB != 0) {
      c.drawLine(0,cY,canvasWidth,cY,cursorPaint);
    }
  }
 else {
    if (showFreqAlongX) {
      cX=(cursorFreq / axisBounds.width() * canvasWidth - xShift) * xZoom / canvasWidth * (canvasWidth - labelBeginX) + labelBeginX;
      if (cursorFreq != 0) {
        c.drawLine(cX,0,cX,labelBeginY,cursorPaint);
      }
    }
 else {
      cY=(canvasHeight - yShift - cursorFreq / axisBounds.width() * canvasHeight) * yZoom / canvasHeight * labelBeginY;
      if (cursorFreq != 0) {
        c.drawLine(labelBeginX,cY,canvasWidth,cY,cursorPaint);
      }
    }
  }
}
Program: 31848
Project: 31848
Buggy source:
@Override protected Parcelable onSaveInstanceState(){
  Parcelable parentState=super.onSaveInstanceState();
  State state=new State(parentState);
  state.cx=cursorFreq;
  state.cy=cursorDB;
  state.scale=xZoom;
  state.xlate=xShift;
  state.bounds=axisBounds;
  return state;
}

Fixed version (ground truth):
@Override protected Parcelable onSaveInstanceState(){
  Parcelable parentState=super.onSaveInstanceState();
  State state=new State(parentState);
  state.cx=cursorFreq;
  state.cy=cursorDB;
  state.xZ=xZoom;
  state.xS=xShift;
  state.bounds=axisBounds;
  return state;
}
Program: 31849
Project: 31849
Buggy source:
@Override public void onClick(View v){
  if (processClick(v)) {
    reRecur();
    updateAllLabels();
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  if (processClick(v)) {
    reRecur();
  }
  invalidateGraphView();
}
Program: 31850
Project: 31850
Buggy source:
@Override public void run(){
  AnalyzeActivity.this.rePlot();
}

Fixed version (ground truth):
@Override public void run(){
  if (graphView.getShowMode() == 0) {
    graphView.replotRawSpectrum(spectrumDBcopy,1,spectrumDBcopy.length,showLines);
  }
  AnalyzeActivity.this.invalidateGraphView();
}