nus-yam/ex-repair huggingface dataset:
Program: 18793
Project: 18793
Buggy source:
public MyMarkerView(Context context,int layoutResource){
  super(context,layoutResource);
  tvContent=(TextView)findViewById(R.id.tvContent);
}

Fixed version (ground truth):
public MyMarkerView(Context context,int layoutResource){
  super(context,layoutResource);
  tvContent=(TextView)findViewById(R.id.tvContent);
  setOnClickListener(this);
}
Program: 18794
Project: 18794
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (mListener == null || mDataNotSet)   return false;
  if (!mTouchEnabled)   return false;
 else   return mListener.onTouch(this,event);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  super.onTouchEvent(event);
  if (mListener == null || mDataNotSet)   return false;
  if (!mTouchEnabled)   return false;
 else   return mListener.onTouch(this,event);
}
Program: 18795
Project: 18795
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
  mDrawCanvas=new Canvas(mDrawBitmap);
  prepareContentRect();
  prepare();
  super.onSizeChanged(w,h,oldw,oldh);
}
Program: 18796
Project: 18796
Buggy source:
@Override protected void calculateOffsets(){
  if (mDrawLegend) {
    float legendRight=0f, legendBottom=0f;
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
      float spacing=Utils.convertDpToPixel(13f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 4f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
    float min=Utils.convertDpToPixel(11f);
    mLegend.setOffsetTop(min);
    mLegend.setOffsetLeft(min);
    mOffsetTop=min;
    mOffsetRight=Math.max(min,legendRight);
    mOffsetBottom=Math.max(min,legendBottom);
    applyCalculatedOffsets();
  }
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  float legendRight=0f, legendBottom=0f;
  if (mDrawLegend) {
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
      float spacing=Utils.convertDpToPixel(13f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 4f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
  }
  float min=Utils.convertDpToPixel(11f);
  mLegend.setOffsetTop(min);
  mLegend.setOffsetLeft(min);
  mOffsetLeft=min;
  mOffsetTop=min;
  mOffsetRight=Math.max(min,legendRight);
  mOffsetBottom=Math.max(min,legendBottom);
  applyCalculatedOffsets();
}
Program: 18797
Project: 18797
Buggy source:
@Override protected void calculateOffsets(){
  if (mDrawLegend) {
    float legendRight=0f, legendBottom=0f;
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
      float spacing=Utils.convertDpToPixel(8f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing+ mXLabels.mLabelWidth;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 5.5f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
    float min=Utils.convertDpToPixel(11f);
    mOffsetBottom=Math.max(mXLabels.mLabelWidth,min);
    mOffsetTop=Math.max(mXLabels.mLabelWidth,min);
    mOffsetRight=Math.max(legendRight,min);
    mOffsetLeft=Math.max(mXLabels.mLabelWidth,min);
    mOffsetBottom=Math.max(mOffsetBottom,legendBottom);
    mOffsetRight=Math.max(mOffsetRight,legendRight / 3f * 2f);
    mLegend.setOffsetTop(min);
    mLegend.setOffsetLeft(min);
    applyCalculatedOffsets();
  }
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  float legendRight=0f, legendBottom=0f;
  if (mDrawLegend) {
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) {
      float spacing=Utils.convertDpToPixel(8f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing+ mXLabels.mLabelWidth;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 5.5f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
  }
  float min=Utils.convertDpToPixel(11f);
  mOffsetBottom=Math.max(mXLabels.mLabelWidth,min);
  mOffsetTop=Math.max(mXLabels.mLabelWidth,min);
  mOffsetRight=Math.max(legendRight,min);
  mOffsetLeft=Math.max(mXLabels.mLabelWidth,min);
  mOffsetBottom=Math.max(mOffsetBottom,legendBottom);
  mOffsetRight=Math.max(mOffsetRight,legendRight / 3f * 2f);
  mLegend.setOffsetTop(min);
  mLegend.setOffsetLeft(min);
  applyCalculatedOffsets();
}
Program: 18798
Project: 18798
Buggy source:
@Override public boolean onSingleTapUp(MotionEvent e){
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  if (l != null) {
    l.onChartSingleTapped(e);
  }
  Highlight h=mChart.getHighlightByTouchPoint(e.getX(),e.getY());
  if (h == null || h.equalTo(mLastHighlighted)) {
    mChart.highlightTouch(null);
    mLastHighlighted=null;
  }
 else {
    mLastHighlighted=h;
    mChart.highlightTouch(h);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onSingleTapUp(MotionEvent e){
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  if (l != null) {
    l.onChartSingleTapped(e);
  }
  Highlight h=mChart.getHighlightByTouchPoint(e.getX(),e.getY());
  if (h == null || h.equalTo(mLastHighlighted)) {
    mChart.highlightTouch(null);
    mLastHighlighted=null;
  }
 else {
    mLastHighlighted=h;
    mChart.highlightTouch(h);
  }
  return super.onSingleTapUp(e);
}
Program: 18799
Project: 18799
Buggy source:
/** 
 * set if the user should be allowed to draw onto the chart
 * @param drawingEnabled
 */
public void setDrawingEnabled(boolean drawingEnabled){
  if (mListener instanceof BarLineChartTouchListener) {
    ((BarLineChartTouchListener)mListener).setDrawingEnabled(drawingEnabled);
  }
}

Fixed version (ground truth):
/** 
 * set if the user should be allowed to draw onto the chart
 * @param drawingEnabled
 */
public void setDrawingEnabled(boolean drawingEnabled){
  if (mListener instanceof BarLineChartTouchListener) {
    ((BarLineChartTouchListener<?>)mListener).setDrawingEnabled(drawingEnabled);
  }
}
Program: 18800
Project: 18800
Buggy source:
@Override public DataSet copy(){
  ArrayList<BarEntry> yVals=new ArrayList<BarEntry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(((BarEntry)mYVals.get(i)).copy());
  }
  BarDataSet copied=new BarDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mStackSize=mStackSize;
  copied.mBarSpace=mBarSpace;
  copied.mBarShadowColor=mBarShadowColor;
  copied.mStackLabels=mStackLabels;
  copied.mHighLightColor=mHighLightColor;
  copied.mHighLightAlpha=mHighLightAlpha;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<BarEntry> copy(){
  ArrayList<BarEntry> yVals=new ArrayList<BarEntry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(((BarEntry)mYVals.get(i)).copy());
  }
  BarDataSet copied=new BarDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mStackSize=mStackSize;
  copied.mBarSpace=mBarSpace;
  copied.mBarShadowColor=mBarShadowColor;
  copied.mStackLabels=mStackLabels;
  copied.mHighLightColor=mHighLightColor;
  copied.mHighLightAlpha=mHighLightAlpha;
  return copied;
}
Program: 18801
Project: 18801
Buggy source:
@Override public DataSet copy(){
  ArrayList<CandleEntry> yVals=new ArrayList<CandleEntry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(((CandleEntry)mYVals.get(i)).copy());
  }
  CandleDataSet copied=new CandleDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mShadowWidth=mShadowWidth;
  copied.mBodySpace=mBodySpace;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<CandleEntry> copy(){
  ArrayList<CandleEntry> yVals=new ArrayList<CandleEntry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(((CandleEntry)mYVals.get(i)).copy());
  }
  CandleDataSet copied=new CandleDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mShadowWidth=mShadowWidth;
  copied.mBodySpace=mBodySpace;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}
Program: 18802
Project: 18802
Buggy source:
/** 
 * Provides an exact copy of the DataSet this method is used on.
 * @return
 */
public abstract DataSet copy();

Fixed version (ground truth):
/** 
 * Provides an exact copy of the DataSet this method is used on.
 * @return
 */
public abstract DataSet<T> copy();
Program: 18803
Project: 18803
Buggy source:
@Override public DataSet copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  LineDataSet copied=new LineDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mCircleSize=mCircleSize;
  copied.mCircleColors=mCircleColors;
  copied.mDashPathEffect=mDashPathEffect;
  copied.mDrawCircles=mDrawCircles;
  copied.mDrawCubic=mDrawCubic;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<Entry> copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  LineDataSet copied=new LineDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mCircleSize=mCircleSize;
  copied.mCircleColors=mCircleColors;
  copied.mDashPathEffect=mDashPathEffect;
  copied.mDrawCircles=mDrawCircles;
  copied.mDrawCubic=mDrawCubic;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}
Program: 18804
Project: 18804
Buggy source:
@Override public DataSet copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  PieDataSet copied=new PieDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mSliceSpace=mSliceSpace;
  copied.mShift=mShift;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<Entry> copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  PieDataSet copied=new PieDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mSliceSpace=mSliceSpace;
  copied.mShift=mShift;
  return copied;
}
Program: 18805
Project: 18805
Buggy source:
@Override public DataSet copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  RadarDataSet copied=new RadarDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<Entry> copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  RadarDataSet copied=new RadarDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}
Program: 18806
Project: 18806
Buggy source:
@Override public DataSet copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  ScatterDataSet copied=new ScatterDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mShapeSize=mShapeSize;
  copied.mScatterShape=mScatterShape;
  copied.mCustomScatterPath=mCustomScatterPath;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}

