nus-yam/ex-repair huggingface dataset:
Program: 26525
Project: 26525
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.LINE});
  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.setDrawGridBackground(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawOrder(new DrawOrder[]{DrawOrder.BAR,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: 26526
Project: 26526
Buggy source:
/** 
 * Returns the lowest x-index (value on the x-axis) that is still visible on the chart.
 * @return
 */
public int getLowestVisibleXIndex(){
  float[] pts=new float[]{mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom()};
  getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  return (pts[0] <= 0) ? 0 : (int)(pts[0] + 1);
}

Fixed version (ground truth):
/** 
 * Returns the lowest x-index (value on the x-axis) that is still visible on the chart.
 * @return
 */
@Override public int getLowestVisibleXIndex(){
  float[] pts=new float[]{mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom()};
  getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  return (pts[0] <= 0) ? 0 : (int)(pts[0] + 1);
}
Program: 26527
Project: 26527
Buggy source:
/** 
 * Returns the highest x-index (value on the x-axis) that is still visible on the chart.
 * @return
 */
public int getHighestVisibleXIndex(){
  float[] pts=new float[]{mViewPortHandler.contentRight(),mViewPortHandler.contentBottom()};
  getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  return (pts[0] >= mData.getXValCount()) ? mData.getXValCount() - 1 : (int)pts[0];
}

Fixed version (ground truth):
/** 
 * Returns the highest x-index (value on the x-axis) that is still visible on the chart.
 * @return
 */
@Override public int getHighestVisibleXIndex(){
  float[] pts=new float[]{mViewPortHandler.contentRight(),mViewPortHandler.contentBottom()};
  getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  return (pts[0] >= mData.getXValCount()) ? mData.getXValCount() - 1 : (int)pts[0];
}
Program: 26531
Project: 26531
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)     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[]{0,low,mChart.getXChartMax(),low,0,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)     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);
  }
}
Program: 26532
Project: 26532
Buggy source:
public abstract void initBuffers();

Fixed version (ground truth):
/** 
 * Initializes the buffers used for rendering with a new size. Since this method performs memory allocations, it should only be called if necessary.
 */
public abstract void initBuffers();
Program: 26533
Project: 26533
Buggy source:
protected void drawDataSet(Canvas c,BarDataSet dataSet,int index){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  calcXBounds(trans);
  mShadowPaint.setColor(dataSet.getBarShadowColor());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  List<BarEntry> entries=dataSet.getYVals();
  BarBuffer buffer=mBarBuffers[index];
  buffer.setPhases(phaseX,phaseY);
  buffer.setBarSpace(dataSet.getBarSpace());
  buffer.setDataSet(index);
  buffer.setInverted(mChart.isInverted(dataSet.getAxisDependency()));
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  for (int j=0; j < buffer.size(); j+=4) {
    if (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 3]))     break;
    if (!mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 1]))     continue;
    if (mChart.isDrawBarShadowEnabled()) {
      c.drawRect(mViewPortHandler.contentLeft(),buffer.buffer[j + 1],mViewPortHandler.contentRight(),buffer.buffer[j + 3],mShadowPaint);
    }
    mRenderPaint.setColor(dataSet.getColor(j / 4));
    c.drawRect(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
  }
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,BarDataSet dataSet,int index){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  mShadowPaint.setColor(dataSet.getBarShadowColor());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  List<BarEntry> entries=dataSet.getYVals();
  BarBuffer buffer=mBarBuffers[index];
  buffer.setPhases(phaseX,phaseY);
  buffer.setBarSpace(dataSet.getBarSpace());
  buffer.setDataSet(index);
  buffer.setInverted(mChart.isInverted(dataSet.getAxisDependency()));
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
  for (int j=0; j < buffer.size(); j+=4) {
    if (!mViewPortHandler.isInBoundsTop(buffer.buffer[j + 3]))     break;
    if (!mViewPortHandler.isInBoundsBottom(buffer.buffer[j + 1]))     continue;
    if (mChart.isDrawBarShadowEnabled()) {
      c.drawRect(mViewPortHandler.contentLeft(),buffer.buffer[j + 1],mViewPortHandler.contentRight(),buffer.buffer[j + 3],mShadowPaint);
    }
    mRenderPaint.setColor(dataSet.getColor(j / 4));
    c.drawRect(buffer.buffer[j],buffer.buffer[j + 1],buffer.buffer[j + 2],buffer.buffer[j + 3],mRenderPaint);
  }
}
Program: 26534
Project: 26534
Buggy source:
protected void drawDataSet(Canvas c,LineDataSet dataSet){
  List<Entry> entries=dataSet.getYVals();
  if (entries.size() < 1)   return;
  calcXBounds(mChart.getTransformer(dataSet.getAxisDependency()));
  mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
  mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
  if (dataSet.isDrawCubicEnabled()) {
    drawCubic(c,dataSet,entries);
  }
 else {
    drawLinear(c,dataSet,entries);
  }
  mRenderPaint.setPathEffect(null);
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,LineDataSet dataSet){
  List<Entry> entries=dataSet.getYVals();
  if (entries.size() < 1)   return;
  mRenderPaint.setStrokeWidth(dataSet.getLineWidth());
  mRenderPaint.setPathEffect(dataSet.getDashPathEffect());
  if (dataSet.isDrawCubicEnabled()) {
    drawCubic(c,dataSet,entries);
  }
 else {
    drawLinear(c,dataSet,entries);
  }
  mRenderPaint.setPathEffect(null);
}
Program: 26535
Project: 26535
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)     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++) {
    LineDataSet set=mChart.getLineData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null)     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);
  }
}
Program: 26536
Project: 26536
Buggy source:
/** 
 * Calculates the minimum and maximum x-value the chart can currently display (with the given zoom level).
 * @param trans
 */
