nus-yam/ex-repair huggingface dataset:
Program: 18504
Project: 18504
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_pie,container,false);
  mChart=(PieChart)v.findViewById(R.id.pieChart1);
  mChart.setDescription("String_Node_Str");
  mChart.setCenterTextTypeface(Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str"));
  mChart.setCenterText("String_Node_Str");
  mChart.setCenterTextSize(22f);
  mChart.setHoleRadius(45f);
  mChart.setTransparentCircleRadius(50f);
  mChart.setData(generatePieData());
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.frag_simple_pie,container,false);
  mChart=(PieChart)v.findViewById(R.id.pieChart1);
  mChart.setDescription("String_Node_Str");
  Typeface tf=Typeface.createFromAsset(getActivity().getAssets(),"String_Node_Str");
  mChart.setCenterTextTypeface(tf);
  mChart.setCenterText("String_Node_Str");
  mChart.setCenterTextSize(22f);
  mChart.setCenterTextTypeface(tf);
  mChart.setHoleRadius(45f);
  mChart.setTransparentCircleRadius(50f);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  mChart.setData(generatePieData());
  return v;
}
Program: 18505
Project: 18505
Buggy source:
/** 
 * generates less data (1 DataSet, 4 values)
 * @return
 */
protected PieData generatePieData(){
  int count=4;
  ArrayList<Entry> entries1=new ArrayList<Entry>();
  ArrayList<String> xVals=new ArrayList<String>();
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  for (int i=0; i < count; i++) {
    xVals.add("String_Node_Str" + (i + 1));
    entries1.add(new Entry((float)(Math.random() * 60) + 40,i));
  }
  PieDataSet ds1=new PieDataSet(entries1,"String_Node_Str");
  ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
  ds1.setSliceSpace(2f);
  PieData d=new PieData(xVals,ds1);
  d.setValueTypeface(tf);
  return d;
}

Fixed version (ground truth):
/** 
 * generates less data (1 DataSet, 4 values)
 * @return
 */
protected PieData generatePieData(){
  int count=4;
  ArrayList<Entry> entries1=new ArrayList<Entry>();
  ArrayList<String> xVals=new ArrayList<String>();
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  xVals.add("String_Node_Str");
  for (int i=0; i < count; i++) {
    xVals.add("String_Node_Str" + (i + 1));
    entries1.add(new Entry((float)(Math.random() * 60) + 40,i));
  }
  PieDataSet ds1=new PieDataSet(entries1,"String_Node_Str");
  ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
  ds1.setSliceSpace(2f);
  ds1.setValueTextColor(Color.WHITE);
  ds1.setValueTextSize(12f);
  PieData d=new PieData(xVals,ds1);
  d.setValueTypeface(tf);
  return d;
}
Program: 18506
Project: 18506
Buggy source:
/** 
 * draws the description text in the center of the pie chart makes most sense when center-hole is enabled
 */