Fixed version (ground truth):
@Override public DataSet<Entry> copy(){
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mYVals.size(); i++) {
    yVals.add(mYVals.get(i).copy());
  }
  ScatterDataSet copied=new ScatterDataSet(yVals,getLabel());
  copied.mColors=mColors;
  copied.mShapeSize=mShapeSize;
  copied.mScatterShape=mScatterShape;
  copied.mCustomScatterPath=mCustomScatterPath;
  copied.mHighLightColor=mHighLightColor;
  return copied;
}
Program: 18808
Project: 18808
Buggy source:
/** 
 * enable this to force the y-axis labels to always start at zero
 * @param enabled
 */
public void setStartAtZero(boolean enabled){
  this.mStartAtZero=enabled;
  prepare();
  prepareMatrix();
  calculateOffsets();
}

Fixed version (ground truth):
/** 
 * enable this to force the y-axis labels to always start at zero
 * @param enabled
 */
public void setStartAtZero(boolean enabled){
  this.mStartAtZero=enabled;
  prepare();
  prepareMatrix();
}
Program: 18809
Project: 18809
Buggy source:
@Override protected void calculateOffsets(){
  if (mLegend == null)   return;
  if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART) {
    mLegend.setOffsetRight(mLegend.getMaximumEntryLength(mLegendLabelPaint));
    mLegendLabelPaint.setTextAlign(Align.LEFT);
  }
 else   if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
    mLegend.setOffsetBottom(mLegendLabelPaint.getTextSize() * 4f);
  }
  if (mDrawLegend) {
    mOffsetBottom=Math.max(mOffsetBottom,mLegend.getOffsetBottom());
    mOffsetRight=Math.max(mOffsetRight,mLegend.getOffsetRight() / 3 * 2);
  }
  mLegend.setOffsetTop(mOffsetTop);
  mLegend.setOffsetLeft(mOffsetLeft);
  applyCalculatedOffsets();
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  if (mDrawLegend) {
    float legendRight=0f, legendBottom=0f;
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART) {
      float spacing=Utils.convertDpToPixel(7f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 4f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
    float min=Utils.convertDpToPixel(11f);
    mLegend.setOffsetTop(min);
    mLegend.setOffsetLeft(min);
    mOffsetTop=Math.max(mLegend.getFullHeight(mLegendLabelPaint),min);
    applyCalculatedOffsets();
  }
}
Program: 18810
Project: 18810
Buggy source:
@Override public void prepare(){
  if (mDataNotSet)   return;
  calcMinMax(false);
  prepareLegend();
}

