nus-yam/ex-repair huggingface dataset:
Program: 26972
Project: 26972
Buggy source:
@Override public boolean onSingleTapUp(MotionEvent e){
  float distance=mChart.distanceToCenter(e.getX(),e.getY());
  if (distance < mChart.getRadius() / 2 || distance > mChart.getRadius()) {
    mChart.highlightValues(null);
    mLastHighlight=null;
  }
 else {
    int index=mChart.getIndexForAngle(mChart.getAngleForPoint(e.getX(),e.getY()));
    int dataSetIndex=mChart.getDataSetIndexForIndex(index);
    Highlight h=new Highlight(index,0f,dataSetIndex);
    if (h.equalTo(mLastHighlight)) {
      mChart.highlightTouch(null);
      mLastHighlight=null;
    }
 else {
      mChart.highlightTouch(h);
      mLastHighlight=h;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onSingleTapUp(MotionEvent e){
  float distance=mChart.distanceToCenter(e.getX(),e.getY());
  if (distance < mChart.getRadius() / 2 || distance > mChart.getRadius()) {
    mChart.highlightValues(null);
    mLastHighlight=null;
  }
 else {
    int index=mChart.getIndexForAngle(mChart.getAngleForPoint(e.getX(),e.getY()));
    int dataSetIndex=mChart.getDataSetIndexForIndex(index);
    Highlight h=new Highlight(index,dataSetIndex);
    if (h.equalTo(mLastHighlight)) {
      mChart.highlightTouch(null);
      mLastHighlight=null;
    }
 else {
      mChart.highlightTouch(h);
      mLastHighlight=h;
    }
  }
  return true;
}
Program: 26973
Project: 26973
Buggy source:
/** 
 * constructor
 * @param x the index of the highlighted value on the x-axis
 * @param val the value at the position the user touched
 * @param dataSet the index of the DataSet the highlighted value belongs to
 */
public Highlight(int x,float val,int dataSet){
  this.mXIndex=x;
  this.mVal=val;
  this.mDataSetIndex=dataSet;
}

Fixed version (ground truth):
/** 
 * constructor
 * @param x the index of the highlighted value on the x-axis
 * @param val the value at the position the user touched
 * @param dataSet the index of the DataSet the highlighted value belongs to
 */
public Highlight(int x,int dataSet){
  this.mXIndex=x;
  this.mDataSetIndex=dataSet;
}
Program: 26974
Project: 26974
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.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawVerticalGrid(false);
  mChart.setDrawHorizontalGrid(false);
  mChart.setDrawGridBackground(false);
  XLabels xLabels=mChart.getXLabels();
  xLabels.setPosition(XLabelPosition.BOTTOM);
  xLabels.setCenterXLabelText(true);
  xLabels.setSpaceBetweenLabels(0);
  mChart.setDrawYLabels(false);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(10);
  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.setDrawYValues(false);
  mChart.setUnit("String_Node_Str");
  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);
  mChart.setDrawYLabels(true);
  mChart.setDrawLegend(false);
  mSeekBarX.setProgress(30);
  mSeekBarY.setProgress(100);
}
Program: 26975
Project: 26975
Buggy source:
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<CandleEntry> yVals1=new ArrayList<CandleEntry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.sin(i) * mult) + 100f;
    yVals1.add(new CandleEntry(i,val + 7,val - 7,val + 4,val - 4));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add((int)yVals1.get(i).getVal() + "String_Node_Str" + mChart.getUnit());
  }
  CandleDataSet set1=new CandleDataSet(yVals1,"String_Node_Str");
  set1.setColors(ColorTemplate.createColors(getApplicationContext(),ColorTemplate.VORDIPLOM_COLORS));
  CandleData data=new CandleData(xVals,set1);
  mChart.setData(data);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<CandleEntry> yVals1=new ArrayList<CandleEntry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.sin(i) * mult) + 400f;
    boolean even=i % 2 == 0;
    yVals1.add(new CandleEntry(i,even ? val + 10 : val - 10,even ? val - 10 : val + 10,even ? val + 5 : val - 5,even ? val - 5 : val + 5));
  }
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add("String_Node_Str" + (i + 1));
  }
  CandleDataSet set1=new CandleDataSet(yVals1,"String_Node_Str");
  set1.setColors(ColorTemplate.createColors(getApplicationContext(),ColorTemplate.VORDIPLOM_COLORS));
  CandleData data=new CandleData(xVals,set1);
  mChart.setData(data);
  mChart.invalidate();
}
Program: 26976
Project: 26976
Buggy source:
/** 
 * setup the x-axis labels
 */