protected void drawCenterText(Canvas c){
  String centerText=mChart.getCenterText();
  if (mChart.isDrawCenterTextEnabled() && centerText != null) {
    PointF center=mChart.getCenterCircleBox();
    String[] lines=centerText.split("String_Node_Str");
    float lineHeight=Utils.calcTextHeight(mCenterTextPaint,lines[0]);
    float linespacing=lineHeight * 0.2f;
    float totalheight=lineHeight * lines.length - linespacing * (lines.length - 1);
    int cnt=lines.length;
    float y=center.y;
    for (int i=0; i < lines.length; i++) {
      String line=lines[lines.length - i - 1];
      c.drawText(line,center.x,y + lineHeight * cnt - totalheight / 2f,mCenterTextPaint);
      cnt--;
      y-=linespacing;
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the description text in the center of the pie chart makes most sense when center-hole is enabled
 */
protected void drawCenterText(Canvas c){
  String centerText=mChart.getCenterText();
  if (mChart.isDrawCenterTextEnabled() && centerText != null) {
    PointF center=mChart.getCenterCircleBox();
    String[] lines=centerText.split("String_Node_Str");
    float maxlineheight=0f;
    for (    String line : lines) {
      float curHeight=Utils.calcTextHeight(mCenterTextPaint,line);
      if (curHeight > maxlineheight)       maxlineheight=curHeight;
    }
    float linespacing=maxlineheight * 0.25f;
    float totalheight=maxlineheight * lines.length - linespacing * (lines.length - 1);
    int cnt=lines.length;
    float y=center.y;
    for (int i=0; i < lines.length; i++) {
      String line=lines[lines.length - i - 1];
      c.drawText(line,center.x,y + maxlineheight * cnt - totalheight / 2f,mCenterTextPaint);
      cnt--;
      y-=linespacing;
    }
  }
}
Program: 18507
Project: 18507
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData data=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();
  }
  data.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  data.setValueTextColor(Color.WHITE);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTTOM);
  xAxis.setTypeface(mTf);
  xAxis.setDrawGridLines(false);
  YAxis leftAxis=holder.chart.getAxisLeft();
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(5);
  leftAxis.setSpaceTop(15f);
  YAxis rightAxis=holder.chart.getAxisRight();
  rightAxis.setTypeface(mTf);
  rightAxis.setLabelCount(5);
  rightAxis.setSpaceTop(15f);
  holder.chart.setData(data);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData data=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();
  }
  data.setValueTypeface(mTf);
  data.setValueTextColor(Color.BLACK);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setPosition(XAxisPosition.BOTTOM);
  xAxis.setTypeface(mTf);
  xAxis.setDrawGridLines(false);
  YAxis leftAxis=holder.chart.getAxisLeft();
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(5);
  leftAxis.setSpaceTop(15f);
  YAxis rightAxis=holder.chart.getAxisRight();
  rightAxis.setTypeface(mTf);
  rightAxis.setLabelCount(5);
  rightAxis.setSpaceTop(15f);
  holder.chart.setData(data);
  holder.chart.animateY(700);
  return convertView;
}
Program: 18508
Project: 18508
Buggy source:
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null || data.getYValCount() <= 0) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}
Program: 18511
Project: 18511
Buggy source:
public YAxisRenderer(ViewPortHandler viewPortHandler,YAxis yAxis,Transformer trans){
  super(viewPortHandler,trans);
  this.mYAxis=yAxis;
  mAxisLabelPaint.setColor(Color.BLACK);
  mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
  mLimitLinePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mLimitLinePaint.setStyle(Paint.Style.FILL_AND_STROKE);
}

Fixed version (ground truth):
public YAxisRenderer(ViewPortHandler viewPortHandler,YAxis yAxis,Transformer trans){
  super(viewPortHandler,trans);
  this.mYAxis=yAxis;
  mAxisLabelPaint.setColor(Color.BLACK);
  mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));
  mLimitLinePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mLimitLinePaint.setStyle(Paint.Style.STROKE);
}
Program: 18513
Project: 18513
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  BarDataSet set1=new BarDataSet(yVals1,"String_Node_Str");
  set1.setBarSpacePercent(35f);
  ArrayList<BarDataSet> dataSets=new ArrayList<BarDataSet>();
  dataSets.add(set1);
  BarData data=new BarData(xVals,dataSets);
  data.setValueTextSize(10f);
  data.setValueTypeface(mTf);
  mChart.setData(data);
}

Fixed version (ground truth):
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add(mMonths[i % 12]);
  }
  ArrayList<BarEntry> yVals1=new ArrayList<BarEntry>();
  for (int i=0; i < count - 1; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult);
    yVals1.add(new BarEntry(val,i));
  }
  yVals1.add(new BarEntry(-20f,count - 1));
  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);
  data.setValueTextSize(10f);
  data.setValueTypeface(mTf);
  mChart.setData(data);
}
Program: 18517
Project: 18517
Buggy source:
/** 
 * Prepares a bar for being highlighted.
 * @param x the x-position
 * @param y the y-position
 * @param barspace the space between bars
 * @param from
 * @param trans
 */