Fixed version (ground truth):
@Override public void prepare(){
  if (mDataNotSet)   return;
  calcMinMax(false);
  prepareLegend();
  calculateOffsets();
}
Program: 18811
Project: 18811
Buggy source:
@Override protected void calculateOffsets(){
  if (mLegend == null)   return;
  if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART) {
    mLegend.setOffsetRight(mLegend.getMaximumEntryLength(mLegendLabelPaint));
    mLegendLabelPaint.setTextAlign(Align.LEFT);
  }
 else   if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
    mLegend.setOffsetBottom(mLegendLabelPaint.getTextSize() * 5.5f);
  }
  mLegend.setOffsetTop(mOffsetTop);
  mLegend.setOffsetLeft(mOffsetLeft);
  if (mDrawLegend) {
    mOffsetBottom=Math.max(mXLabels.mLabelWidth,mOffsetBottom);
    mOffsetTop=Math.max(mXLabels.mLabelWidth,mOffsetTop);
    mOffsetRight=Math.max(mXLabels.mLabelWidth,mOffsetRight);
    mOffsetLeft=Math.max(mXLabels.mLabelWidth,mOffsetLeft);
    mOffsetBottom=Math.max(mOffsetBottom,mLegend.getOffsetBottom());
    mOffsetRight=Math.max(mOffsetRight,mLegend.getOffsetRight() / 3 * 2);
  }
  applyCalculatedOffsets();
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  if (mDrawLegend) {
    float legendRight=0f, legendBottom=0f;
    if (mLegend == null)     return;
    if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART) {
      float spacing=Utils.convertDpToPixel(7f);
      legendRight=mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace()+ spacing;
      mLegendLabelPaint.setTextAlign(Align.LEFT);
    }
 else     if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) {
      legendBottom=mLegendLabelPaint.getTextSize() * 5.5f;
    }
    mLegend.setOffsetBottom(legendBottom);
    mLegend.setOffsetRight(legendRight);
    float min=Utils.convertDpToPixel(11f);
    mOffsetBottom=Math.max(mXLabels.mLabelWidth,min);
    mOffsetTop=Math.max(mXLabels.mLabelWidth,min);
    mOffsetRight=Math.max(mXLabels.mLabelWidth,min);
    mOffsetLeft=Math.max(mXLabels.mLabelWidth,min);
    mOffsetBottom=Math.max(mOffsetBottom,legendBottom);
    mOffsetRight=Math.max(mOffsetRight,legendRight / 3f * 2f);
    mLegend.setOffsetTop(min);
    mLegend.setOffsetLeft(min);
    applyCalculatedOffsets();
  }
}
Program: 18812
Project: 18812
Buggy source:
/** 
 * calculates the full width the fully drawn legend will use in pixels
 * @return
 */