protected void prepareXLabels(){
  StringBuffer a=new StringBuffer();
  for (int i=0; i < mCurrentData.getXValAverageLength() + mXLabels.getSpaceBetweenLabels(); i++) {
    a.append("String_Node_Str");
  }
  mXLabels.mXLabelWidth=Utils.calcTextWidth(mXLabelPaint,a.toString());
  mXLabels.mXLabelHeight=Utils.calcTextWidth(mXLabelPaint,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * setup the x-axis labels
 */
protected void prepareXLabels(){
  StringBuffer a=new StringBuffer();
  int max=(int)Math.round(mCurrentData.getXValAverageLength() + mXLabels.getSpaceBetweenLabels());
  for (int i=0; i < max; i++) {
    a.append("String_Node_Str");
  }
  mXLabels.mLabelWidth=Utils.calcTextWidth(mXLabelPaint,a.toString());
  mXLabels.mLabelHeight=Utils.calcTextWidth(mXLabelPaint,"String_Node_Str");
}
Program: 26977
Project: 26977
Buggy source:
/** 
 * calculates the modulus for x-labels and grid
 */
protected void calcModulus(){
  float[] values=new float[9];
  mMatrixTouch.getValues(values);
  mXLabels.mXAxisLabelModulus=(int)Math.ceil((mCurrentData.getXValCount() * mXLabels.mXLabelWidth) / (mContentRect.width() * values[Matrix.MSCALE_X]));
}

Fixed version (ground truth):
/** 
 * calculates the modulus for x-labels and grid
 */
protected void calcModulus(){
  float[] values=new float[9];
  mMatrixTouch.getValues(values);
  mXLabels.mXAxisLabelModulus=(int)Math.ceil((mCurrentData.getXValCount() * mXLabels.mLabelWidth) / (mContentRect.width() * values[Matrix.MSCALE_X]));
}
Program: 26978
Project: 26978
Buggy source:
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=(ArrayList<CandleDataSet>)mCurrentData.getDataSets();
  mRenderPaint.setStyle(Paint.Style.FILL);
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<CandleEntry> entries=(ArrayList<CandleEntry>)dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getShadowWidth());
    float[] shadowPoints=new float[4];
    float[] bodyPoints=new float[4];
    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);
      mDrawCanvas.drawRect(leftBody,open,rightBody,close,mRenderPaint);
    }
  }
}

Fixed version (ground truth):
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=(ArrayList<CandleDataSet>)mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<CandleEntry> entries=(ArrayList<CandleEntry>)dataSet.getYVals();
    mRenderPaint.setStrokeWidth(dataSet.getShadowWidth());
    float[] shadowPoints=new float[4];
    float[] bodyPoints=new float[4];
    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);
 else       mRenderPaint.setStyle(Paint.Style.STROKE);
      mDrawCanvas.drawRect(leftBody,open,rightBody,close,mRenderPaint);
    }
  }
}
Program: 26979
Project: 26979
Buggy source:
/** 
 * calculates the average length (in characters) across all x-value strings
 */
private void calcXValAverageLength(){
  if (mXVals.size() == 0) {
    mXValAverageLength=1;
    return;
  }
  int sum=0;
  for (int i=0; i < mXVals.size(); i++) {
    sum+=mXVals.get(i).length();
  }
  mXValAverageLength=sum / mXVals.size();
}

