nus-yam/ex-repair huggingface dataset:
Program: 26479
Project: 26479
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_barchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setPinchZoom(false);
  mChart.setDrawBarShadow(false);
  mChart.setDrawGridBackground(false);
  MyMarkerView mv=new MyMarkerView(this,R.layout.custom_marker_view);
  mChart.setMarkerView(mv);
  mSeekBarX.setProgress(10);
  mSeekBarY.setProgress(100);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART_INSIDE);
  l.setTypeface(tf);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setValueFormatter(new LargeValueFormatter());
  leftAxis.setDrawGridLines(false);
  leftAxis.setSpaceTop(25f);
  mChart.getAxisRight().setEnabled(false);
}

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

Fixed version (ground truth):
@Override public boolean onDoubleTap(MotionEvent e){
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  if (l != null) {
    l.onChartDoubleTapped(e);
    return super.onDoubleTap(e);
  }
  if (mChart.isDoubleTapToZoomEnabled()) {
    PointF trans=getTrans(e.getX(),e.getY());
    mChart.zoom(mChart.isScaleXEnabled() ? 1.4f : 1f,mChart.isScaleYEnabled() ? 1.4f : 1f,trans.x,trans.y);
    if (mChart.isLogEnabled())     Log.i("String_Node_Str","String_Node_Str" + trans.x + "String_Node_Str"+ trans.y);
  }
  return super.onDoubleTap(e);
}
Program: 26481
Project: 26481
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex(),high);
    }
  }
}

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

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

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

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

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

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

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  for (int i=0; i < indices.length; i++) {
    ScatterDataSet set=mChart.getScatterData().getDataSetByIndex(indices[i].getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())     continue;
    mHighlightPaint.setColor(set.getHighLightColor());
    int xIndex=indices[i].getXIndex();
    if (xIndex > mChart.getXChartMax() * mAnimator.getPhaseX())     continue;
    float yValue=set.getYValForXIndex(xIndex);
    if (yValue == Float.NaN)     continue;
    float y=yValue * mAnimator.getPhaseY();
    float[] pts=new float[]{xIndex,mChart.getYChartMax(),xIndex,mChart.getYChartMin(),0,y,mChart.getXChartMax(),y};
    mChart.getTransformer(set.getAxisDependency()).pointValuesToPixel(pts);
    c.drawLines(pts,mHighlightPaint);
  }
}
Program: 26490
Project: 26490
Buggy source:
public YAxis(AxisDependency position){
  super();
  this.mAxisDependency=position;
}

Fixed version (ground truth):
public YAxis(AxisDependency position){
  super();
  this.mAxisDependency=position;
  this.mYOffset=0f;
}
Program: 26491
Project: 26491
Buggy source:
/** 
 * draws the y-axis labels to the screen
 */
@Override public void renderAxisLabels(Canvas c){
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())   return;
  float[] positions=new float[mYAxis.mEntryCount * 2];
  for (int i=0; i < positions.length; i+=2) {
    positions[i + 1]=mYAxis.mEntries[i / 2];
  }
  mTrans.pointValuesToPixel(positions);
  mAxisLabelPaint.setTypeface(mYAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mYAxis.getTextSize());
  mAxisLabelPaint.setColor(mYAxis.getTextColor());
  float xoffset=mYAxis.getXOffset();
  float yoffset=Utils.calcTextHeight(mAxisLabelPaint,"String_Node_Str") / 2.5f;
  AxisDependency dependency=mYAxis.getAxisDependency();
  YAxisLabelPosition labelPosition=mYAxis.getLabelPosition();
  float xPos=0f;
  if (dependency == AxisDependency.LEFT) {
    if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) {
      mAxisLabelPaint.setTextAlign(Align.RIGHT);
      xPos=mViewPortHandler.offsetLeft() - xoffset;
    }
 else {
      mAxisLabelPaint.setTextAlign(Align.LEFT);
      xPos=mViewPortHandler.offsetLeft() + xoffset;
    }
  }
 else {
    if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) {
      mAxisLabelPaint.setTextAlign(Align.LEFT);
      xPos=mViewPortHandler.contentRight() + xoffset;
    }
 else {
      mAxisLabelPaint.setTextAlign(Align.RIGHT);
      xPos=mViewPortHandler.contentRight() - xoffset;
    }
  }
  drawYLabels(c,xPos,positions,yoffset);
}

Fixed version (ground truth):
/** 
 * draws the y-axis labels to the screen
 */
@Override public void renderAxisLabels(Canvas c){
  if (!mYAxis.isEnabled() || !mYAxis.isDrawLabelsEnabled())   return;
  float[] positions=new float[mYAxis.mEntryCount * 2];
  for (int i=0; i < positions.length; i+=2) {
    positions[i + 1]=mYAxis.mEntries[i / 2];
  }
  mTrans.pointValuesToPixel(positions);
  mAxisLabelPaint.setTypeface(mYAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mYAxis.getTextSize());
  mAxisLabelPaint.setColor(mYAxis.getTextColor());
  float xoffset=mYAxis.getXOffset();
  float yoffset=Utils.calcTextHeight(mAxisLabelPaint,"String_Node_Str") / 2.5f + mYAxis.getYOffset();
  AxisDependency dependency=mYAxis.getAxisDependency();
  YAxisLabelPosition labelPosition=mYAxis.getLabelPosition();
  float xPos=0f;
  if (dependency == AxisDependency.LEFT) {
    if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) {
      mAxisLabelPaint.setTextAlign(Align.RIGHT);
      xPos=mViewPortHandler.offsetLeft() - xoffset;
    }
 else {
      mAxisLabelPaint.setTextAlign(Align.LEFT);
      xPos=mViewPortHandler.offsetLeft() + xoffset;
    }
  }
 else {
    if (labelPosition == YAxisLabelPosition.OUTSIDE_CHART) {
      mAxisLabelPaint.setTextAlign(Align.LEFT);
      xPos=mViewPortHandler.contentRight() + xoffset;
    }
 else {
      mAxisLabelPaint.setTextAlign(Align.RIGHT);
      xPos=mViewPortHandler.contentRight() - xoffset;
    }
  }
  drawYLabels(c,xPos,positions,yoffset);
}
Program: 26492
Project: 26492
Buggy source:
@Override public void renderGridLines(Canvas c){
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] position=new float[]{0f,0f};
  mGridPaint.setColor(mXAxis.getGridColor());
  mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
  mGridPaint.setPathEffect(mXAxis.getGridDashPathEffect());
  for (int i=mMinX; i <= mMaxX; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (position[0] >= mViewPortHandler.offsetLeft() && position[0] <= mViewPortHandler.getChartWidth()) {
      c.drawLine(position[0],mViewPortHandler.offsetTop(),position[0],mViewPortHandler.contentBottom(),mGridPaint);
    }
  }
}