public float getFullWidth(Paint labelpaint){
  float width=0f;
  for (int i=0; i < mLegendLabels.length; i++) {
    if (mLegendLabels[i] != null) {
      if (mColors[i] != -1)       width+=mFormSize + mFormToTextSpace;
      width+=Utils.calcTextWidth(labelpaint,mLegendLabels[i]) + mXEntrySpace;
    }
 else {
      width+=mFormSize + mStackSpace;
    }
  }
  return width;
}

Fixed version (ground truth):
/** 
 * calculates the full width the fully drawn legend will use in pixels
 * @return
 */
public float getFullWidth(Paint labelpaint){
  float width=0f;
  for (int i=0; i < mLegendLabels.length; i++) {
    if (mLegendLabels[i] != null) {
      if (mColors[i] != -2)       width+=mFormSize + mFormToTextSpace;
      width+=Utils.calcTextWidth(labelpaint,mLegendLabels[i]) + mXEntrySpace;
    }
 else {
      width+=mFormSize + mStackSpace;
    }
  }
  return width;
}
Program: 18814
Project: 18814
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(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(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  mChart.setData(data);
}
Program: 18815
Project: 18815
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_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(false);
  mChart.setDrawYValues(false);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragScaleEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(45,100);
  mChart.animateX(2500);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  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_linechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setStartAtZero(false);
  mChart.setDrawYValues(false);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragScaleEnabled(true);
  mChart.setPinchZoom(true);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mv.setOffsets(-mv.getMeasuredWidth() / 2,-mv.getMeasuredHeight());
  mChart.setMarkerView(mv);
  mChart.setHighlightIndicatorEnabled(false);
  setData(45,100);
  mChart.animateX(2500);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
}
Program: 18816
Project: 18816
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_candlechart);
  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=(CandleStickChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawGridBackground(false);
  XLabels xLabels=mChart.getXLabels();
  xLabels.setPosition(XLabelPosition.BOTTOM);
  xLabels.setCenterXLabelText(true);
  xLabels.setSpaceBetweenLabels(2);
  YLabels yLabels=mChart.getYLabels();
  yLabels.setLabelCount(7);
  yLabels.setPosition(YLabelPosition.RIGHT_INSIDE);
  mChart.setDrawYLabels(true);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(15);
  mSeekBarY.setProgress(100);
}

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_candlechart);
  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=(CandleStickChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawGridBackground(false);
  XLabels xLabels=mChart.getXLabels();
  xLabels.setPosition(XLabelPosition.BOTTOM);
  xLabels.setCenterXLabelText(true);
  xLabels.setSpaceBetweenLabels(2);
  YLabels yLabels=mChart.getYLabels();
  yLabels.setLabelCount(7);
  yLabels.setPosition(YLabelPosition.LEFT);
  mChart.setDrawYLabels(true);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(15);
  mSeekBarY.setProgress(100);
}
Program: 18817
Project: 18817
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_linechart_noseekbar);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawYValues(false);
  mChart.setDrawGridBackground(false);
  mChart.setDescription("String_Node_Str");
  String[] xVals=new String[30];
  for (int i=0; i < 30; i++)   xVals[i]="String_Node_Str" + i;
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < 10; i++)   yVals.add(new Entry((float)(Math.random() * 50) + 50f,i));
  LineDataSet set=new LineDataSet(yVals,"String_Node_Str");
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  set.setColor(Color.rgb(240,99,99));
  set.setCircleColor(Color.rgb(240,99,99));
  set.setHighLightColor(Color.rgb(190,190,190));
  mData=new LineData(xVals,set);
  mChart.setData(mData);
  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_linechart_noseekbar);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawYValues(false);
  mChart.setDrawGridBackground(false);
  mChart.setDescription("String_Node_Str");
  String[] xVals=new String[30];
  for (int i=0; i < 30; i++)   xVals[i]="String_Node_Str" + i;
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < 10; i++)   yVals.add(new Entry((float)(Math.random() * 50) + 50f,i));
  LineDataSet set=new LineDataSet(yVals,"String_Node_Str");
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  set.setColor(Color.rgb(240,99,99));
  set.setCircleColor(Color.rgb(240,99,99));
  set.setHighLightColor(Color.rgb(190,190,190));
  LineData data=new LineData(xVals,set);
  mChart.setData(data);
  mChart.invalidate();
}
Program: 18818
Project: 18818
Buggy source:
private void removeDataSet(){
  mData.removeDataSet(mData.getDataSetByIndex(mData.getDataSetCount() - 1));
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}

