nus-yam/ex-repair huggingface dataset:
Program: 18403
Project: 18403
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}

Fixed version (ground truth):
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  Entry e=null;
  if (high == null)   mIndicesToHightlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    e=mData.getEntryForHighlight(high);
    if (e == null || e.getXIndex() != high.getXIndex()) {
      mIndicesToHightlight=null;
      high=null;
    }
 else {
      mIndicesToHightlight=new Highlight[]{high};
    }
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}
Program: 18404
Project: 18404
Buggy source:
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(Canvas canvas){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mAnimator.getPhaseX()) {
      Entry e=mData.getEntryForHighlight(mIndicesToHightlight[i]);
      if (e == null)       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (!mViewPortHandler.isInBounds(pos[0],pos[1]))       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      if (pos[1] - mMarkerView.getHeight() <= 0) {
        float y=mMarkerView.getHeight() - pos[1];
        mMarkerView.draw(canvas,pos[0],pos[1] + y);
      }
 else {
        mMarkerView.draw(canvas,pos[0],pos[1]);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(Canvas canvas){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mAnimator.getPhaseX()) {
      Entry e=mData.getEntryForHighlight(mIndicesToHightlight[i]);
      if (e == null || e.getXIndex() != mIndicesToHightlight[i].getXIndex())       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (!mViewPortHandler.isInBounds(pos[0],pos[1]))       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      if (pos[1] - mMarkerView.getHeight() <= 0) {
        float y=mMarkerView.getHeight() - pos[1];
        mMarkerView.draw(canvas,pos[0],pos[1] + y);
      }
 else {
        mMarkerView.draw(canvas,pos[0],pos[1]);
      }
    }
  }
}
Program: 18405
Project: 18405
Buggy source:
/** 
 * Returns the value of the Entry object at the given xIndex. Returns Float.NaN if no value is at the given x-index. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.
 * @param xIndex
 * @return
 */
public float getYValForXIndex(int xIndex){
  Entry e=getEntryForXIndex(xIndex);
  if (e != null)   return e.getVal();
 else   return Float.NaN;
}

Fixed version (ground truth):
/** 
 * Returns the value of the Entry object at the given xIndex. Returns Float.NaN if no value is at the given x-index. INFORMATION: This method does calculations at runtime. Do not over-use in performance critical situations.
 * @param xIndex
 * @return
 */