protected void prepareBarHighlight(float x,float y,float barspace,float from,Transformer trans){
  float barWidth=0.5f;
  float spaceHalf=barspace / 2f;
  float left=x - barWidth + spaceHalf;
  float right=x + barWidth - spaceHalf;
  float top=y >= from ? y : from;
  float bottom=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
/** 
 * Prepares a bar for being highlighted.
 * @param x the x-position
 * @param y the y-position
 * @param barspace the space between bars
 * @param from
 * @param trans
 */
protected void prepareBarHighlight(float x,float y,float barspaceHalf,float from,Transformer trans){
  float barWidth=0.5f;
  float left=x - barWidth + barspaceHalf;
  float right=x + barWidth - barspaceHalf;
  float top=y >= from ? y : from;
  float bottom=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}
Program: 18519
Project: 18519
Buggy source:
@Override protected void prepareBarHighlight(float x,float y,float barspace,float from,Transformer trans){
  float spaceHalf=barspace / 2f;
  float top=x - 0.5f + spaceHalf;
  float bottom=x + 0.5f - spaceHalf;
  float left=y >= from ? y : from;
  float right=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
@Override protected void prepareBarHighlight(float x,float y,float barspaceHalf,float from,Transformer trans){
  float top=x - 0.5f + barspaceHalf;
  float bottom=x + 0.5f - barspaceHalf;
  float left=y >= from ? y : from;
  float right=y <= from ? y : from;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixelHorizontal(mBarRect,mAnimator.getPhaseY());
}
Program: 18520
Project: 18520
Buggy source:
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
    if (!mYAxis.isInverted()) {
      yMin=(float)p2.y;
      yMax=(float)p1.y;
    }
 else {
      if (!mYAxis.isStartAtZeroEnabled()) {
        yMin=(float)Math.min(p1.y,p2.y);
      }
 else       yMin=0;
      yMax=(float)Math.max(p1.y,p2.y);
    }
  }
  computeAxisValues(yMin,yMax);
}

Fixed version (ground truth):
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentWidth() > 10 && !mViewPortHandler.isFullyZoomedOutY()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
    if (!mYAxis.isInverted()) {
      yMin=(float)p2.y;
      yMax=(float)p1.y;
    }
 else {
      yMin=(float)p1.y;
      yMax=(float)p2.y;
    }
  }
  computeAxisValues(yMin,yMax);
}
Program: 18521
Project: 18521
Buggy source:
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),mViewPortHandler.contentTop());
    if (!mYAxis.isInverted()) {
      yMin=(float)p1.x;
      yMax=(float)p2.x;
    }
 else {
      if (!mYAxis.isStartAtZeroEnabled())       yMin=(float)Math.min(p1.x,p2.x);
 else       yMin=0;
      yMax=(float)Math.max(p1.x,p2.x);
    }
  }
  computeAxisValues(yMin,yMax);
}

Fixed version (ground truth):
/** 
 * Computes the axis values.
 * @param yMin - the minimum y-value in the data object for this axis
 * @param yMax - the maximum y-value in the data object for this axis
 */
public void computeAxis(float yMin,float yMax){
  if (mViewPortHandler.contentHeight() > 10 && !mViewPortHandler.isFullyZoomedOutX()) {
    PointD p1=mTrans.getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentTop());
    PointD p2=mTrans.getValuesByTouchPoint(mViewPortHandler.contentRight(),mViewPortHandler.contentTop());
    if (!mYAxis.isInverted()) {
      yMin=(float)p1.x;
      yMax=(float)p2.x;
    }
 else {
      yMin=(float)p2.x;
      yMax=(float)p1.x;
    }
  }
  computeAxisValues(yMin,yMax);
}
Program: 18522
Project: 18522
Buggy source:
@Override protected void onDraw(Canvas canvas){
  if (mDataNotSet) {
    canvas.drawText(mNoDataText,getWidth() / 2,getHeight() / 2,mInfoPaint);
    if (!TextUtils.isEmpty(mNoDataTextDescription)) {
      float textOffset=-mInfoPaint.ascent() + mInfoPaint.descent();
      canvas.drawText(mNoDataTextDescription,getWidth() / 2,(getHeight() / 2) + textOffset,mInfoPaint);
    }
    return;
  }
  if (!mOffsetsCalculated) {
    calculateOffsets();
    mOffsetsCalculated=true;
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  if (mDataNotSet || mData == null || mData.getYValCount() <= 0) {
    canvas.drawText(mNoDataText,getWidth() / 2,getHeight() / 2,mInfoPaint);
    if (!TextUtils.isEmpty(mNoDataTextDescription)) {
      float textOffset=-mInfoPaint.ascent() + mInfoPaint.descent();
      canvas.drawText(mNoDataTextDescription,getWidth() / 2,(getHeight() / 2) + textOffset,mInfoPaint);
    }
    return;
  }
  if (!mOffsetsCalculated) {
    calculateOffsets();
    mOffsetsCalculated=true;
  }
}
Program: 18523
Project: 18523
Buggy source:
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null || data.getYValCount() <= 0) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets a new data object for the chart. The data object contains all values and information needed for displaying.
 * @param data
 */