Fixed version (ground truth):
/** 
 * calculates the average length (in characters) across all x-value strings
 */
private void calcXValAverageLength(){
  if (mXVals.size() == 0) {
    mXValAverageLength=1;
    return;
  }
  float sum=0f;
  for (int i=0; i < mXVals.size(); i++) {
    sum+=mXVals.get(i).length();
  }
  mXValAverageLength=sum / (float)mXVals.size();
}
Program: 26980
Project: 26980
Buggy source:
/** 
 * returns the average length (in characters) across all values in the x-vals array
 * @return
 */
public int getXValAverageLength(){
  return mXValAverageLength;
}

Fixed version (ground truth):
/** 
 * returns the average length (in characters) across all values in the x-vals array
 * @return
 */
public float getXValAverageLength(){
  return mXValAverageLength;
}
Program: 26981
Project: 26981
Buggy source:
@Override protected void init(){
  super.init();
  mFilledPaint=new Paint();
  mFilledPaint.setStyle(Paint.Style.FILL);
  mFilledPaint.setColor(mColorDarkBlue);
  mFilledPaint.setAlpha(130);
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}

Fixed version (ground truth):
@Override protected void init(){
  super.init();
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}
Program: 26983
Project: 26983
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(true);
  mChart.setDrawYValues(true);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setInvertYAxisEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(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(25,50);
  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(true);
  mChart.setDrawYValues(true);
  mChart.setDrawBorder(true);
  mChart.setBorderPositions(new BorderPosition[]{BorderPosition.BOTTOM});
  mChart.setDescription("String_Node_Str");
  mChart.setInvertYAxisEnabled(true);
  mChart.setHighlightEnabled(true);
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(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);
  XLabels xl=mChart.getXLabels();
  xl.setAvoidFirstLastClipping(true);
  setData(25,50);
  Legend l=mChart.getLegend();
  l.setForm(LegendForm.LINE);
  mChart.invalidate();
}
Program: 26984
Project: 26984
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.5f);
  set1.setCircleSize(4f);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i % 30) + "String_Node_Str" + (i % 12)+ "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.setLineWidth(1.5f);
  set1.setCircleSize(4f);
  LineData data=new LineData(xVals,set1);
  mChart.setData(data);
}
Program: 26985
Project: 26985
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setHoleRadius(60f);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawYValues(true);
  mChart.setDrawCenterText(true);
  mChart.setDrawHoleEnabled(true);
  mChart.setDrawXValues(true);
  mChart.setTouchEnabled(true);
  mChart.setUsePercentValues(true);
  mChart.setOnChartValueSelectedListener(this);
  mSeekBarX.setProgress(3);
  mSeekBarY.setProgress(100);
  mChart.animateXY(1500,1500);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_piechart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mSeekBarX.setOnSeekBarChangeListener(this);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mChart=(PieChart)findViewById(R.id.chart1);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  mChart.setValueTypeface(tf);
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getAssets(),"String_Node_Str"));
  mChart.setHoleRadius(60f);
  mChart.setDescription("String_Node_Str");
  mChart.setDrawYValues(true);
  mChart.setDrawCenterText(true);
  mChart.setDrawHoleEnabled(true);
  mChart.setDrawXValues(true);
  mChart.setUsePercentValues(true);
  mChart.setOnChartValueSelectedListener(this);
  mSeekBarX.setProgress(3);
  mSeekBarY.setProgress(100);
  mChart.animateXY(1500,1500);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setXEntrySpace(7f);
  l.setYEntrySpace(5f);
}
Program: 26986
Project: 26986
Buggy source:
/** 
 * draws the x-labels on the specified y-position
 * @param yPos
 */