public float getYValForXIndex(int xIndex){
  Entry e=getEntryForXIndex(xIndex);
  if (e != null && e.getXIndex() == xIndex)   return e.getVal();
 else   return Float.NaN;
}
Program: 18408
Project: 18408
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    int xIndex=indices[i].getXIndex();
    CandleDataSet set=mChart.getCandleData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    CandleEntry e=set.getEntryForXIndex(xIndex);
    if (e == null)     continue;
    float low=e.getLow() * mAnimator.getPhaseY();
    float high=e.getHigh() * mAnimator.getPhaseY();
    float min=mChart.getYChartMin();
    float max=mChart.getYChartMax();
    float[] vertPts=new float[]{xIndex - 0.5f,max,xIndex - 0.5f,min,xIndex + 0.5f,max,xIndex + 0.5f,min};
    float[] horPts=new float[]{mChart.getXChartMin(),low,mChart.getXChartMax(),low,mChart.getXChartMin(),high,mChart.getXChartMax(),high};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(vertPts);
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(horPts);
    c.drawLines(vertPts,mHighlightPaint);
    c.drawLines(horPts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    int xIndex=indices[i].getXIndex();
    CandleDataSet set=mChart.getCandleData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    CandleEntry e=set.getEntryForXIndex(xIndex);
    if (e == null || e.getXIndex() != xIndex)     continue;
    float low=e.getLow() * mAnimator.getPhaseY();
    float high=e.getHigh() * mAnimator.getPhaseY();
    float min=mChart.getYChartMin();
    float max=mChart.getYChartMax();
    float[] vertPts=new float[]{xIndex - 0.5f,max,xIndex - 0.5f,min,xIndex + 0.5f,max,xIndex + 0.5f,min};
    float[] horPts=new float[]{mChart.getXChartMin(),low,mChart.getXChartMax(),low,mChart.getXChartMin(),high,mChart.getXChartMax(),high};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(vertPts);
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(horPts);
    c.drawLines(vertPts,mHighlightPaint);
    c.drawLines(horPts,mHighlightPaint);
  }
}
Program: 18409
Project: 18409
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    LineDataSet set=mChart.getLineData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX())     continue;
    float y=set.getYValForXIndex(xIndex) * mAnimator.getPhaseY();
    float[] pts=new float[]{xIndex,mChart.getYChartMax(),xIndex,mChart.getYChartMin(),mChart.getXChartMin(),y,mChart.getXChartMax(),y};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);
    c.drawLines(pts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    LineDataSet set=mChart.getLineData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX())     continue;
    float yValue=set.getYValForXIndex(xIndex);
    if (yValue == Float.NaN)     continue;
    float y=yValue * mAnimator.getPhaseY();
    float[] pts=new float[]{xIndex,mChart.getYChartMax(),xIndex,mChart.getYChartMin(),mChart.getXChartMin(),y,mChart.getXChartMax(),y};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);
    c.drawLines(pts,mHighlightPaint);
  }
}
Program: 18410
Project: 18410
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < indices.length; i++) {
    RadarDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    Entry e=set.getEntryForXIndex(xIndex);
    int j=set.getEntryPosition(e);
    float y=(e.getVal() - mChart.getYChartMin());
    PointF p=Utils.getPosition(center,y * factor,sliceangle * j + mChart.getRotationAngle());
    float[] pts=new float[]{p.x,0,p.x,mViewPortHandler.getChartHeight(),0,p.y,mViewPortHandler.getChartWidth(),p.y};
    c.drawLines(pts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  float sliceangle=mChart.getSliceAngle();
  float factor=mChart.getFactor();
  PointF center=mChart.getCenterOffsets();
  for (int i=0; i < indices.length; i++) {
    RadarDataSet set=mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    Entry e=set.getEntryForXIndex(xIndex);
    if (e == null || e.getXIndex() != xIndex)     continue;
    int j=set.getEntryPosition(e);
    float y=(e.getVal() - mChart.getYChartMin());
    PointF p=Utils.getPosition(center,y * factor,sliceangle * j + mChart.getRotationAngle());
    float[] pts=new float[]{p.x,0,p.x,mViewPortHandler.getChartHeight(),0,p.y,mViewPortHandler.getChartWidth(),p.y};
    c.drawLines(pts,mHighlightPaint);
  }
}
Program: 18411
Project: 18411
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    ScatterDataSet set=mChart.getScatterData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX())     continue;
    float y=set.getYValForXIndex(xIndex) * mAnimator.getPhaseY();
    float[] pts=new float[]{xIndex,mChart.getYChartMax(),xIndex,mChart.getYChartMin(),0,y,mChart.getXChartMax(),y};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);
    c.drawLines(pts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    ScatterDataSet set=mChart.getScatterData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX())     continue;
    float yValue=set.getYValForXIndex(xIndex);
    if (yValue == Float.NaN)     continue;
    float y=yValue * mAnimator.getPhaseY();
    float[] pts=new float[]{xIndex,mChart.getYChartMax(),xIndex,mChart.getYChartMin(),0,y,mChart.getXChartMax(),y};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);
    c.drawLines(pts,mHighlightPaint);
  }
}
Program: 18412
Project: 18412
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_barchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawGridBackground(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE);
  l.setTypeface(tf);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setValueFormatter(new LargeValueFormatter());
  leftAxis.setDrawGridLines(false);
  leftAxis.setSpaceTop(25f);
  mChart.getAxisRight().setEnabled(false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_barchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawGridBackground(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE);
  l.setTypeface(tf);
  l.setYOffset(0f);
  l.setYEntrySpace(0f);
  l.setTextSize(8f);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setValueFormatter(new LargeValueFormatter());
  leftAxis.setDrawGridLines(false);
  leftAxis.setSpaceTop(30f);
  mChart.getAxisRight().setEnabled(false);
}
Program: 18413
Project: 18413
Buggy source:
@Override public boolean onDoubleTap(MotionEvent e){
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  if (l != null) {
    l.onChartDoubleTapped(e);
    return super.onDoubleTap(e);
  }
  if (mChart.isDoubleTapToZoomEnabled()) {
    PointF trans=getTrans(e.getX(),e.getY());
    mChart.zoom(1.4f,1.4f,trans.x,trans.y);
    if (mChart.isLogEnabled())     Log.i("String_Node_Str","String_Node_Str" + trans.x + "String_Node_Str"+ trans.y);
  }
  return super.onDoubleTap(e);
}