Fixed version (ground truth):
private void removeDataSet(){
  LineData data=mChart.getDataOriginal();
  data.removeDataSet(data.getDataSetByIndex(data.getDataSetCount() - 1));
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}
Program: 18819
Project: 18819
Buggy source:
private void addEntry(){
  LineDataSet set=mData.getDataSetByIndex(0);
  mData.addEntry(new Entry((float)(Math.random() * 50) + 50f,set.getEntryCount()),0);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}

Fixed version (ground truth):
private void addEntry(){
  LineData data=mChart.getDataOriginal();
  LineDataSet set=data.getDataSetByIndex(0);
  data.addEntry(new Entry((float)(Math.random() * 50) + 50f,set.getEntryCount()),0);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}
Program: 18820
Project: 18820
Buggy source:
private void removeLastEntry(){
  LineDataSet set=mData.getDataSetByIndex(0);
  Entry e=set.getEntryForXIndex(set.getEntryCount() - 1);
  mData.removeEntry(e,0);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}

Fixed version (ground truth):
private void removeLastEntry(){
  LineData data=mChart.getDataOriginal();
  LineDataSet set=data.getDataSetByIndex(0);
  Entry e=set.getEntryForXIndex(set.getEntryCount() - 1);
  data.removeEntry(e,0);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}
Program: 18821
Project: 18821
Buggy source:
private void addDataSet(){
  int count=(mData.getDataSetCount() + 1);
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < mData.getXValCount(); i++)   yVals.add(new Entry((float)(Math.random() * 50f) + 50f * count,i));
  LineDataSet set=new LineDataSet(yVals,"String_Node_Str" + count);
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  int color=getResources().getColor(mColors[count % mColors.length]);
  set.setColor(color);
  set.setCircleColor(color);
  set.setHighLightColor(color);
  mData.addDataSet(set);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}

Fixed version (ground truth):
private void addDataSet(){
  LineData data=mChart.getDataOriginal();
  int count=(data.getDataSetCount() + 1);
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < data.getXValCount(); i++)   yVals.add(new Entry((float)(Math.random() * 50f) + 50f * count,i));
  LineDataSet set=new LineDataSet(yVals,"String_Node_Str" + count);
  set.setLineWidth(2.5f);
  set.setCircleSize(4.5f);
  int color=getResources().getColor(mColors[count % mColors.length]);
  set.setColor(color);
  set.setCircleColor(color);
  set.setHighLightColor(color);
  data.addDataSet(set);
  mChart.notifyDataSetChanged();
  mChart.invalidate();
}
Program: 18822
Project: 18822
Buggy source:
@Override protected void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  BarData bd=(BarData)mCurrentData;
  int step=mCurrentData.getDataSetCount();
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i * step + i * bd.getGroupSpace() + bd.getGroupSpace() / 2f;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=(step / 2f);
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight) {
      String label=mCurrentData.getXVals().get(i);
      if (mXLabels.isAvoidFirstLastClippingEnabled()) {
        if (i == mCurrentData.getXValCount() - 1) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          if (width > getOffsetRight() * 2 && position[0] + width > getWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          position[0]+=width / 2;
        }
      }
      mDrawCanvas.drawText(label,position[0],yPos,mXLabelPaint);
    }
  }
}

Fixed version (ground truth):
@Override protected void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  int step=mCurrentData.getDataSetCount();
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i * step + i * mOriginalData.getGroupSpace() + mOriginalData.getGroupSpace() / 2f;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=(step / 2f);
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight) {
      String label=mCurrentData.getXVals().get(i);
      if (mXLabels.isAvoidFirstLastClippingEnabled()) {
        if (i == mCurrentData.getXValCount() - 1) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          if (width > getOffsetRight() * 2 && position[0] + width > getWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mXLabelPaint,label);
          position[0]+=width / 2;
        }
      }
      mDrawCanvas.drawText(label,position[0],yPos,mXLabelPaint);
    }
  }
}
Program: 18823
Project: 18823
Buggy source:
/** 
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the BarChart.
 * @param x
 * @param y
 * @return
 */