private void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=0.5f;
    transformPointArray(position);
    if (position[0] >= mOffsetLeft && position[0] <= getWidth() - mOffsetRight) {
      mDrawCanvas.drawText(mCurrentData.getXVals().get(i),position[0],yPos,mXLabelPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the x-labels on the specified y-position
 * @param yPos
 */
private void drawXLabels(float yPos){
  float[] position=new float[]{0f,0f};
  for (int i=0; i < mCurrentData.getXValCount(); i+=mXLabels.mXAxisLabelModulus) {
    position[0]=i;
    if (mXLabels.isCenterXLabelsEnabled())     position[0]+=0.5f;
    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: 26987
Project: 26987
Buggy source:
@Override protected void drawData(){
}

Fixed version (ground truth):
@Override protected void drawData(){
  ArrayList<CandleDataSet> dataSets=(ArrayList<CandleDataSet>)mCurrentData.getDataSets();
  mRenderPaint.setStyle(Paint.Style.STROKE);
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    CandleDataSet dataSet=dataSets.get(i);
    ArrayList<? extends Entry> entries=dataSet.getYVals();
    float[] valuePoints=generateTransformedValues(entries,0f);
    for (int j=0; j < (valuePoints.length - 2) * mPhaseX; j+=2) {
      mRenderPaint.setColor(dataSet.getColor(j / 2));
      if (isOffContentRight(valuePoints[j]))       break;
      if (j != 0 && isOffContentLeft(valuePoints[j - 1]) && isOffContentTop(valuePoints[j + 1]) && isOffContentBottom(valuePoints[j + 1]))       continue;
      mDrawCanvas.drawLine(valuePoints[j],valuePoints[j + 1],valuePoints[j + 2],valuePoints[j + 3],mRenderPaint);
    }
  }
}
Program: 26988
Project: 26988
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  return mListener.onTouch(this,event);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (mTouchEnabled && mListener != null)   return mListener.onTouch(this,event);
 else   return super.onTouchEvent(event);
}
Program: 26989
Project: 26989
Buggy source:
@Override protected void init(){
  super.init();
  mFilledPaint=new Paint();
  mFilledPaint.setStyle(Paint.Style.FILL);
  mFilledPaint.setColor(mColorDarkBlue);
  mFilledPaint.setAlpha(130);
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}

Fixed version (ground truth):
@Override protected void init(){
  super.init();
  mCirclePaintInner=new Paint(Paint.ANTI_ALIAS_FLAG);
  mCirclePaintInner.setStyle(Paint.Style.FILL);
  mCirclePaintInner.setColor(Color.WHITE);
  mHighlightPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mHighlightPaint.setStyle(Paint.Style.STROKE);
  mHighlightPaint.setStrokeWidth(2f);
  mHighlightPaint.setColor(Color.rgb(255,187,115));
}
Program: 26991
Project: 26991
Buggy source:
/** 
 * draws the circle value indicators
 */
@Override protected void drawAdditional(){
  mRenderPaint.setStyle(Paint.Style.FILL);
  ArrayList<LineDataSet> dataSets=(ArrayList<LineDataSet>)mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    if (dataSet.isDrawCirclesEnabled()) {
      ArrayList<? extends Entry> entries=dataSet.getYVals();
      float[] positions=generateTransformedValues(entries,0f);
      for (int j=0; j < positions.length * mPhaseX; j+=2) {
        mRenderPaint.setColor(dataSet.getCircleColor(j));
        if (isOffContentRight(positions[j]))         break;
        if (isOffContentLeft(positions[j]) || isOffContentTop(positions[j + 1]) || isOffContentBottom(positions[j + 1]))         continue;
        mDrawCanvas.drawCircle(positions[j],positions[j + 1],dataSet.getCircleSize(),mRenderPaint);
        mDrawCanvas.drawCircle(positions[j],positions[j + 1],dataSet.getCircleSize() / 2,mCirclePaintInner);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the circle value indicators
 */
@Override protected void drawAdditional(){
  mRenderPaint.setStyle(Paint.Style.FILL);
  ArrayList<LineDataSet> dataSets=(ArrayList<LineDataSet>)mCurrentData.getDataSets();
  for (int i=0; i < mCurrentData.getDataSetCount(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    if (dataSet.isDrawCirclesEnabled()) {
      ArrayList<? extends Entry> entries=dataSet.getYVals();
      float[] positions=generateTransformedValues(entries,0f);
      for (int j=0; j < positions.length * mPhaseX; j+=2) {
        mRenderPaint.setColor(dataSet.getCircleColor(j / 2));
        if (isOffContentRight(positions[j]))         break;
        if (isOffContentLeft(positions[j]) || isOffContentTop(positions[j + 1]) || isOffContentBottom(positions[j + 1]))         continue;
        mDrawCanvas.drawCircle(positions[j],positions[j + 1],dataSet.getCircleSize(),mRenderPaint);
        mDrawCanvas.drawCircle(positions[j],positions[j + 1],dataSet.getCircleSize() / 2,mCirclePaintInner);
      }
    }
  }
}
Program: 26992
Project: 26992
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.setDragEnabled(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);
  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.setDragEnabled(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();
}
Program: 26993
Project: 26993
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((i) + "String_Node_Str");
  }
  ArrayList<Entry> yVals=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals,"String_Node_Str");
  set1.enableDashedLine(10f,5f,0f);
  set1.setLineWidth(1f);
  set1.setCircleSize(4f);
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  LineData data=new LineData(xVals,dataSets);
  LimitLine ll1=new LimitLine(130f);
  ll1.setLineWidth(4f);
  ll1.enableDashedLine(10f,10f,0f);
  LimitLine ll2=new LimitLine(-30f);
  ll2.setLineWidth(4f);
  ll2.enableDashedLine(10f,10f,0f);
  data.addLimitLine(ll1);
  data.addLimitLine(ll2);
  mChart.setData(data);
}
Program: 26994
Project: 26994
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_listview_chart);
  ListView lv=(ListView)findViewById(R.id.listView1);
  ArrayList<ChartData> list=new ArrayList<ChartData>();
  for (int i=0; i < 20; i++) {
    list.add(generateData(i + 1));
  }
  ChartDataAdapter cda=new ChartDataAdapter(getApplicationContext(),list);
  lv.setAdapter(cda);
}

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_listview_chart);
  ListView lv=(ListView)findViewById(R.id.listView1);
  ArrayList<BarData> list=new ArrayList<BarData>();
  for (int i=0; i < 20; i++) {
    list.add(generateData(i + 1));
  }
  ChartDataAdapter cda=new ChartDataAdapter(getApplicationContext(),list);
  lv.setAdapter(cda);
}
Program: 26995
Project: 26995
Buggy source:
public ChartDataAdapter(Context context,List<ChartData> objects){
  super(context,0,objects);
  mTf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
}