public void setData(T data){
  if (data == null) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  mDataNotSet=false;
  mOffsetsCalculated=false;
  mData=data;
  calculateFormatter(data.getYMin(),data.getYMax());
  for (  DataSet<?> set : mData.getDataSets()) {
    if (set.needsDefaultFormatter())     set.setValueFormatter(mDefaultFormatter);
  }
  notifyDataSetChanged();
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}
Program: 18524
Project: 18524
Buggy source:
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setViewPortOffsets(10,0,10,0);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setForm(LegendForm.CIRCLE);
  l.setFormSize(6f);
  l.setTextColor(Color.WHITE);
  l.setTypeface(mTf);
  chart.getAxisLeft().setEnabled(false);
  chart.getAxisRight().setEnabled(false);
  chart.getXAxis().setEnabled(false);
  chart.animateX(2500);
}

Fixed version (ground truth):
private void setupChart(LineChart chart,LineData data,int color){
  chart.setDescription("String_Node_Str");
  chart.setNoDataTextDescription("String_Node_Str");
  chart.setDrawGridBackground(false);
  chart.setTouchEnabled(true);
  chart.setDragEnabled(true);
  chart.setScaleEnabled(true);
  chart.setPinchZoom(false);
  chart.setBackgroundColor(color);
  chart.setViewPortOffsets(10,0,10,0);
  chart.setData(data);
  Legend l=chart.getLegend();
  l.setEnabled(false);
  chart.getAxisLeft().setEnabled(false);
  chart.getAxisRight().setEnabled(false);
  chart.getXAxis().setEnabled(false);
  chart.animateX(2500);
}
Program: 18525
Project: 18525
Buggy source:
@Override public void run(){
  mViewPortHandler.restrainViewPort(left,top,right,bottom);
}

Fixed version (ground truth):
@Override public void run(){
  mViewPortHandler.restrainViewPort(left,top,right,bottom);
  prepareOffsetMatrix();
  prepareValuePxMatrix();
}
Program: 18526
Project: 18526
Buggy source:
/** 
 * Sets custom offsets for the current ViewPort (the offsets on the sides of the actual chart window). Setting this will prevent the chart from automatically calculating it's offsets. Use resetViewPortOffsets() to undo this.
 * @param left
 * @param top
 * @param right
 * @param bottom
 */
public void setViewPortOffsets(final float left,final float top,final float right,final float bottom){
  mCustomViewPortEnabled=true;
  post(new Runnable(){
    @Override public void run(){
      mViewPortHandler.restrainViewPort(left,top,right,bottom);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sets custom offsets for the current ViewPort (the offsets on the sides of the actual chart window). Setting this will prevent the chart from automatically calculating it's offsets. Use resetViewPortOffsets() to undo this.
 * @param left
 * @param top
 * @param right
 * @param bottom
 */
public void setViewPortOffsets(final float left,final float top,final float right,final float bottom){
  mCustomViewPortEnabled=true;
  post(new Runnable(){
    @Override public void run(){
      mViewPortHandler.restrainViewPort(left,top,right,bottom);
      prepareOffsetMatrix();
      prepareValuePxMatrix();
    }
  }
);
}
Program: 18527
Project: 18527
Buggy source:
/** 
 * Sets the size of the area (range on the x-axis) that should be maximum visible at once. If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
 * @param xRange
 */
public void setVisibleXRange(float xRange){
  float xScale=mDeltaX / (xRange + 0.01f);
  mViewPortHandler.setMinimumScaleX(xScale);
}

Fixed version (ground truth):
/** 
 * Sets the size of the area (range on the x-axis) that should be maximum visible at once. If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
 * @param xRange
 */
public void setVisibleXRange(float xRange){
  float xScale=mDeltaX / (xRange);
  mViewPortHandler.setMinimumScaleX(xScale);
}
Program: 18528
Project: 18528
Buggy source:
/** 
 * Prepares the matrix that transforms values to pixels. Calculates the scale factors from the charts size and offsets.
 * @param chart
 */
public void prepareMatrixValuePx(float xChartMin,float deltaX,float deltaY,float yChartMin){
  float scaleX=(float)((mViewPortHandler.getChartWidth() - mViewPortHandler.offsetRight() - mViewPortHandler.offsetLeft()) / deltaX);
  float scaleY=(float)((mViewPortHandler.getChartHeight() - mViewPortHandler.offsetTop() - mViewPortHandler.offsetBottom()) / deltaY);
  mMatrixValueToPx.reset();
  mMatrixValueToPx.postTranslate(-xChartMin,-yChartMin);
  mMatrixValueToPx.postScale(scaleX,-scaleY);
}

Fixed version (ground truth):
/** 
 * Prepares the matrix that transforms values to pixels. Calculates the scale factors from the charts size and offsets.
 * @param chart
 */
public void prepareMatrixValuePx(float xChartMin,float deltaX,float deltaY,float yChartMin){
  float scaleX=(float)((mViewPortHandler.contentWidth()) / deltaX);
  float scaleY=(float)((mViewPortHandler.contentHeight()) / deltaY);
  mMatrixValueToPx.reset();
  mMatrixValueToPx.postTranslate(-xChartMin,-yChartMin);
  mMatrixValueToPx.postScale(scaleX,-scaleY);
}
Program: 18532
Project: 18532
Buggy source:
/** 
 * callback when a DataSet has been drawn (when lifting the finger) 
 */
@Override public void onDrawFinished(DataSet<?> dataSet){
  Log.i(Chart.LOG_TAG,"String_Node_Str" + dataSet.toSimpleString());
  mChart.getLegendRenderer().computeLegend(mChart.getData(),mChart.getLegend());
}

Fixed version (ground truth):
/** 
 * callback when a DataSet has been drawn (when lifting the finger) 
 */
@Override public void onDrawFinished(DataSet<?> dataSet){
  Log.i(Chart.LOG_TAG,"String_Node_Str" + dataSet.toSimpleString());
  mChart.getLegendRenderer().computeLegend(mChart.getData());
}
Program: 18533
Project: 18533
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet) {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
    return;
  }
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
  }
  if (mRenderer != null)   mRenderer.initBuffers();
  calcMinMax();
  if (mAxisLeft.needsDefaultFormatter())   mAxisLeft.setValueFormatter(mDefaultFormatter);
  if (mAxisRight.needsDefaultFormatter())   mAxisRight.setValueFormatter(mDefaultFormatter);
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum);
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet) {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
    return;
  }
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str");
  }
  if (mRenderer != null)   mRenderer.initBuffers();
  calcMinMax();
  if (mAxisLeft.needsDefaultFormatter())   mAxisLeft.setValueFormatter(mDefaultFormatter);
  if (mAxisRight.needsDefaultFormatter())   mAxisRight.setValueFormatter(mDefaultFormatter);
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum);
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 18535
Project: 18535
Buggy source:
/** 
 * initialize all paints and stuff
 */