protected void calcXBounds(Transformer trans){
  double minx=trans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),0).x;
  double maxx=trans.getValuesByTouchPoint(mViewPortHandler.contentRight(),0).x;
  if (!Double.isInfinite(minx))   mMinX=(int)minx;
  if (!Double.isInfinite(maxx))   mMaxX=(int)Math.ceil(maxx);
}

Fixed version (ground truth):
/** 
 * Calculates the minimum and maximum x-value the chart can currently display (with the given zoom level).
 * @param chart
 * @param modulus
 */
public void calcXBounds(BarLineScatterCandleDataProvider chart,int xAxisModulus){
  int low=chart.getLowestVisibleXIndex();
  int high=chart.getHighestVisibleXIndex();
  int subLow=(low % xAxisModulus == 0) ? xAxisModulus : 0;
  mMinX=Math.max((low / xAxisModulus) * (xAxisModulus) - subLow,0);
  mMaxX=Math.min((high / xAxisModulus) * (xAxisModulus) + xAxisModulus,(int)chart.getXChartMax());
}
Program: 26538
Project: 26538
Buggy source:
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  int maxx=mMaxX;
  int minx=mMinX;
  if (maxx >= mXAxis.getValues().size())   maxx=mXAxis.getValues().size() - 1;
  if (minx < 0)   minx=0;
  for (int i=minx; i <= maxx; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisLabelPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisLabelPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisLabelPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  for (int i=mMinX; i <= mMaxX; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisLabelPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisLabelPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisLabelPaint);
    }
  }
}
Program: 26539
Project: 26539
Buggy source:
@Override public void renderAxisLine(Canvas c){
  calcXBounds(mTrans);
  if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())   return;
  mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
  mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
  if (mXAxis.getPosition() == XAxisPosition.TOP || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
    c.drawLine(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop(),mViewPortHandler.contentRight(),mViewPortHandler.contentTop(),mAxisLinePaint);
  }
  if (mXAxis.getPosition() == XAxisPosition.BOTTOM || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
    c.drawLine(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom(),mViewPortHandler.contentRight(),mViewPortHandler.contentBottom(),mAxisLinePaint);
  }
}