Fixed version (ground truth):
@Override public boolean onDoubleTap(MotionEvent e){
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  if (l != null) {
    l.onChartDoubleTapped(e);
    return super.onDoubleTap(e);
  }
  if (mChart.isDoubleTapToZoomEnabled()) {
    PointF trans=getTrans(e.getX(),e.getY());
    mChart.zoom(mChart.isScaleXEnabled() ? 1.4f : 1f,mChart.isScaleYEnabled() ? 1.4f : 1f,trans.x,trans.y);
    if (mChart.isLogEnabled())     Log.i("String_Node_Str","String_Node_Str" + trans.x + "String_Node_Str"+ trans.y);
  }
  return super.onDoubleTap(e);
}
Program: 18416
Project: 18416
Buggy source:
@Override protected float getRequiredBaseOffset(){
  return mXAxis.mLabelWidth;
}

Fixed version (ground truth):
@Override protected float getRequiredBaseOffset(){
  return mXAxis.isEnabled() ? mXAxis.mLabelWidth : Utils.convertDpToPixel(10f);
}
Program: 18419
Project: 18419
Buggy source:
/** 
 * Calculates the total number of y-values across all DataSets the ChartData represents.
 * @return
 */
protected void calcYValueCount(List<? extends DataSet<?>> dataSets){
  mYValCount=0;
  if (dataSets == null)   return;
  int count=0;
  for (int i=0; i < dataSets.size(); i++) {
    count+=dataSets.get(i).getEntryCount();
  }
  mYValCount=count;
}

Fixed version (ground truth):
/** 
 * Calculates the total number of y-values across all DataSets the ChartData represents.
 * @return
 */
protected void calcYValueCount(){
  mYValCount=0;
  if (mDataSets == null)   return;
  int count=0;
  for (int i=0; i < mDataSets.size(); i++) {
    count+=mDataSets.get(i).getEntryCount();
  }
  mYValCount=count;
}
Program: 18420
Project: 18420
Buggy source:
/** 
 * Call this method to let the CartData know that the underlying data has changed.
 */
public void notifyDataChanged(){
  init(mDataSets);
}

Fixed version (ground truth):
/** 
 * Call this method to let the CartData know that the underlying data has changed.
 */
public void notifyDataChanged(){
  init();
}
Program: 18421
Project: 18421
Buggy source:
/** 
 * calc minimum and maximum y value over all datasets
 */
protected void calcMinMax(List<? extends DataSet<?>> dataSets){
  if (dataSets == null || dataSets.size() < 1) {
    mYMax=0f;
    mYMin=0f;
  }
 else {
    mYMin=dataSets.get(0).getYMin();
    mYMax=dataSets.get(0).getYMax();
    for (int i=0; i < dataSets.size(); i++) {
      if (dataSets.get(i).getYMin() < mYMin)       mYMin=dataSets.get(i).getYMin();
      if (dataSets.get(i).getYMax() > mYMax)       mYMax=dataSets.get(i).getYMax();
    }
    T firstLeft=getFirstLeft();
    if (firstLeft != null) {
      mLeftAxisMax=firstLeft.getYMax();
      mLeftAxisMin=firstLeft.getYMin();
      for (      DataSet<?> dataSet : dataSets) {
        if (dataSet.getAxisDependency() == AxisDependency.LEFT) {
          if (dataSet.getYMin() < mLeftAxisMin)           mLeftAxisMin=dataSet.getYMin();
          if (dataSet.getYMax() > mLeftAxisMax)           mLeftAxisMax=dataSet.getYMax();
        }
      }
    }
    T firstRight=getFirstRight();
    if (firstRight != null) {
      mRightAxisMax=firstRight.getYMax();
      mRightAxisMin=firstRight.getYMin();
      for (      DataSet<?> dataSet : dataSets) {
        if (dataSet.getAxisDependency() == AxisDependency.RIGHT) {
          if (dataSet.getYMin() < mRightAxisMin)           mRightAxisMin=dataSet.getYMin();
          if (dataSet.getYMax() > mRightAxisMax)           mRightAxisMax=dataSet.getYMax();
        }
      }
    }
    handleEmptyAxis(firstLeft,firstRight);
  }
}

Fixed version (ground truth):
/** 
 * calc minimum and maximum y value over all datasets
 */