@Override public Highlight getHighlightByTouchPoint(float x,float y){
  if (mDataNotSet || mCurrentData == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return null;
  }
  float[] pts=new float[2];
  pts[0]=x;
  pts[1]=y;
  Matrix tmp=new Matrix();
  mMatrixOffset.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixTouch.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixValueToPx.invert(tmp);
  tmp.mapPoints(pts);
  double xTouchVal=pts[0];
  double base=xTouchVal;
  if (xTouchVal < 0 || xTouchVal > mDeltaX)   return null;
  if (base < 0)   base=0;
  if (base >= mDeltaX)   base=mDeltaX - 1;
  int setCount=mOriginalData.getDataSetCount();
  int valCount=setCount * mOriginalData.getXValCount();
  BarData bd=(BarData)mCurrentData;
  float space=(float)(((float)valCount / (float)setCount) / (mDeltaX / base));
  float reduction=(float)space * bd.getGroupSpace();
  int xIndex=(int)((base - reduction) / setCount);
  int dataSetIndex=((int)(base - reduction)) % setCount;
  if (dataSetIndex == -1)   return null;
  return new Highlight(xIndex,dataSetIndex);
}

Fixed version (ground truth):
/** 
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the BarChart.
 * @param x
 * @param y
 * @return
 */
@Override public Highlight getHighlightByTouchPoint(float x,float y){
  if (mDataNotSet || mCurrentData == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return null;
  }
  float[] pts=new float[2];
  pts[0]=x;
  pts[1]=y;
  Matrix tmp=new Matrix();
  mMatrixOffset.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixTouch.invert(tmp);
  tmp.mapPoints(pts);
  mMatrixValueToPx.invert(tmp);
  tmp.mapPoints(pts);
  double xTouchVal=pts[0];
  double base=xTouchVal;
  if (xTouchVal < 0 || xTouchVal > mDeltaX)   return null;
  if (base < 0)   base=0;
  if (base >= mDeltaX)   base=mDeltaX - 1;
  int setCount=mOriginalData.getDataSetCount();
  int valCount=setCount * mOriginalData.getXValCount();
  float space=(float)(((float)valCount / (float)setCount) / (mDeltaX / base));
  float reduction=(float)space * mOriginalData.getGroupSpace();
  int xIndex=(int)((base - reduction) / setCount);
  int dataSetIndex=((int)(base - reduction)) % setCount;
  if (dataSetIndex == -1)   return null;
  return new Highlight(xIndex,dataSetIndex);
}
Program: 18824
Project: 18824
Buggy source:
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  mDeltaX++;
  mDeltaX*=mOriginalData.getDataSetCount();
  int maxEntry=0;
  for (int i=0; i < mOriginalData.getDataSetCount(); i++) {
    DataSet<? extends Entry> set=mOriginalData.getDataSetByIndex(i);
    if (maxEntry < set.getEntryCount())     maxEntry=set.getEntryCount();
  }
  float groupSpace=((BarData)mOriginalData).getGroupSpace();
  mDeltaX+=maxEntry * groupSpace;
}