Fixed version (ground truth):
@Override public void renderAxisLine(Canvas c){
  if (!mXAxis.isDrawAxisLineEnabled() || !mXAxis.isEnabled())   return;
  mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
  mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
  if (mXAxis.getPosition() == XAxisPosition.TOP || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
    c.drawLine(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop(),mViewPortHandler.contentRight(),mViewPortHandler.contentTop(),mAxisLinePaint);
  }
  if (mXAxis.getPosition() == XAxisPosition.BOTTOM || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
    c.drawLine(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom(),mViewPortHandler.contentRight(),mViewPortHandler.contentBottom(),mAxisLinePaint);
  }
}
Program: 26541
Project: 26541
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: 26542
Project: 26542
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;
}
Program: 26543
Project: 26543
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: 26544
Project: 26544
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: 26545
Project: 26545
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  set1.setDrawFilled(true);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setColor(Color.BLACK);
  set1.setCircleColor(Color.BLACK);
  set1.setLineWidth(1f);
  set1.setCircleSize(3f);
  set1.setDrawCircleHole(false);
  set1.setValueTextSize(9f);
  set1.setFillAlpha(65);
  set1.setFillColor(Color.BLACK);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}
Program: 26547
Project: 26547
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: 26548
Project: 26548
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: 26549
Project: 26549
Buggy source:
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    if (transparentCircleRadius > holeRadius) {
      int color=mTransparentCirclePaint.getColor();
      mTransparentCirclePaint.setColor(color & 0x60FFFFFF);
      mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mTransparentCirclePaint);
      mTransparentCirclePaint.setColor(color);
    }
    mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
  }
}

Fixed version (ground truth):
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    if (transparentCircleRadius > holeRadius && mAnimator.getPhaseX() >= 1f && mAnimator.getPhaseY() >= 1f) {
      int color=mTransparentCirclePaint.getColor();
      mTransparentCirclePaint.setColor(color & 0x60FFFFFF);
      mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mTransparentCirclePaint);
      mTransparentCirclePaint.setColor(color);
    }
    mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
  }
}
Program: 26552
Project: 26552
Buggy source:
@Override public void feed(List<CandleEntry> entries){
  float size=entries.size() * phaseX;
  for (int i=0; i < size; i++) {
    CandleEntry e=entries.get(i);
    addBody(e.getXIndex() - 0.5f + mBodySpace,e.getClose() * phaseY,e.getXIndex() + 0.5f - mBodySpace,e.getOpen() * phaseY);
  }
  reset();
}

Fixed version (ground truth):
@Override public void feed(List<CandleEntry> entries){
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom; i < size; i++) {
    CandleEntry e=entries.get(i);
    addBody(e.getXIndex() - 0.5f + mBodySpace,e.getClose() * phaseY,e.getXIndex() + 0.5f - mBodySpace,e.getOpen() * phaseY);
  }
  reset();
}
Program: 26553
Project: 26553
Buggy source:
@Override public void feed(List<CandleEntry> entries){
  float size=entries.size() * phaseX;
  for (int i=0; i < size; i++) {
    CandleEntry e=entries.get(i);
    addShadow(e.getXIndex(),e.getHigh() * phaseY,e.getXIndex(),e.getLow() * phaseY);
  }
  reset();
}