Fixed version (ground truth):
public ChartDataAdapter(Context context,List<BarData> objects){
  super(context,0,objects);
  mTf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
}
Program: 26996
Project: 26996
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ChartData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}
Program: 26997
Project: 26997
Buggy source:
protected ChartData generateBarData(int dataSets,float range,int count){
  ArrayList<BarDataSet> sets=new ArrayList<BarDataSet>();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    BarDataSet ds=new BarDataSet(entries,getLabel(i));
    ds.setColors(ColorTemplate.VORDIPLOM_COLORS,getActivity());
    sets.add(ds);
  }
  BarData d=new BarData(ChartData.generateXVals(0,count),sets);
  return d;
}

Fixed version (ground truth):
protected BarData generateBarData(int dataSets,float range,int count){
  ArrayList<BarDataSet> sets=new ArrayList<BarDataSet>();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    BarDataSet ds=new BarDataSet(entries,getLabel(i));
    ds.setColors(ColorTemplate.VORDIPLOM_COLORS,getActivity());
    sets.add(ds);
  }
  BarData d=new BarData(ChartData.generateXVals(0,count),sets);
  return d;
}
Program: 26998
Project: 26998
Buggy source:
protected ChartData generateScatterData(int dataSets,float range,int count){
  ArrayList<ScatterDataSet> sets=new ArrayList<ScatterDataSet>();
  ScatterShape[] shapes=ScatterChart.getAllPossibleShapes();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    ScatterDataSet ds=new ScatterDataSet(entries,getLabel(i));
    ds.setScatterShapeSize(12f);
    ds.setScatterShape(shapes[i % shapes.length]);
    ds.setColors(ColorTemplate.COLORFUL_COLORS,getActivity());
    ds.setScatterShapeSize(9f);
    sets.add(ds);
  }
  ScatterData d=new ScatterData(ChartData.generateXVals(0,count),sets);
  return d;
}