protected void calcMinMax(){
  if (mDataSets == null || mDataSets.size() < 1) {
    mYMax=0f;
    mYMin=0f;
  }
 else {
    mYMin=mDataSets.get(0).getYMin();
    mYMax=mDataSets.get(0).getYMax();
    for (int i=0; i < mDataSets.size(); i++) {
      if (mDataSets.get(i).getYMin() < mYMin)       mYMin=mDataSets.get(i).getYMin();
      if (mDataSets.get(i).getYMax() > mYMax)       mYMax=mDataSets.get(i).getYMax();
    }
    T firstLeft=getFirstLeft();
    if (firstLeft != null) {
      mLeftAxisMax=firstLeft.getYMax();
      mLeftAxisMin=firstLeft.getYMin();
      for (      DataSet<?> dataSet : mDataSets) {
        if (dataSet.getAxisDependency() == AxisDependency.LEFT) {
          if (dataSet.getYMin() < mLeftAxisMin)           mLeftAxisMin=dataSet.getYMin();
          if (dataSet.getYMax() > mLeftAxisMax)           mLeftAxisMax=dataSet.getYMax();
        }
      }
    }
    T firstRight=getFirstRight();
    if (firstRight != null) {
      mRightAxisMax=firstRight.getYMax();
      mRightAxisMin=firstRight.getYMin();
      for (      DataSet<?> dataSet : mDataSets) {
        if (dataSet.getAxisDependency() == AxisDependency.RIGHT) {
          if (dataSet.getYMin() < mRightAxisMin)           mRightAxisMin=dataSet.getYMin();
          if (dataSet.getYMax() > mRightAxisMax)           mRightAxisMax=dataSet.getYMax();
        }
      }
    }
    handleEmptyAxis(firstLeft,firstRight);
  }
}
Program: 18422
Project: 18422
Buggy source:
/** 
 * performs all kinds of initialization calculations, such as min-max and value count and sum
 */
protected void init(List<? extends DataSet<?>> dataSets){
  isLegal(dataSets);
  calcMinMax(dataSets);
  calcYValueSum(dataSets);
  calcYValueCount(dataSets);
  calcXValAverageLength();
}

Fixed version (ground truth):
/** 
 * performs all kinds of initialization calculations, such as min-max and value count and sum
 */
protected void init(){
  isLegal();
  calcMinMax();
  calcYValueSum();
  calcYValueCount();
  calcXValAverageLength();
}
Program: 18423
Project: 18423
Buggy source:
/** 
 * constructor that takes string array instead of List string
 * @param xVals The values describing the x-axis. Must be at least as longas the highest xIndex in the Entry objects across all DataSets.
 * @param sets the dataset array
 */
public ChartData(String[] xVals,List<T> sets){
  this.mXVals=arrayToList(xVals);
  this.mDataSets=sets;
  init(mDataSets);
}

Fixed version (ground truth):
/** 
 * constructor that takes string array instead of List string
 * @param xVals The values describing the x-axis. Must be at least as longas the highest xIndex in the Entry objects across all DataSets.
 * @param sets the dataset array
 */
public ChartData(String[] xVals,List<T> sets){
  this.mXVals=arrayToList(xVals);
  this.mDataSets=sets;
  init();
}
Program: 18424
Project: 18424
Buggy source:
/** 
 * Checks if the combination of x-values array and DataSet array is legal or not.
 * @param dataSets
 */