protected void init(){
  setWillNotDraw(false);
  if (android.os.Build.VERSION.SDK_INT < 11)   mAnimator=new ChartAnimator();
 else   mAnimator=new ChartAnimator(new AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      postInvalidate();
    }
  }
);
  Utils.init(getContext().getResources());
  mDefaultFormatter=new DefaultValueFormatter(1);
  mViewPortHandler=new ViewPortHandler();
  mLegend=new Legend();
  mLegendRenderer=new LegendRenderer(mViewPortHandler);
  mRenderPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mRenderPaint.setStyle(Style.FILL);
  mDescPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mDescPaint.setColor(Color.BLACK);
  mDescPaint.setTextAlign(Align.RIGHT);
  mDescPaint.setTextSize(Utils.convertDpToPixel(9f));
  mInfoPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mInfoPaint.setColor(Color.rgb(247,189,51));
  mInfoPaint.setTextAlign(Align.CENTER);
  mInfoPaint.setTextSize(Utils.convertDpToPixel(12f));
  mDrawPaint=new Paint(Paint.DITHER_FLAG);
  if (mLogEnabled)   Log.i("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * initialize all paints and stuff
 */
protected void init(){
  setWillNotDraw(false);
  if (android.os.Build.VERSION.SDK_INT < 11)   mAnimator=new ChartAnimator();
 else   mAnimator=new ChartAnimator(new AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      postInvalidate();
    }
  }
);
  Utils.init(getContext().getResources());
  mDefaultFormatter=new DefaultValueFormatter(1);
  mViewPortHandler=new ViewPortHandler();
  mLegend=new Legend();
  mLegendRenderer=new LegendRenderer(mViewPortHandler,mLegend);
  mRenderPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mRenderPaint.setStyle(Style.FILL);
  mDescPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mDescPaint.setColor(Color.BLACK);
  mDescPaint.setTextAlign(Align.RIGHT);
  mDescPaint.setTextSize(Utils.convertDpToPixel(9f));
  mInfoPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
  mInfoPaint.setColor(Color.rgb(247,189,51));
  mInfoPaint.setTextAlign(Align.CENTER);
  mInfoPaint.setTextSize(Utils.convertDpToPixel(12f));
  mDrawPaint=new Paint(Paint.DITHER_FLAG);
  if (mLogEnabled)   Log.i("String_Node_Str","String_Node_Str");
}
Program: 18536
Project: 18536
Buggy source:
/** 
 * Returns the Legend object of the chart. This method can be used to customize the automatically generated Legend. IMPORTANT: Since the Legend is generated from data provided by the user (via setData(...) method), this will return NULL if no data has been set for the chart. You need to set data for the chart before calling this method.
 * @return
 */