Fixed version (ground truth):
protected ScatterData generateScatterData(int dataSets,float range,int count){
  ArrayList<ScatterDataSet> sets=new ArrayList<ScatterDataSet>();
  ScatterShape[] shapes=ScatterChart.getAllPossibleShapes();
  for (int i=0; i < dataSets; i++) {
    ArrayList<Entry> entries=new ArrayList<Entry>();
    for (int j=0; j < count; j++) {
      entries.add(new Entry((float)(Math.random() * range) + range / 4,j));
    }
    ScatterDataSet ds=new ScatterDataSet(entries,getLabel(i));
    ds.setScatterShapeSize(12f);
    ds.setScatterShape(shapes[i % shapes.length]);
    ds.setColors(ColorTemplate.COLORFUL_COLORS,getActivity());
    ds.setScatterShapeSize(9f);
    sets.add(ds);
  }
  ScatterData d=new ScatterData(ChartData.generateXVals(0,count),sets);
  return d;
}
Program: 26999
Project: 26999
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(mChartData);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((BarData)mChartData);
  holder.chart.animateY(700);
  return convertView;
}
Program: 27000
Project: 27000
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_linechart,null);
    holder.chart=(LineChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setDrawYValues(false);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(mChartData);
  holder.chart.animateX(1000);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_linechart,null);
    holder.chart=(LineChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setDrawYValues(false);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawVerticalGrid(false);
  holder.chart.setDrawGridBackground(false);
  XLabels xl=holder.chart.getXLabels();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  YLabels yl=holder.chart.getYLabels();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((LineData)mChartData);
  holder.chart.animateX(1000);
  return convertView;
}
Program: 27001
Project: 27001
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_piechart,null);
    holder.chart=(PieChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setHoleRadius(60f);
  holder.chart.setTransparentCircleRadius(65f);
  holder.chart.setCenterText("String_Node_Str");
  holder.chart.setCenterTextTypeface(mTf);
  holder.chart.setCenterTextSize(18f);
  holder.chart.setDrawXValues(false);
  holder.chart.setUsePercentValues(true);
  holder.chart.setData(mChartData);
  Legend l=holder.chart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  holder.chart.animateXY(900,900);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_piechart,null);
    holder.chart=(PieChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setHoleRadius(60f);
  holder.chart.setTransparentCircleRadius(65f);
  holder.chart.setCenterText("String_Node_Str");
  holder.chart.setCenterTextTypeface(mTf);
  holder.chart.setCenterTextSize(18f);
  holder.chart.setDrawXValues(false);
  holder.chart.setUsePercentValues(true);
  holder.chart.setData((PieData)mChartData);
  Legend l=holder.chart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  holder.chart.animateXY(900,900);
  return convertView;
}
Program: 27004
Project: 27004
Buggy source:
/** 
 * Sets a new ChartData object for the chart.
 * @param data
 */