private void isLegal(List<? extends DataSet<?>> dataSets){
  if (dataSets == null)   return;
  for (int i=0; i < dataSets.size(); i++) {
    if (dataSets.get(i).getYVals().size() > mXVals.size()) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks if the combination of x-values array and DataSet array is legal or not.
 */
private void isLegal(){
  if (mDataSets == null)   return;
  for (int i=0; i < mDataSets.size(); i++) {
    if (mDataSets.get(i).getYVals().size() > mXVals.size()) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
}
Program: 18425
Project: 18425
Buggy source:
/** 
 * calculates the sum of all y-values in all datasets
 */
protected void calcYValueSum(List<? extends DataSet<?>> dataSets){
  mYValueSum=0;
  if (dataSets == null)   return;
  for (int i=0; i < dataSets.size(); i++) {
    mYValueSum+=Math.abs(dataSets.get(i).getYValueSum());
  }
}

Fixed version (ground truth):
/** 
 * calculates the sum of all y-values in all datasets
 */
protected void calcYValueSum(){
  mYValueSum=0;
  if (mDataSets == null)   return;
  for (int i=0; i < mDataSets.size(); i++) {
    mYValueSum+=Math.abs(mDataSets.get(i).getYValueSum());
  }
}
Program: 18426
Project: 18426
Buggy source:
public void setData(BubbleData data){
  mBubbleData=data;
  mDataSets.addAll(data.getDataSets());
  init(data.getDataSets());
}

Fixed version (ground truth):
public void setData(BubbleData data){
  mBubbleData=data;
  mDataSets.addAll(data.getDataSets());
  init();
}
Program: 18427
Project: 18427
Buggy source:
/** 
 * Sets the PieDataSet this data object should represent.
 * @param dataSet
 */
public void setDataSet(PieDataSet dataSet){
  mDataSets.clear();
  mDataSets.add(dataSet);
  init(mDataSets);
}

Fixed version (ground truth):
/** 
 * Sets the PieDataSet this data object should represent.
 * @param dataSet
 */
public void setDataSet(PieDataSet dataSet){
  mDataSets.clear();
  mDataSets.add(dataSet);
  init();
}
Program: 18428
Project: 18428
Buggy source:
/** 
 * Resets all zooming and dragging and makes the chart fit exactly it's bounds.
 */
public Matrix fitScreen(){
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  float[] vals=new float[9];
  save.getValues(vals);
  vals[Matrix.MTRANS_X]=0f;
  vals[Matrix.MTRANS_Y]=0f;
  vals[Matrix.MSCALE_X]=1f;
  vals[Matrix.MSCALE_Y]=1f;
  save.setValues(vals);
  return save;
}

Fixed version (ground truth):
/** 
 * Resets all zooming and dragging and makes the chart fit exactly it's bounds.
 */
public Matrix fitScreen(){
  mMinScaleX=1f;
  mMinScaleY=1f;
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  float[] vals=new float[9];
  save.getValues(vals);
  vals[Matrix.MTRANS_X]=0f;
  vals[Matrix.MTRANS_Y]=0f;
  vals[Matrix.MSCALE_X]=1f;
  vals[Matrix.MSCALE_Y]=1f;
  save.setValues(vals);
  return save;
}
Program: 18429
Project: 18429
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_realtime_linechart);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setDrawGridBackground(false);
  mChart.setPinchZoom(true);
  mChart.setBackgroundColor(Color.LTGRAY);
  LineData data=new LineData();
  data.setValueTextColor(Color.WHITE);
  mChart.setData(data);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  l.setTypeface(tf);
  l.setTextColor(Color.WHITE);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  xl.setTextColor(Color.WHITE);
  xl.setDrawGridLines(false);
  xl.setAvoidFirstLastClipping(true);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setTextColor(Color.WHITE);
  leftAxis.setAxisMaxValue(120f);
  leftAxis.setDrawGridLines(true);
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setEnabled(false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_realtime_linechart);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setDrawGridBackground(false);
  mChart.setPinchZoom(true);
  mChart.setBackgroundColor(Color.LTGRAY);
  LineData data=new LineData();
  data.setValueTextColor(Color.WHITE);
  mChart.setData(data);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  l.setTypeface(tf);
  l.setTextColor(Color.WHITE);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  xl.setTextColor(Color.WHITE);
  xl.setDrawGridLines(false);
  xl.setAvoidFirstLastClipping(true);
  xl.setSpaceBetweenLabels(5);
  xl.setEnabled(false);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setTextColor(Color.WHITE);
  leftAxis.setAxisMaxValue(100f);
  leftAxis.setAxisMinValue(0f);
  leftAxis.setStartAtZero(false);
  leftAxis.setDrawGridLines(true);
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setEnabled(false);
}
Program: 18430
Project: 18430
Buggy source:
private void addEntry(){
  LineData data=mChart.getData();
  if (data != null) {
    LineDataSet set=data.getDataSetByIndex(0);
    if (set == null) {
      set=createSet();
      data.addDataSet(set);
    }
    data.addXValue(mMonths[data.getXValCount() % 12] + "String_Node_Str" + (year + data.getXValCount() / 12));
    data.addEntry(new Entry((float)(Math.random() * 40) + 40f,set.getEntryCount()),0);
    mChart.notifyDataSetChanged();
    mChart.setVisibleXRange(6);
    mChart.moveViewToX(data.getXValCount() - 7);
  }
}

Fixed version (ground truth):
private void addEntry(){
  LineData data=mChart.getData();
  if (data != null) {
    LineDataSet set=data.getDataSetByIndex(0);
    if (set == null) {
      set=createSet();
      data.addDataSet(set);
    }
    data.addXValue(mMonths[data.getXValCount() % 12] + "String_Node_Str" + (year + data.getXValCount() / 12));
    data.addEntry(new Entry((float)(Math.random() * 40) + 30f,set.getEntryCount()),0);
    mChart.notifyDataSetChanged();
    mChart.setVisibleXRange(120);
    mChart.moveViewToX(data.getXValCount() - 121);
  }
}
Program: 18431
Project: 18431
Buggy source:
private LineDataSet createSet(){
  LineDataSet set=new LineDataSet(null,"String_Node_Str");
  set.setAxisDependency(AxisDependency.LEFT);
  set.setColor(ColorTemplate.getHoloBlue());
  set.setCircleColor(ColorTemplate.getHoloBlue());
  set.setLineWidth(2f);
  set.setCircleSize(4f);
  set.setFillAlpha(65);
  set.setFillColor(ColorTemplate.getHoloBlue());
  set.setHighLightColor(Color.rgb(244,117,117));
  set.setValueTextColor(Color.WHITE);
  set.setValueTextSize(10f);
  return set;
}

Fixed version (ground truth):
private LineDataSet createSet(){
  LineDataSet set=new LineDataSet(null,"String_Node_Str");
  set.setAxisDependency(AxisDependency.LEFT);
  set.setColor(ColorTemplate.getHoloBlue());
  set.setCircleColor(Color.WHITE);
  set.setLineWidth(2f);
  set.setCircleSize(4f);
  set.setFillAlpha(65);
  set.setFillColor(ColorTemplate.getHoloBlue());
  set.setHighLightColor(Color.rgb(244,117,117));
  set.setValueTextColor(Color.WHITE);
  set.setValueTextSize(9f);
  set.setDrawValues(false);
  return set;
}
Program: 18432
Project: 18432
Buggy source:
/** 
 * Adds a new x-value to the chart data.
 * @param xVal
 */
public void addXValue(String xVal){
  mXVals.add(xVal);
}

Fixed version (ground truth):
/** 
 * Adds a new x-value to the chart data.
 * @param xVal
 */
public void addXValue(String xVal){
  mXValAverageLength=(mXValAverageLength + xVal.length()) / 2f;
  mXVals.add(xVal);
}
Program: 18435
Project: 18435
Buggy source:
@Override public void drawValues(Canvas c){
  if (mChart.getCandleData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<CandleDataSet> dataSets=mChart.getCandleData().getDataSets();
    for (int i=0; i < dataSets.size(); i++) {
      CandleDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      List<CandleEntry> entries=dataSet.getYVals();
      Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
      Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
      int minx=dataSet.getEntryPosition(entryFrom);
      int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
      float[] positions=trans.generateTransformedValuesCandle(entries,mAnimator.getPhaseX(),mAnimator.getPhaseY(),minx,maxx);
      float yOffset=Utils.convertDpToPixel(5f);
      for (int j=0; j < positions.length; j+=2) {
        float x=positions[j];
        float y=positions[j + 1];
        if (!mViewPortHandler.isInBoundsRight(x))         break;
        if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))         continue;
        float val=entries.get(j / 2 + minx).getHigh();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),x,y - yOffset,mValuePaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (mChart.getCandleData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<CandleDataSet> dataSets=mChart.getCandleData().getDataSets();
    for (int i=0; i < dataSets.size(); i++) {
      CandleDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      List<CandleEntry> entries=dataSet.getYVals();
      Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
      Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
      int minx=Math.max(dataSet.getEntryPosition(entryFrom),0);
      int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
      float[] positions=trans.generateTransformedValuesCandle(entries,mAnimator.getPhaseX(),mAnimator.getPhaseY(),minx,maxx);
      float yOffset=Utils.convertDpToPixel(5f);
      for (int j=0; j < positions.length; j+=2) {
        float x=positions[j];
        float y=positions[j + 1];
        if (!mViewPortHandler.isInBoundsRight(x))         break;
        if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))         continue;
        float val=entries.get(j / 2 + minx).getHigh();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),x,y - yOffset,mValuePaint);
      }
    }
  }
}
Program: 18437
Project: 18437
Buggy source:
@Override public void drawValues(Canvas c){
  if (mChart.getLineData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<LineDataSet> dataSets=mChart.getLineData().getDataSets();
    for (int i=0; i < dataSets.size(); i++) {
      LineDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      int valOffset=(int)(dataSet.getCircleSize() * 1.75f);
      if (!dataSet.isDrawCirclesEnabled())       valOffset=valOffset / 2;
      List<Entry> entries=dataSet.getYVals();
      Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
      Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
      int minx=dataSet.getEntryPosition(entryFrom);
      if (minx < 0)       minx=0;
      int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
      float[] positions=trans.generateTransformedValuesLine(entries,mAnimator.getPhaseX(),mAnimator.getPhaseY(),minx,maxx);
      for (int j=0; j < positions.length; j+=2) {
        float x=positions[j];
        float y=positions[j + 1];
        if (!mViewPortHandler.isInBoundsRight(x))         break;
        if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))         continue;
        float val=entries.get(j / 2 + minx).getVal();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),x,y - valOffset,mValuePaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (mChart.getLineData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<LineDataSet> dataSets=mChart.getLineData().getDataSets();
    for (int i=0; i < dataSets.size(); i++) {
      LineDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
      int valOffset=(int)(dataSet.getCircleSize() * 1.75f);
      if (!dataSet.isDrawCirclesEnabled())       valOffset=valOffset / 2;
      List<Entry> entries=dataSet.getYVals();
      Entry entryFrom=dataSet.getEntryForXIndex(mMinX);
      Entry entryTo=dataSet.getEntryForXIndex(mMaxX);
      int minx=Math.max(dataSet.getEntryPosition(entryFrom),0);
      int maxx=Math.min(dataSet.getEntryPosition(entryTo) + 1,entries.size());
      float[] positions=trans.generateTransformedValuesLine(entries,mAnimator.getPhaseX(),mAnimator.getPhaseY(),minx,maxx);
      for (int j=0; j < positions.length; j+=2) {
        float x=positions[j];
        float y=positions[j + 1];
        if (!mViewPortHandler.isInBoundsRight(x))         break;
        if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))         continue;
        float val=entries.get(j / 2 + minx).getVal();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),x,y - valOffset,mValuePaint);
      }
    }
  }
}
Program: 18440
Project: 18440
Buggy source:
@Override public void drawValues(Canvas c){
  if (mChart.getScatterData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<ScatterDataSet> dataSets=mChart.getScatterData().getDataSets();
    for (int i=0; i < mChart.getScatterData().getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      List<Entry> entries=dataSet.getYVals();
      float[] positions=mChart.getTransformer(dataSet.getAxisDependency()).generateTransformedValuesScatter(entries,mAnimator.getPhaseY());
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length * mAnimator.getPhaseX(); j+=2) {
        if (!mViewPortHandler.isInBoundsRight(positions[j]))         break;
        if (j != 0 && (!mViewPortHandler.isInBoundsLeft(positions[j]) || !mViewPortHandler.isInBoundsY(positions[j + 1])))         continue;
        float val=entries.get(j / 2).getVal();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (mChart.getScatterData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    List<ScatterDataSet> dataSets=mChart.getScatterData().getDataSets();
    for (int i=0; i < mChart.getScatterData().getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      applyValueTextStyle(dataSet);
      List<Entry> entries=dataSet.getYVals();
      float[] positions=mChart.getTransformer(dataSet.getAxisDependency()).generateTransformedValuesScatter(entries,mAnimator.getPhaseY());
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length * mAnimator.getPhaseX(); j+=2) {
        if (!mViewPortHandler.isInBoundsRight(positions[j]))         break;
        if ((!mViewPortHandler.isInBoundsLeft(positions[j]) || !mViewPortHandler.isInBoundsY(positions[j + 1])))         continue;
        float val=entries.get(j / 2).getVal();
        c.drawText(dataSet.getValueFormatter().getFormattedValue(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
      }
    }
  }
}
Program: 18441
Project: 18441
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_combined);
  mChart=(CombinedChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawGridBackground(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawOrder(new DrawOrder[]{DrawOrder.BAR,DrawOrder.BUBBLE,DrawOrder.CANDLE,DrawOrder.LINE,DrawOrder.SCATTER});
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setDrawGridLines(false);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setDrawGridLines(false);
  XAxis xAxis=mChart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTH_SIDED);
  CombinedData data=new CombinedData(mMonths);
  data.setData(generateLineData());
  data.setData(generateBarData());
  mChart.setData(data);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_combined);
  mChart=(CombinedChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setBackgroundColor(Color.WHITE);
  mChart.setDrawGridBackground(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawOrder(new DrawOrder[]{DrawOrder.BAR,DrawOrder.BUBBLE,DrawOrder.CANDLE,DrawOrder.LINE,DrawOrder.SCATTER});
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setDrawGridLines(false);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setDrawGridLines(false);
  XAxis xAxis=mChart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTH_SIDED);
  CombinedData data=new CombinedData(mMonths);
  data.setData(generateLineData());
  data.setData(generateBarData());
  mChart.setData(data);
  mChart.invalidate();
}
Program: 18442
Project: 18442
Buggy source:
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the BUBBLECHART.
 * @param entries
 * @return
 */
public float[] generateTransformedValuesBubble(List<? extends Entry> entries,float phaseX,float phaseY,int from,int to){
  final int count=(int)Math.ceil((to - from) * phaseX) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    Entry e=entries.get(j / 2 + from);
    if (e != null) {
      valuePoints[j]=(float)(e.getXIndex() - from) * phaseX + from;
      valuePoints[j + 1]=e.getVal() * phaseY;
    }
  }
  pointValuesToPixel(valuePoints);
  return valuePoints;
}

Fixed version (ground truth):
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the BUBBLECHART.
 * @param entries
 * @return
 */
public float[] generateTransformedValuesBubble(List<? extends Entry> entries,float phaseX,float phaseY,int from,int to){
  final int count=(int)Math.ceil(to - from) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    Entry e=entries.get(j / 2 + from);
    if (e != null) {
      valuePoints[j]=(float)(e.getXIndex() - from) * phaseX + from;
      valuePoints[j + 1]=e.getVal() * phaseY;
    }
  }
  pointValuesToPixel(valuePoints);
  return valuePoints;
}
Program: 18443
Project: 18443
Buggy source:
@Override public void drawData(Canvas c){
  if (mPathBitmap == null || (mPathBitmap.getWidth() != (int)mViewPortHandler.getChartWidth()) || (mPathBitmap.getHeight() != (int)mViewPortHandler.getChartHeight())) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mPathBitmap,0,0,mRenderPaint);
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  int width=(int)mViewPortHandler.getChartWidth();
  int height=(int)mViewPortHandler.getChartHeight();
  if (mDrawBitmap == null || (mDrawBitmap.getWidth() != width) || (mDrawBitmap.getHeight() != height)) {
    if (width > 0 && height > 0) {
      mDrawBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_4444);
      mBitmapCanvas=new Canvas(mDrawBitmap);
    }
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mDrawBitmap,0,0,mRenderPaint);
}
Program: 18444
Project: 18444
Buggy source:
@Override public void drawData(Canvas c){
  if (mDrawBitmap == null || (mDrawBitmap.getWidth() != (int)mViewPortHandler.getChartWidth()) || (mDrawBitmap.getHeight() != (int)mViewPortHandler.getChartHeight())) {
    mDrawBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_8888);
    mBitmapCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  int width=(int)mViewPortHandler.getChartWidth();
  int height=(int)mViewPortHandler.getChartHeight();
  if (mDrawBitmap == null || (mDrawBitmap.getWidth() != width) || (mDrawBitmap.getHeight() != height)) {
    if (width > 0 && height > 0) {
      mDrawBitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_4444);
      mBitmapCanvas=new Canvas(mDrawBitmap);
    }
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}
Program: 18447
Project: 18447
Buggy source:
@Override public void drawData(Canvas c){
  if (mPathBitmap == null) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mPathBitmap,0,0,mRenderPaint);
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  if (mPathBitmap == null || mPathBitmap.getWidth() != mViewPortHandler.getChartWidth() || mPathBitmap.getHeight() != mViewPortHandler.getChartHeight()) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mPathBitmap,0,0,mRenderPaint);
}
Program: 18448
Project: 18448
Buggy source:
@Override public void drawData(Canvas c){
  if (mDrawBitmap == null) {
    mDrawBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mDrawBitmap,0,0,mRenderPaint);
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  if (mDrawBitmap == null || mDrawBitmap.getWidth() != mViewPortHandler.getChartWidth() || mDrawBitmap.getHeight() != mViewPortHandler.getChartHeight()) {
    mDrawBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
  PieData pieData=mChart.getData();
  for (  PieDataSet set : pieData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mDrawBitmap,0,0,mRenderPaint);
}
Program: 18450
Project: 18450
Buggy source:
public boolean isInBoundsRight(float x){
  return mContentRect.right >= x ? true : false;
}

Fixed version (ground truth):
public boolean isInBoundsRight(float x){
  x=(float)((int)(x * 100.f)) / 100.f;
  return mContentRect.right >= x ? true : false;
}
Program: 18451
Project: 18451
Buggy source:
public boolean isInBoundsBottom(float y){
  return mContentRect.bottom >= y ? true : false;
}

Fixed version (ground truth):
public boolean isInBoundsBottom(float y){
  y=(float)((int)(y * 100.f)) / 100.f;
  return mContentRect.bottom >= y ? true : false;
}