Fixed version (ground truth):
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  mDeltaX++;
  mDeltaX*=mOriginalData.getDataSetCount();
  int maxEntry=0;
  for (int i=0; i < mOriginalData.getDataSetCount(); i++) {
    DataSet<? extends Entry> set=mOriginalData.getDataSetByIndex(i);
    if (maxEntry < set.getEntryCount())     maxEntry=set.getEntryCount();
  }
  float groupSpace=mOriginalData.getGroupSpace();
  mDeltaX+=maxEntry * groupSpace;
}
Program: 18825
Project: 18825
Buggy source:
@Override protected void drawHighlights(){
  BarData bd=(BarData)mOriginalData;
  int setCount=mOriginalData.getDataSetCount();
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    Highlight h=mIndicesToHightlight[i];
    int index=h.getXIndex();
    int dataSetIndex=h.getDataSetIndex();
    BarDataSet ds=(BarDataSet)mCurrentData.getDataSetByIndex(dataSetIndex);
    mHighlightPaint.setColor(ds.getHighLightColor());
    mHighlightPaint.setAlpha(ds.getHighLightAlpha());
    if (index < mCurrentData.getYValCount() && index >= 0 && index < (mDeltaX * mPhaseX) / mOriginalData.getDataSetCount()) {
      Entry e=getEntryByDataSetIndex(index,dataSetIndex);
      if (e == null)       continue;
      float x=index * setCount + dataSetIndex + bd.getGroupSpace() / 2f + bd.getGroupSpace() * index;
      float y=e.getVal();
      prepareBar(x,y,ds.getBarSpace());
      mDrawCanvas.drawRect(mBarRect,mHighlightPaint);
      if (mDrawHighlightArrow) {
        mHighlightPaint.setAlpha(255);
        float offsetY=mDeltaY * 0.07f;
        Path arrow=new Path();
        arrow.moveTo(x + 0.5f,y + offsetY * 0.3f);
        arrow.lineTo(x + 0.2f,y + offsetY);
        arrow.lineTo(x + 0.8f,y + offsetY);
        transformPath(arrow);
        mDrawCanvas.drawPath(arrow,mHighlightPaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void drawHighlights(){
  int setCount=mOriginalData.getDataSetCount();
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    Highlight h=mIndicesToHightlight[i];
    int index=h.getXIndex();
    int dataSetIndex=h.getDataSetIndex();
    BarDataSet ds=(BarDataSet)mCurrentData.getDataSetByIndex(dataSetIndex);
    mHighlightPaint.setColor(ds.getHighLightColor());
    mHighlightPaint.setAlpha(ds.getHighLightAlpha());
    if (index < mCurrentData.getYValCount() && index >= 0 && index < (mDeltaX * mPhaseX) / mOriginalData.getDataSetCount()) {
      Entry e=getEntryByDataSetIndex(index,dataSetIndex);
      if (e == null)       continue;
      float x=index * setCount + dataSetIndex + mOriginalData.getGroupSpace() / 2f + mOriginalData.getGroupSpace() * index;
      float y=e.getVal();
      prepareBar(x,y,ds.getBarSpace());
      mDrawCanvas.drawRect(mBarRect,mHighlightPaint);
      if (mDrawHighlightArrow) {
        mHighlightPaint.setAlpha(255);
        float offsetY=mDeltaY * 0.07f;
        Path arrow=new Path();
        arrow.moveTo(x + 0.5f,y + offsetY * 0.3f);
        arrow.lineTo(x + 0.2f,y + offsetY);
        arrow.lineTo(x + 0.8f,y + offsetY);
        transformPath(arrow);
        mDrawCanvas.drawPath(arrow,mHighlightPaint);
      }
    }
  }
}
Program: 18827
Project: 18827
Buggy source:
@Override protected void drawVerticalGrid(){
  if (!mDrawVerticalGrid || mCurrentData == null)   return;
  float[] position=new float[]{0f,0f};
  BarData bd=(BarData)mCurrentData;
  int step=mCurrentData.getDataSetCount();
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i * step + i * bd.getGroupSpace();
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth()) {
      mDrawCanvas.drawLine(position[0],mOffsetTop,position[0],getHeight() - mOffsetBottom,mGridPaint);
    }
  }
}

Fixed version (ground truth):
@Override protected void drawVerticalGrid(){
  if (!mDrawVerticalGrid || mCurrentData == null)   return;
  float[] position=new float[]{0f,0f};
  int step=mCurrentData.getDataSetCount();
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i * step + i * mOriginalData.getGroupSpace();
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth()) {
      mDrawCanvas.drawLine(position[0],mOffsetTop,position[0],getHeight() - mOffsetBottom,mGridPaint);
    }
  }
}
Program: 18828
Project: 18828
Buggy source:
/** 
 * returns the filtered ChartData object depending on approximator settings, current scale level and x- and y-axis ratio
 * @return
 */
private ChartData<? extends DataSet<? extends Entry>> getFilteredData(){
  return null;
}

Fixed version (ground truth):
/** 
 * returns the filtered ChartData object depending on approximator settings, current scale level and x- and y-axis ratio
 * @return
 */
private T getFilteredData(){
  return null;
}
Program: 18829
Project: 18829
Buggy source:
/** 
 * Draws the limit lines if there are one.
 */
private void drawLimitLines(){
  ArrayList<LimitLine> limitLines=((BarLineScatterCandleRadarData<? extends DataSet<? extends Entry>>)mOriginalData).getLimitLines();
  if (limitLines == null)   return;
  float[] pts=new float[]{0,0,0,0};
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[0]=0f;
    pts[1]=l.getLimit();
    pts[2]=mDeltaX;
    pts[3]=l.getLimit();
    transformPointArray(pts);
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    mDrawCanvas.drawLine(pts[0],pts[1],pts[2],pts[3],mLimitLinePaint);
  }
}

Fixed version (ground truth):
/** 
 * Draws the limit lines if there are one.
 */