public Legend getLegend(){
  return mLegend;
}

Fixed version (ground truth):
/** 
 * Returns the Legend object of the chart. This method can be used to get an instance of the legend in order to customize the automatically generated Legend.
 * @return
 */
public Legend getLegend(){
  return mLegend;
}
Program: 18537
Project: 18537
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mRenderer.drawExtras(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas);
  drawDescription(canvas);
}
Program: 18538
Project: 18538
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 18539
Project: 18539
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxisLabels(canvas);
  if (mDrawWeb)   mRenderer.drawExtras(canvas);
  mYAxisRenderer.renderLimitLines(canvas);
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxisLabels(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas,mLegend);
  drawDescription(canvas);
  drawMarkers(canvas);
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mDataNotSet)   return;
  mXAxisRenderer.renderAxisLabels(canvas);
  if (mDrawWeb)   mRenderer.drawExtras(canvas);
  mYAxisRenderer.renderLimitLines(canvas);
  mRenderer.drawData(canvas);
  if (mHighlightEnabled && valuesToHighlight())   mRenderer.drawHighlighted(canvas,mIndicesToHightlight);
  mYAxisRenderer.renderAxisLabels(canvas);
  mRenderer.drawValues(canvas);
  mLegendRenderer.renderLegend(canvas);
  drawDescription(canvas);
  drawMarkers(canvas);
}
Program: 18540
Project: 18540
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(mYAxis.mAxisMinimum,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegend=mLegendRenderer.computeLegend(mData,mLegend);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax();
  if (mYAxis.needsDefaultFormatter()) {
    mYAxis.setValueFormatter(mDefaultFormatter);
  }
  mYAxisRenderer.computeAxis(mYAxis.mAxisMinimum,mYAxis.mAxisMaximum);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 18541
Project: 18541
Buggy source:
/** 
 * draws the description text in the bottom right corner of the chart
 */
protected void drawDescription(Canvas c){
  c.drawText(mDescription,getWidth() - mViewPortHandler.offsetRight() - 10,getHeight() - mViewPortHandler.offsetBottom() - 10,mDescPaint);
}

Fixed version (ground truth):
/** 
 * draws the description text in the bottom right corner of the chart
 */
protected void drawDescription(Canvas c){
  if (!mDescription.equals("String_Node_Str")) {
    c.drawText(mDescription,getWidth() - mViewPortHandler.offsetRight() - 10,getHeight() - mViewPortHandler.offsetBottom() - 10,mDescPaint);
  }
}
Program: 18542
Project: 18542
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=5; i < count - 5; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  set1.setFillColor(ColorTemplate.getHoloBlue());
  LineData data=new LineData(xVals,set1);
  data.setValueTypeface(tf);
  data.setValueTextSize(9f);
  data.setDrawValues(false);
  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((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  set1.setFillColor(ColorTemplate.getHoloBlue());
  LineData data=new LineData(xVals,set1);
  data.setValueTypeface(tf);
  data.setValueTextSize(9f);
  data.setDrawValues(false);
  mChart.setData(data);
}
Program: 18543
Project: 18543
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> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range / 2f;
    float val=(float)(Math.random() * mult) + 50;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(ColorTemplate.getHoloBlue());
  set1.setLineWidth(2f);
  set1.setCircleSize(4f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range;
    float val=(float)(Math.random() * mult) + 450;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.RED);
  set2.setLineWidth(2f);
  set2.setCircleSize(4f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTextColor(Color.WHITE);
  data.setValueTextSize(9f);
  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> yVals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range / 2f;
    float val=(float)(Math.random() * mult) + 50;
    yVals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(yVals1,"String_Node_Str");
  set1.setAxisDependency(AxisDependency.LEFT);
  set1.setColor(ColorTemplate.getHoloBlue());
  set1.setCircleColor(Color.WHITE);
  set1.setLineWidth(2f);
  set1.setCircleSize(3f);
  set1.setFillAlpha(65);
  set1.setFillColor(ColorTemplate.getHoloBlue());
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setDrawCircleHole(false);
  ArrayList<Entry> yVals2=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=range;
    float val=(float)(Math.random() * mult) + 450;
    yVals2.add(new Entry(val,i));
  }
  LineDataSet set2=new LineDataSet(yVals2,"String_Node_Str");
  set2.setAxisDependency(AxisDependency.RIGHT);
  set2.setColor(Color.RED);
  set2.setCircleColor(Color.WHITE);
  set2.setLineWidth(2f);
  set2.setCircleSize(3f);
  set2.setFillAlpha(65);
  set2.setFillColor(Color.RED);
  set2.setDrawCircleHole(false);
  set2.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<LineDataSet> dataSets=new ArrayList<LineDataSet>();
  dataSets.add(set1);
  dataSets.add(set2);
  LineData data=new LineData(xVals,dataSets);
  data.setValueTextColor(Color.WHITE);
  data.setValueTextSize(9f);
  mChart.setData(data);
}
Program: 18544
Project: 18544
Buggy source:
public LineBuffer(int size){
  super(size);
}

Fixed version (ground truth):
public LineBuffer(int size){
  super((size < 4) ? 4 : size);
}
Program: 18545
Project: 18545
Buggy source:
@Override public void drawData(Canvas c){
  if (mPathBitmap == null) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
}

Fixed version (ground truth):
@Override public void drawData(Canvas c){
  if (mPathBitmap == null) {
    mPathBitmap=Bitmap.createBitmap((int)mViewPortHandler.getChartWidth(),(int)mViewPortHandler.getChartHeight(),Bitmap.Config.ARGB_4444);
    mBitmapCanvas=new Canvas(mPathBitmap);
  }
  mPathBitmap.eraseColor(Color.TRANSPARENT);
  LineData lineData=mChart.getLineData();
  for (  LineDataSet set : lineData.getDataSets()) {
    if (set.isVisible())     drawDataSet(c,set);
  }
  c.drawBitmap(mPathBitmap,0,0,mRenderPaint);
}
Program: 18547
Project: 18547
Buggy source:
@Override public void initBuffers(){
  LineData lineData=mChart.getLineData();
  mLineBuffers=new LineBuffer[lineData.getDataSetCount()];
  for (int i=0; i < mLineBuffers.length; i++) {
    LineDataSet set=lineData.getDataSetByIndex(i);
    int size=lineData.getXValCount() * 4 - 4;
    if (size < 4)     size=4;
    mLineBuffers[i]=new LineBuffer(size);
  }
  mCircleBuffers=new CircleBuffer[lineData.getDataSetCount()];
  for (int i=0; i < mCircleBuffers.length; i++) {
    LineDataSet set=lineData.getDataSetByIndex(i);
    mCircleBuffers[i]=new CircleBuffer(set.getEntryCount() * 2);
  }
}

Fixed version (ground truth):
@Override public void initBuffers(){
  LineData lineData=mChart.getLineData();
  mLineBuffers=new LineBuffer[lineData.getDataSetCount()];
  mCircleBuffers=new CircleBuffer[lineData.getDataSetCount()];
  for (int i=0; i < mLineBuffers.length; i++) {
    LineDataSet set=lineData.getDataSetByIndex(i);
    mLineBuffers[i]=new LineBuffer(set.getEntryCount() * 4 - 4);
    mCircleBuffers[i]=new CircleBuffer(set.getEntryCount() * 2);
  }
}
Program: 18549
Project: 18549
Buggy source:
protected void drawCircles(Canvas c){
  mRenderPaint.setStyle(Paint.Style.FILL);
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  ArrayList<LineDataSet> dataSets=mChart.getLineData().getDataSets();
  for (int i=0; i < dataSets.size(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled())     continue;
    Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
    ArrayList<Entry> entries=dataSet.getYVals();
    CircleBuffer buffer=mCircleBuffers[i];
    buffer.setPhases(phaseX,phaseY);
    buffer.feed(entries);
    trans.pointValuesToPixel(buffer.buffer);
    float halfsize=dataSet.getCircleSize() / 2f;
    for (int j=0; j < buffer.size(); j+=2) {
      mRenderPaint.setColor(dataSet.getCircleColor(j / 2));
      float x=buffer.buffer[j];
      float y=buffer.buffer[j + 1];
      if (!mViewPortHandler.isInBoundsRight(x))       break;
      if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))       continue;
      c.drawCircle(x,y,dataSet.getCircleSize(),mRenderPaint);
      if (dataSet.isDrawCircleHoleEnabled())       c.drawCircle(x,y,halfsize,mCirclePaintInner);
    }
  }
}