Fixed version (ground truth):
@Override public void feed(List<CandleEntry> entries){
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom; i < size; i++) {
    CandleEntry e=entries.get(i);
    addShadow(e.getXIndex(),e.getHigh() * phaseY,e.getXIndex(),e.getLow() * phaseY);
  }
  reset();
}
Program: 26554
Project: 26554
Buggy source:
@Override public void feed(List<Entry> entries){
  float size=entries.size() * phaseX;
  for (int i=0; i < size; i++) {
    Entry e=entries.get(i);
    addCircle(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}

Fixed version (ground truth):
@Override public void feed(List<Entry> entries){
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom; i < size; i++) {
    Entry e=entries.get(i);
    addCircle(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}
Program: 26555
Project: 26555
Buggy source:
@Override public void feed(List<Entry> entries){
  moveTo(entries.get(0).getXIndex(),entries.get(0).getVal());
  float size=entries.size() * phaseX;
  for (int i=1; i < size; i++) {
    Entry e=entries.get(i);
    lineTo(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}

Fixed version (ground truth):
@Override public void feed(List<Entry> entries){
  moveTo(entries.get(mFrom).getXIndex(),entries.get(mFrom).getVal());
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom + 1; i < size; i++) {
    Entry e=entries.get(i);
    lineTo(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}
Program: 26557
Project: 26557
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();
      float[] positions=trans.generateTransformedValuesCandle(entries,mAnimator.getPhaseY());
      float yOffset=Utils.convertDpToPixel(5f);
      for (int j=0; j < positions.length * mAnimator.getPhaseX(); 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).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=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);
      }
    }
  }
}
Program: 26558
Project: 26558
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_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setProgress(10);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  mChart.setUsePercentValues(true);
  mChart.setHoleColorTransparent(true);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setHoleRadius(60f);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawCenterText(true);
  mChart.setDrawHoleEnabled(true);
  mChart.setRotationAngle(0);
  mChart.setRotationEnabled(true);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setCenterText("String_Node_Str");
  setData(3,100);
  mChart.animateXY(1500,1500,EasingFunction.EaseInOutQuad,EasingFunction.EaseInOutQuad);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}

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_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setProgress(10);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  mChart.setUsePercentValues(true);
  mChart.setDescription("String_Node_Str");
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setDrawHoleEnabled(true);
  mChart.setHoleColorTransparent(true);
  mChart.setTransparentCircleColor(Color.WHITE);
  mChart.setHoleRadius(58f);
  mChart.setTransparentCircleRadius(61f);
  mChart.setDrawCenterText(true);
  mChart.setRotationAngle(0);
  mChart.setRotationEnabled(true);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setCenterText("String_Node_Str");
  setData(3,100);
  mChart.animateXY(1500,1500);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}
Program: 26559
Project: 26559
Buggy source:
private void setData(int count,float range){
  float mult=range;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count + 1; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 5,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count + 1; i++)   xVals.add(mParties[i % mParties.length]);
  PieDataSet dataSet=new PieDataSet(yVals1,"String_Node_Str");
  dataSet.setSliceSpace(3f);
  ArrayList<Integer> colors=new ArrayList<Integer>();
  for (  int c : ColorTemplate.VORDIPLOM_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.JOYFUL_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.COLORFUL_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.LIBERTY_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.PASTEL_COLORS)   colors.add(c);
  colors.add(ColorTemplate.getHoloBlue());
  dataSet.setColors(colors);
  PieData data=new PieData(xVals,dataSet);
  data.setValueFormatter(new PercentFormatter());
  data.setValueTextSize(11f);
  data.setValueTextColor(Color.WHITE);
  data.setValueTypeface(tf);
  mChart.setData(data);
  mChart.highlightValues(null);
  mChart.invalidate();
}

Fixed version (ground truth):
private void setData(int count,float range){
  float mult=range;
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count + 1; i++) {
    yVals1.add(new Entry((float)(Math.random() * mult) + mult / 5,i));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count + 1; i++)   xVals.add(mParties[i % mParties.length]);
  PieDataSet dataSet=new PieDataSet(yVals1,"String_Node_Str");
  dataSet.setSliceSpace(3f);
  dataSet.setSelectionShift(5f);
  ArrayList<Integer> colors=new ArrayList<Integer>();
  for (  int c : ColorTemplate.VORDIPLOM_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.JOYFUL_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.COLORFUL_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.LIBERTY_COLORS)   colors.add(c);
  for (  int c : ColorTemplate.PASTEL_COLORS)   colors.add(c);
  colors.add(ColorTemplate.getHoloBlue());
  dataSet.setColors(colors);
  PieData data=new PieData(xVals,dataSet);
  data.setValueFormatter(new PercentFormatter());
  data.setValueTextSize(11f);
  data.setValueTextColor(Color.WHITE);
  data.setValueTypeface(tf);
  mChart.setData(data);
  mChart.highlightValues(null);
  mChart.invalidate();
}
Program: 26560
Project: 26560
Buggy source:
/** 
 * Set the hole in the center of the PieChart transparent. Thank you, code provided by:
 * @link https://github.com/tbarthel-fr
 * @param enable
 */