private void drawLimitLines(){
  ArrayList<LimitLine> limitLines=mOriginalData.getLimitLines();
  if (limitLines == null)   return;
  float[] pts=new float[]{0,0,0,0};
  for (int i=0; i < limitLines.size(); i++) {
    LimitLine l=limitLines.get(i);
    pts[0]=0f;
    pts[1]=l.getLimit();
    pts[2]=mDeltaX;
    pts[3]=l.getLimit();
    transformPointArray(pts);
    mLimitLinePaint.setColor(l.getLineColor());
    mLimitLinePaint.setPathEffect(l.getDashPathEffect());
    mLimitLinePaint.setStrokeWidth(l.getLineWidth());
    mDrawCanvas.drawLine(pts[0],pts[1],pts[2],pts[3],mLimitLinePaint);
  }
}
Program: 18830
Project: 18830
Buggy source:
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=((CandleData)mCurrentData).getDataSets();
  float[] shadowPoints=new float[4];
  float[] bodyPoints=new float[4];
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<CandleEntry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getShadowWidth());
    for (int j=0; j < entries.size() * mPhaseX; j++) {
      mRenderPaint.setColor(dataSet.getColor(j));
      CandleEntry e=entries.get(j);
      transformShadow(shadowPoints,e);
      transformBody(bodyPoints,e,dataSet.getBodySpace());
      float xShadow=shadowPoints[0];
      float leftBody=bodyPoints[0];
      float rightBody=bodyPoints[2];
      float high=shadowPoints[1];
      float low=shadowPoints[3];
      float open=bodyPoints[1];
      float close=bodyPoints[3];
      if (isOffContentRight(leftBody))       break;
      if (isOffContentLeft(rightBody) && isOffContentTop(low) && isOffContentBottom(high))       continue;
      mDrawCanvas.drawLine(xShadow,low,xShadow,high,mRenderPaint);
      if (open > close) {
        mRenderPaint.setStyle(Paint.Style.FILL);
        mDrawCanvas.drawRect(leftBody,close,rightBody,open,mRenderPaint);
      }
 else {
        mRenderPaint.setStyle(Paint.Style.STROKE);
        mDrawCanvas.drawRect(leftBody,open,rightBody,close,mRenderPaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=mCurrentData.getDataSets();
  float[] shadowPoints=new float[4];
  float[] bodyPoints=new float[4];
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<CandleEntry> entries=dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getShadowWidth());
    for (int j=0; j < entries.size() * mPhaseX; j++) {
      mRenderPaint.setColor(dataSet.getColor(j));
      CandleEntry e=entries.get(j);
      transformShadow(shadowPoints,e);
      transformBody(bodyPoints,e,dataSet.getBodySpace());
      float xShadow=shadowPoints[0];
      float leftBody=bodyPoints[0];
      float rightBody=bodyPoints[2];
      float high=shadowPoints[1];
      float low=shadowPoints[3];
      float open=bodyPoints[1];
      float close=bodyPoints[3];
      if (isOffContentRight(leftBody))       break;
      if (isOffContentLeft(rightBody) && isOffContentTop(low) && isOffContentBottom(high))       continue;
      mDrawCanvas.drawLine(xShadow,low,xShadow,high,mRenderPaint);
      if (open > close) {
        mRenderPaint.setStyle(Paint.Style.FILL);
        mDrawCanvas.drawRect(leftBody,close,rightBody,open,mRenderPaint);
      }
 else {
        mRenderPaint.setStyle(Paint.Style.STROKE);
        mDrawCanvas.drawRect(leftBody,open,rightBody,close,mRenderPaint);
      }
    }
  }
}
Program: 18831
Project: 18831
Buggy source:
@Override protected void drawHighlights(){
  CandleData cd=(CandleData)mCurrentData;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    CandleDataSet set=cd.getDataSetByIndex(mIndicesToHightlight[i].getDataSetIndex());
    mHighlightPaint.setColor(set.getHighLightColor());
    CandleEntry e=set.getEntryForXIndex(xIndex);
    if (e == null)     continue;
    float low=e.getLow() * mPhaseY;
    float high=e.getHigh() * mPhaseY;
    float[] vertPts=new float[]{xIndex,mYChartMax,xIndex,mYChartMin,xIndex + 1f,mYChartMax,xIndex + 1f,mYChartMin};
    float[] horPts=new float[]{0,low,mDeltaX,low,0,high,mDeltaX,high};
    transformPointArray(vertPts);
    transformPointArray(horPts);
    mDrawCanvas.drawLines(vertPts,mHighlightPaint);
    mDrawCanvas.drawLines(horPts,mHighlightPaint);
  }
}

Fixed version (ground truth):
@Override protected void drawHighlights(){
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    CandleDataSet set=mOriginalData.getDataSetByIndex(mIndicesToHightlight[i].getDataSetIndex());
    mHighlightPaint.setColor(set.getHighLightColor());
    CandleEntry e=set.getEntryForXIndex(xIndex);
    if (e == null)     continue;
    float low=e.getLow() * mPhaseY;
    float high=e.getHigh() * mPhaseY;
    float[] vertPts=new float[]{xIndex,mYChartMax,xIndex,mYChartMin,xIndex + 1f,mYChartMax,xIndex + 1f,mYChartMin};
    float[] horPts=new float[]{0,low,mDeltaX,low,0,high,mDeltaX,high};
    transformPointArray(vertPts);
    transformPointArray(horPts);
    mDrawCanvas.drawLines(vertPts,mHighlightPaint);
    mDrawCanvas.drawLines(horPts,mHighlightPaint);
  }
}