Fixed version (ground truth):
protected void drawCircles(Canvas c){
  mRenderPaint.setStyle(Paint.Style.FILL);
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  ArrayList<LineDataSet> dataSets=mChart.getLineData().getDataSets();
  for (int i=0; i < dataSets.size(); i++) {
    LineDataSet dataSet=dataSets.get(i);
    if (!dataSet.isVisible() || !dataSet.isDrawCirclesEnabled())     continue;
    mCirclePaintInner.setColor(dataSet.getCircleHoleColor());
    Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
    ArrayList<Entry> entries=dataSet.getYVals();
    CircleBuffer buffer=mCircleBuffers[i];
    buffer.setPhases(phaseX,phaseY);
    buffer.feed(entries);
    trans.pointValuesToPixel(buffer.buffer);
    float halfsize=dataSet.getCircleSize() / 2f;
    for (int j=0; j < buffer.size(); j+=2) {
      float x=buffer.buffer[j];
      float y=buffer.buffer[j + 1];
      if (!mViewPortHandler.isInBoundsRight(x))       break;
      if (!mViewPortHandler.isInBoundsLeft(x) || !mViewPortHandler.isInBoundsY(y))       continue;
      mRenderPaint.setColor(dataSet.getCircleColor(j / 2));
      c.drawCircle(x,y,dataSet.getCircleSize(),mRenderPaint);
      if (dataSet.isDrawCircleHoleEnabled())       c.drawCircle(x,y,halfsize,mCirclePaintInner);
    }
  }
}
Program: 18550
Project: 18550
Buggy source:
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  int maxx=mMaxX;
  int minx=mMinX;
  if (maxx > mXAxis.getValues().size())   maxx=mXAxis.getValues().size();
  if (minx < 0)   minx=0;
  for (int i=minx; i <= maxx; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisPaint);
    }
  }
}