public void setHoleColorTransparent(boolean enable){
  if (enable) {
    ((PieChartRenderer)mRenderer).getPaintHole().setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
  }
 else {
    ((PieChartRenderer)mRenderer).getPaintHole().setXfermode(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the hole in the center of the PieChart transparent. Thank you, code provided by:
 * @link https://github.com/tbarthel-fr
 * @param enable
 */
public void setHoleColorTransparent(boolean enable){
  if (enable) {
    ((PieChartRenderer)mRenderer).getPaintHole().setColor(0xFFFFFFFF);
    ((PieChartRenderer)mRenderer).getPaintHole().setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  }
 else {
    ((PieChartRenderer)mRenderer).getPaintHole().setXfermode(null);
  }
}
Program: 26561
Project: 26561
Buggy source:
public PieChartRenderer(PieChart chart,ChartAnimator animator,ViewPortHandler viewPortHandler){
  super(animator,viewPortHandler);
  mChart=chart;
  mHolePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHolePaint.setColor(Color.WHITE);
  mCenterTextPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCenterTextPaint.setColor(Color.BLACK);
  mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f));
  mCenterTextPaint.setTextAlign(Align.CENTER);
  mValuePaint.setTextSize(Utils.convertDpToPixel(13f));
  mValuePaint.setColor(Color.WHITE);
  mValuePaint.setTextAlign(Align.CENTER);
}

Fixed version (ground truth):
public PieChartRenderer(PieChart chart,ChartAnimator animator,ViewPortHandler viewPortHandler){
  super(animator,viewPortHandler);
  mChart=chart;
  mHolePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHolePaint.setColor(Color.WHITE);
  mHolePaint.setStyle(Style.FILL);
  mTransparentCirclePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mTransparentCirclePaint.setColor(Color.WHITE);
  mTransparentCirclePaint.setStyle(Style.FILL);
  mCenterTextPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCenterTextPaint.setColor(Color.BLACK);
  mCenterTextPaint.setTextSize(Utils.convertDpToPixel(12f));
  mCenterTextPaint.setTextAlign(Align.CENTER);
  mValuePaint.setTextSize(Utils.convertDpToPixel(13f));
  mValuePaint.setColor(Color.WHITE);
  mValuePaint.setTextAlign(Align.CENTER);
}
Program: 26562
Project: 26562
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 || ((int)mViewPortHandler.getChartHeight() != mDrawBitmap.getHeight())) {
    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);
  }
}
Program: 26563
Project: 26563
Buggy source:
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    int color=mHolePaint.getColor();
    mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
    if (transparentCircleRadius > holeRadius) {
      mHolePaint.setColor(color & 0x60FFFFFF);
      mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mHolePaint);
      mHolePaint.setColor(color);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the hole in the center of the chart and the transparent circle / hole
 */
protected void drawHole(Canvas c){
  if (mChart.isDrawHoleEnabled()) {
    float transparentCircleRadius=mChart.getTransparentCircleRadius();
    float holeRadius=mChart.getHoleRadius();
    float radius=mChart.getRadius();
    PointF center=mChart.getCenterCircleBox();
    if (transparentCircleRadius > holeRadius) {
      int color=mTransparentCirclePaint.getColor();
      mTransparentCirclePaint.setColor(color & 0x60FFFFFF);
      mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * transparentCircleRadius,mTransparentCirclePaint);
      mTransparentCirclePaint.setColor(color);
    }
    mBitmapCanvas.drawCircle(center.x,center.y,radius / 100 * holeRadius,mHolePaint);
  }
}
Program: 26564
Project: 26564
Buggy source:
@Override public void drawExtras(Canvas c){
  drawHole(c);
  drawCenterText(c);
}