public void setData(ChartData data){
  if (data == null || !data.isValid()) {
    Log.e(LOG_TAG,"String_Node_Str");
    mDataNotSet=true;
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mCurrentData=data;
  mOriginalData=data;
  prepare();
  Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets a new ChartData object for the chart.
 * @param data
 */
protected void setData(ChartData data){
  if (data == null || !data.isValid()) {
    Log.e(LOG_TAG,"String_Node_Str");
    mDataNotSet=true;
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mCurrentData=data;
  mOriginalData=data;
  prepare();
  Log.i(LOG_TAG,"String_Node_Str");
}
Program: 27005
Project: 27005
Buggy source:
@Override public Fragment getItem(int pos){
  Fragment f=null;
switch (pos) {
case 0:
    f=LineChartFrag.newInstance();
  break;
case 1:
f=BarChartFrag.newInstance();
break;
case 2:
f=ScatterChartFrag.newInstance();
break;
case 3:
f=PieChartFrag.newInstance();
break;
}
return f;
}

Fixed version (ground truth):
@Override public Fragment getItem(int pos){
  Fragment f=null;
switch (pos) {
case 0:
    f=SineCosineFragment.newInstance();
  break;
case 1:
f=ComplexityFragment.newInstance();
break;
case 2:
f=BarChartFrag.newInstance();
break;
case 3:
f=ScatterChartFrag.newInstance();
break;
case 4:
f=PieChartFrag.newInstance();
break;
}
return f;
}
Program: 27006
Project: 27006
Buggy source:
@Override public int getCount(){
  return 4;
}

Fixed version (ground truth):
@Override public int getCount(){
  return 5;
}
Program: 27009
Project: 27009
Buggy source:
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.random() * mult) + 3;
    yVals1.add(new Entry(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);
  mChart.invalidate();
}

Fixed version (ground truth):
@Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){
  tvX.setText("String_Node_Str" + (mSeekBarX.getProgress() + 1));
  tvY.setText("String_Node_Str" + (mSeekBarY.getProgress()));
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<Entry> yVals1=new ArrayList<Entry>();
  for (int i=0; i < mSeekBarX.getProgress() + 1; i++) {
    float mult=(mSeekBarY.getProgress() + 1);
    float val=(float)(Math.random() * mult) - 50;
    yVals1.add(new Entry(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);
  mChart.invalidate();
}
Program: 27010
Project: 27010
Buggy source:
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  if (!mStartAtZero && getYMin() >= 0f) {
    mYChartMin=getYMin();
    mDeltaY=Math.abs(mYChartMax - mYChartMin);
  }
  mDeltaX++;
}

Fixed version (ground truth):
@Override protected void calcMinMax(boolean fixedValues){
  super.calcMinMax(fixedValues);
  mDeltaX++;
}
Program: 27011
Project: 27011
Buggy source:
@Override protected void drawHighlights(){
  if (mHighlightEnabled && mHighLightIndicatorEnabled && valuesToHighlight()) {
    float offsetY=mDeltaY * 0.04f;
    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);
      if (index < mCurrentData.getYValCount() && index >= 0 && index < mDeltaX * mPhaseX) {
        mHighlightPaint.setAlpha(120);
        Entry e=getEntryByDataSetIndex(index,dataSetIndex);
        float y=e.getSum() * mPhaseY;
        float top=y >= 0 ? y : 0;
        float bottom=y <= 0 ? y : 0;
        float left=index + ds.getBarSpace() / 2f;
        float right=index + 1f - ds.getBarSpace() / 2f;
        RectF highlight=new RectF(left,top,right,bottom);
        transformRect(highlight);
        mDrawCanvas.drawRect(highlight,mHighlightPaint);
        if (mDrawHighlightArrow) {
          mHighlightPaint.setAlpha(200);
          Path arrow=new Path();
          arrow.moveTo(index + 0.5f,y + offsetY * 0.3f);
          arrow.lineTo(index + 0.2f,y + offsetY);
          arrow.lineTo(index + 0.8f,y + offsetY);
          transformPath(arrow);
          mDrawCanvas.drawPath(arrow,mHighlightPaint);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void drawHighlights(){
  if (mHighlightEnabled && mHighLightIndicatorEnabled && valuesToHighlight()) {
    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);
      if (index < mCurrentData.getYValCount() && index >= 0 && index < mDeltaX * mPhaseX) {
        mHighlightPaint.setAlpha(120);
        Entry e=getEntryByDataSetIndex(index,dataSetIndex);
        prepareBar(e.getXIndex(),e.getSum(),ds.getBarSpace());
        mDrawCanvas.drawRect(mBarRect,mHighlightPaint);
      }
    }
  }
}