Fixed version (ground truth):
@Override public void renderGridLines(Canvas c){
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] position=new float[]{0f,0f};
  mGridPaint.setColor(mXAxis.getGridColor());
  mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
  mGridPaint.setPathEffect(mXAxis.getGridDashPathEffect());
  Path gridLinePath=new Path();
  for (int i=mMinX; i <= mMaxX; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (position[0] >= mViewPortHandler.offsetLeft() && position[0] <= mViewPortHandler.getChartWidth()) {
      gridLinePath.moveTo(position[0],mViewPortHandler.contentBottom());
      gridLinePath.lineTo(position[0],mViewPortHandler.contentTop());
      c.drawPath(gridLinePath,mGridPaint);
    }
    gridLinePath.reset();
  }
}
Program: 26495
Project: 26495
Buggy source:
/** 
 * Resets all zooming and dragging and makes the chart fit exactly it's bounds.
 */
public Matrix fitScreen(){
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  float[] vals=new float[9];
  save.getValues(vals);
  vals[Matrix.MTRANS_X]=0f;
  vals[Matrix.MTRANS_Y]=0f;
  vals[Matrix.MSCALE_X]=1f;
  vals[Matrix.MSCALE_Y]=1f;
  save.setValues(vals);
  return save;
}

Fixed version (ground truth):
/** 
 * Resets all zooming and dragging and makes the chart fit exactly it's bounds.
 */
public Matrix fitScreen(){
  mMinScaleX=1f;
  mMinScaleY=1f;
  Matrix save=new Matrix();
  save.set(mMatrixTouch);
  float[] vals=new float[9];
  save.getValues(vals);
  vals[Matrix.MTRANS_X]=0f;
  vals[Matrix.MTRANS_Y]=0f;
  vals[Matrix.MSCALE_X]=1f;
  vals[Matrix.MSCALE_Y]=1f;
  save.setValues(vals);
  return save;
}
Program: 26497
Project: 26497
Buggy source:
/** 
 * Calculates the total number of y-values across all DataSets the ChartData represents.
 * @return
 */
protected void calcYValueCount(List<? extends DataSet<?>> dataSets){
  mYValCount=0;
  if (dataSets == null)   return;
  int count=0;
  for (int i=0; i < dataSets.size(); i++) {
    count+=dataSets.get(i).getEntryCount();
  }
  mYValCount=count;
}

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

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

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

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

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

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

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

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

Fixed version (ground truth):
/** 
 * Sets the PieDataSet this data object should represent.
 * @param dataSet
 */
public void setDataSet(PieDataSet dataSet){
  mDataSets.clear();
  mDataSets.add(dataSet);
  init();
}
Program: 26508
Project: 26508
Buggy source:
@Override protected float getRequiredBaseOffset(){
  return mXAxis.mLabelWidth;
}

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

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

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

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

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

Fixed version (ground truth):
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the BUBBLECHART.
 * @param entries
 * @return
 */
public float[] generateTransformedValuesBubble(List<? extends Entry> entries,float phaseX,float phaseY,int from,int to){
  final int count=(int)Math.ceil(to - from) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    Entry e=entries.get(j / 2 + from);
    if (e != null) {
      valuePoints[j]=(float)(e.getXIndex() - from) * phaseX + from;
      valuePoints[j + 1]=e.getVal() * phaseY;
    }
  }
  pointValuesToPixel(valuePoints);
  return valuePoints;
}
Program: 26519
Project: 26519
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_realtime_linechart);
  mChart=(LineChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDescription("String_Node_Str");
  mChart.setNoDataTextDescription("String_Node_Str");
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setDrawGridBackground(false);
  mChart.setPinchZoom(true);
  mChart.setBackgroundColor(Color.LTGRAY);
  LineData data=new LineData();
  data.setValueTextColor(Color.WHITE);
  mChart.setData(data);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  l.setTypeface(tf);
  l.setTextColor(Color.WHITE);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(tf);
  xl.setTextColor(Color.WHITE);
  xl.setDrawGridLines(false);
  xl.setAvoidFirstLastClipping(true);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setTextColor(Color.WHITE);
  leftAxis.setAxisMaxValue(120f);
  leftAxis.setDrawGridLines(true);
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setEnabled(false);
}

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

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

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

Fixed version (ground truth):
/** 
 * Adds a new x-value to the chart data.
 * @param xVal
 */
public void addXValue(String xVal){
  mXValAverageLength=(mXValAverageLength + xVal.length()) / 2f;
  mXVals.add(xVal);
}