Fixed version (ground truth):
@Override public void drawExtras(Canvas c){
  drawHole(c);
  c.drawBitmap(mDrawBitmap,0,0,mRenderPaint);
  drawCenterText(c);
}
Program: 26567
Project: 26567
Buggy source:
/** 
 * Sets the one and ONLY color that should be used for this DataSet when open <= close. Internally, this recreates the colors array and adds the specified color.
 * @param color
 */
public void setIncreasingColor(int color){
  mIncreasingColor=color;
}

Fixed version (ground truth):
/** 
 * Sets the one and ONLY color that should be used for this DataSet when open <= close. 
 * @param color
 */
public void setIncreasingColor(int color){
  mIncreasingColor=color;
}
Program: 26568
Project: 26568
Buggy source:
/** 
 * Sets the one and ONLY color that should be used for this DataSet when open > close. Internally, this recreates the colors array and adds the specified color.
 * @param color
 */
public void setDecreasingColor(int color){
  mDecreasingColor=color;
}

Fixed version (ground truth):
/** 
 * Sets the one and ONLY color that should be used for this DataSet when open > close. 
 * @param color
 */
public void setDecreasingColor(int color){
  mDecreasingColor=color;
}
Program: 26569
Project: 26569
Buggy source:
@Override public void feed(List<Entry> entries){
  moveTo(entries.get(mFrom).getXIndex(),entries.get(mFrom).getVal());
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom + 1; i < size; i++) {
    Entry e=entries.get(i);
    lineTo(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}

Fixed version (ground truth):
@Override public void feed(List<Entry> entries){
  moveTo(entries.get(mFrom).getXIndex(),entries.get(mFrom).getVal() * phaseY);
  int size=(int)Math.ceil((mTo - mFrom) * phaseX + mFrom);
  for (int i=mFrom + 1; i < size; i++) {
    Entry e=entries.get(i);
    lineTo(e.getXIndex(),e.getVal() * phaseY);
  }
  reset();
}
Program: 26571
Project: 26571
Buggy source:
/** 
 * limits the drawing on the x-axis 
 */
public void limitFrom(int from){
  mFrom=from;
}

Fixed version (ground truth):
/** 
 * limits the drawing on the x-axis 
 */
public void limitFrom(int from){
  if (from < 0)   from=0;
  mFrom=from;
}
Program: 26572
Project: 26572
Buggy source:
/** 
 * limits the drawing on the x-axis 
 */
public void limitTo(int to){
  mTo=to;
}

Fixed version (ground truth):
/** 
 * limits the drawing on the x-axis 
 */
public void limitTo(int to){
  if (to < 0)   to=0;
  mTo=to;
}
Program: 26573
Project: 26573
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);
      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=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);
      }
    }
  }
}
Program: 26575
Project: 26575
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
    for (    Runnable r : mJobs) {
      post(r);
    }
    mJobs.clear();
  }
  notifyDataSetChanged();
  super.onSizeChanged(w,h,oldw,oldh);
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    if (mDrawBitmap != null)     mDrawBitmap.recycle();
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
    for (    Runnable r : mJobs) {
      post(r);
    }
    mJobs.clear();
  }
  notifyDataSetChanged();
  super.onSizeChanged(w,h,oldw,oldh);
}
Program: 26578
Project: 26578
Buggy source:
public YAxisRenderer(ViewPortHandler viewPortHandler,YAxis yAxis,Transformer trans){
  super(viewPortHandler,trans);
  this.mYAxis=yAxis;
  mAxisLabelPaint.setColor(Color.BLACK);
  mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
  mLimitLinePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mLimitLinePaint.setStyle(Paint.Style.FILL_AND_STROKE);
}

Fixed version (ground truth):
public YAxisRenderer(ViewPortHandler viewPortHandler,YAxis yAxis,Transformer trans){
  super(viewPortHandler,trans);
  this.mYAxis=yAxis;
  mAxisLabelPaint.setColor(Color.BLACK);
  mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
  mLimitLinePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mLimitLinePaint.setStyle(Paint.Style.STROKE);
}