Fixed version (ground truth):
/** 
 * draws the x-labels on the specified y-position
 * @param pos
 */
protected void drawLabels(Canvas c,float pos){
  float[] position=new float[]{0f,0f};
  int maxx=mMaxX;
  int minx=mMinX;
  if (maxx >= mXAxis.getValues().size())   maxx=mXAxis.getValues().size() - 1;
  if (minx < 0)   minx=0;
  for (int i=minx; i <= maxx; i+=mXAxis.mAxisLabelModulus) {
    position[0]=i;
    mTrans.pointValuesToPixel(position);
    if (mViewPortHandler.isInBoundsX(position[0])) {
      String label=mXAxis.getValues().get(i);
      if (mXAxis.isAvoidFirstLastClippingEnabled()) {
        if (i == mXAxis.getValues().size() - 1 && mXAxis.getValues().size() > 1) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          if (width > mViewPortHandler.offsetRight() * 2 && position[0] + width > mViewPortHandler.getChartWidth())           position[0]-=width / 2;
        }
 else         if (i == 0) {
          float width=Utils.calcTextWidth(mAxisPaint,label);
          position[0]+=width / 2;
        }
      }
      c.drawText(label,position[0],pos,mAxisPaint);
    }
  }
}
Program: 18551
Project: 18551
Buggy source:
private void setData(int count,float range){
  ArrayList<String> xVals=new ArrayList<String>();
  for (int i=0; i < count; i++) {
    xVals.add((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=0; i < count; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  set1.setFillColor(ColorTemplate.getHoloBlue());
  LineData data=new LineData(xVals,set1);
  data.setValueTypeface(tf);
  data.setValueTextSize(9f);
  data.setDrawValues(false);
  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((1990 + i) + "String_Node_Str");
  }
  ArrayList<Entry> vals1=new ArrayList<Entry>();
  for (int i=5; i < count - 5; i++) {
    float mult=(range + 1);
    float val=(float)(Math.random() * mult) + 20;
    vals1.add(new Entry(val,i));
  }
  LineDataSet set1=new LineDataSet(vals1,"String_Node_Str");
  set1.setDrawCubic(true);
  set1.setCubicIntensity(0.2f);
  set1.setDrawCircles(false);
  set1.setLineWidth(2f);
  set1.setCircleSize(5f);
  set1.setHighLightColor(Color.rgb(244,117,117));
  set1.setColor(Color.rgb(104,241,175));
  set1.setFillColor(ColorTemplate.getHoloBlue());
  LineData data=new LineData(xVals,set1);
  data.setValueTypeface(tf);
  data.setValueTextSize(9f);
  data.setDrawValues(false);
  mChart.setData(data);
}