nus-yam/ex-repair huggingface dataset:
Program: 18178
Project: 18178
Buggy source:
protected void calculateLegendOffsets(RectF offsets){
  offsets.left=0.f;
  offsets.right=0.f;
  offsets.top=0.f;
  offsets.bottom=0.f;
  if (mLegend != null && mLegend.isEnabled() && !mLegend.isDrawInsideEnabled()) {
switch (mLegend.getOrientation()) {
case VERTICAL:
switch (mLegend.getHorizontalAlignment()) {
case LEFT:
        offsets.left+=Math.min(mLegend.mNeededWidth,mViewPortHandler.getChartWidth() * mLegend.getMaxSizePercent()) + mLegend.getXOffset();
      break;
case RIGHT:
    offsets.right+=Math.min(mLegend.mNeededWidth,mViewPortHandler.getChartWidth() * mLegend.getMaxSizePercent()) + mLegend.getXOffset();
  break;
case CENTER:
switch (mLegend.getVerticalAlignment()) {
case TOP:
  offsets.top+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
case BOTTOM:
offsets.bottom+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
default :
break;
}
}
break;
case HORIZONTAL:
switch (mLegend.getVerticalAlignment()) {
case TOP:
offsets.top+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
if (getXAxis().isEnabled() && getXAxis().isDrawLabelsEnabled()) offsets.top+=getXAxis().mLabelRotatedHeight;
break;
case BOTTOM:
offsets.bottom+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
if (getXAxis().isEnabled() && getXAxis().isDrawLabelsEnabled()) offsets.bottom+=getXAxis().mLabelRotatedHeight;
break;
default :
break;
}
break;
}
}
}

Fixed version (ground truth):
protected void calculateLegendOffsets(RectF offsets){
  offsets.left=0.f;
  offsets.right=0.f;
  offsets.top=0.f;
  offsets.bottom=0.f;
  if (mLegend != null && mLegend.isEnabled() && !mLegend.isDrawInsideEnabled()) {
switch (mLegend.getOrientation()) {
case VERTICAL:
switch (mLegend.getHorizontalAlignment()) {
case LEFT:
        offsets.left+=Math.min(mLegend.mNeededWidth,mViewPortHandler.getChartWidth() * mLegend.getMaxSizePercent()) + mLegend.getXOffset();
      break;
case RIGHT:
    offsets.right+=Math.min(mLegend.mNeededWidth,mViewPortHandler.getChartWidth() * mLegend.getMaxSizePercent()) + mLegend.getXOffset();
  break;
case CENTER:
switch (mLegend.getVerticalAlignment()) {
case TOP:
  offsets.top+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
case BOTTOM:
offsets.bottom+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
default :
break;
}
}
break;
case HORIZONTAL:
switch (mLegend.getVerticalAlignment()) {
case TOP:
offsets.top+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
case BOTTOM:
offsets.bottom+=Math.min(mLegend.mNeededHeight,mViewPortHandler.getChartHeight() * mLegend.getMaxSizePercent()) + mLegend.getYOffset();
break;
default :
break;
}
break;
}
}
}
Program: 18180
Project: 18180
Buggy source:
/** 
 * Draws the zero line.
 */
protected void drawZeroLine(Canvas c){
  int clipRestoreCount=c.save();
  mZeroLineClippingRect.set(mViewPortHandler.getContentRect());
  mZeroLineClippingRect.inset(0.f,-mYAxis.getZeroLineWidth() / 2.f);
  c.clipRect(mLimitLineClippingRect);
  MPPointD pos=mTrans.getPixelForValues(0f,0f);
  mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
  mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());
  Path zeroLinePath=mDrawZeroLinePath;
  zeroLinePath.reset();
  zeroLinePath.moveTo(mViewPortHandler.contentLeft(),(float)pos.y - 1);
  zeroLinePath.lineTo(mViewPortHandler.contentRight(),(float)pos.y - 1);
  c.drawPath(zeroLinePath,mZeroLinePaint);
  c.restoreToCount(clipRestoreCount);
}

Fixed version (ground truth):
/** 
 * Draws the zero line.
 */
protected void drawZeroLine(Canvas c){
  int clipRestoreCount=c.save();
  mZeroLineClippingRect.set(mViewPortHandler.getContentRect());
  mZeroLineClippingRect.inset(0.f,-mYAxis.getZeroLineWidth() / 2.f);
  c.clipRect(mZeroLineClippingRect);
  MPPointD pos=mTrans.getPixelForValues(0f,0f);
  mZeroLinePaint.setColor(mYAxis.getZeroLineColor());
  mZeroLinePaint.setStrokeWidth(mYAxis.getZeroLineWidth());
  Path zeroLinePath=mDrawZeroLinePath;
  zeroLinePath.reset();
  zeroLinePath.moveTo(mViewPortHandler.contentLeft(),(float)pos.y - 1);
  zeroLinePath.lineTo(mViewPortHandler.contentRight(),(float)pos.y - 1);
  c.drawPath(zeroLinePath,mZeroLinePaint);
  c.restoreToCount(clipRestoreCount);
}
Program: 18183
Project: 18183
Buggy source:
/** 
 * Returns the Description object of the chart.
 * @return
 */
public Description getDescription(){
  return mDescription;
}

Fixed version (ground truth):
/** 
 * Returns the Description object of the chart that is responsible for holding all information related to the description text that is displayed in the bottom right corner of the chart (by default).
 * @return
 */
public Description getDescription(){
  return mDescription;
}
Program: 18189
Project: 18189
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_scatterchart);
  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=(ScatterChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawGridBackground(false);
  mChart.setTouchEnabled(true);
  mChart.setMaxHighlightDistance(50f);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setMaxVisibleValueCount(200);
  mChart.setPinchZoom(true);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setTypeface(mTfLight);
  YAxis yl=mChart.getAxisLeft();
  yl.setTypeface(mTfLight);
  yl.setAxisMinValue(0f);
  mChart.getAxisRight().setEnabled(false);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(mTfLight);
  xl.setDrawGridLines(false);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_scatterchart);
  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=(ScatterChart)findViewById(R.id.chart1);
  mChart.setDescription("String_Node_Str");
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawGridBackground(false);
  mChart.setTouchEnabled(true);
  mChart.setMaxHighlightDistance(50f);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setMaxVisibleValueCount(200);
  mChart.setPinchZoom(true);
  mSeekBarX.setProgress(45);
  mSeekBarY.setProgress(100);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  l.setTypeface(mTfLight);
  l.setXOffset(5f);
  YAxis yl=mChart.getAxisLeft();
  yl.setTypeface(mTfLight);
  yl.setAxisMinValue(0f);
  mChart.getAxisRight().setEnabled(false);
  XAxis xl=mChart.getXAxis();
  xl.setTypeface(mTfLight);
  xl.setDrawGridLines(false);
}
Program: 18190
Project: 18190
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param high         - the highlight object
 * @param callListener - call the listener
 */
public void highlightValue(Highlight high,boolean callListener){
  Entry e=null;
  if (high == null)   mIndicesToHighlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    e=mData.getEntryForHighlight(high);
    if (e == null) {
      mIndicesToHighlight=null;
      high=null;
    }
 else {
      mIndicesToHighlight=new Highlight[]{high};
    }
  }
  if (callListener && mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      mSelectionListener.onValueSelected(e,high);
    }
  }
  invalidate();
}

Fixed version (ground truth):
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param high         - the highlight object
 * @param callListener - call the listener
 */
public void highlightValue(Highlight high,boolean callListener){
  Entry e=null;
  if (high == null)   mIndicesToHighlight=null;
 else {
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + high.toString());
    e=mData.getEntryForHighlight(high);
    if (e == null) {
      mIndicesToHighlight=null;
      high=null;
    }
 else {
      mIndicesToHighlight=new Highlight[]{high};
    }
  }
  setLastHighlighted(mIndicesToHighlight);
  if (callListener && mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      mSelectionListener.onValueSelected(e,high);
    }
  }
  invalidate();
}
Program: 18191
Project: 18191
Buggy source:
/** 
 * Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting. This should be used to programmatically highlight values. This DOES NOT generate a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightValues(Highlight[] highs){
  mIndicesToHighlight=highs;
  if (highs == null || highs.length <= 0 || highs[0] == null) {
    mChartTouchListener.setLastHighlighted(null);
  }
 else {
    mChartTouchListener.setLastHighlighted(highs[0]);
  }
  invalidate();
}

Fixed version (ground truth):
/** 
 * Highlights the values at the given indices in the given DataSets. Provide null or an empty array to undo all highlighting. This should be used to programmatically highlight values. This DOES NOT generate a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightValues(Highlight[] highs){
  mIndicesToHighlight=highs;
  setLastHighlighted(highs);
  invalidate();
}
Program: 18193
Project: 18193
Buggy source:
/** 
 * Enabled/disable granularity control on axis value intervals. If enabled, the axis interval is not allowed to go below a certain granularity. Default: false
 * @param enabled
 */
public void setGranularityEnabled(boolean enabled){
  mGranularityEnabled=true;
}

Fixed version (ground truth):
/** 
 * Enabled/disable granularity control on axis value intervals. If enabled, the axis interval is not allowed to go below a certain granularity. Default: false
 * @param enabled
 */
public void setGranularityEnabled(boolean enabled){
  mGranularityEnabled=enabled;
}
Program: 18194
Project: 18194
Buggy source:
/** 
 * Performs all necessary operations needed for dragging.
 * @param event
 */
private void performDrag(MotionEvent event){
  mLastGesture=ChartGesture.DRAG;
  mMatrix.set(mSavedMatrix);
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  float dX, dY;
  if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null && mChart.getAxis(mClosestDataSetToTouch.getAxisDependency()).isInverted()) {
    if (mChart instanceof HorizontalBarChart) {
      dX=-(event.getX() - mTouchStartPoint.x);
      dY=event.getY() - mTouchStartPoint.y;
    }
 else {
      dX=event.getX() - mTouchStartPoint.x;
      dY=-(event.getY() - mTouchStartPoint.y);
    }
  }
 else {
    dX=event.getX() - mTouchStartPoint.x;
    dY=event.getY() - mTouchStartPoint.y;
  }
  mMatrix.postTranslate(dX,dY);
  if (l != null)   l.onChartTranslate(event,dX,dY);
}

Fixed version (ground truth):
/** 
 * Performs all necessary operations needed for dragging.
 * @param event
 */
private void performDrag(MotionEvent event){
  mLastGesture=ChartGesture.DRAG;
  mMatrix.set(mSavedMatrix);
  OnChartGestureListener l=mChart.getOnChartGestureListener();
  float dX, dY;
  if (inverted()) {
    if (mChart instanceof HorizontalBarChart) {
      dX=-(event.getX() - mTouchStartPoint.x);
      dY=event.getY() - mTouchStartPoint.y;
    }
 else {
      dX=event.getX() - mTouchStartPoint.x;
      dY=-(event.getY() - mTouchStartPoint.y);
    }
  }
 else {
    dX=event.getX() - mTouchStartPoint.x;
    dY=event.getY() - mTouchStartPoint.y;
  }
  mMatrix.postTranslate(dX,dY);
  if (l != null)   l.onChartTranslate(event,dX,dY);
}
Program: 18195
Project: 18195
Buggy source:
/** 
 * returns the correct translation depending on the provided x and y touch points
 * @param x
 * @param y
 * @return
 */
public PointF getTrans(float x,float y){
  ViewPortHandler vph=mChart.getViewPortHandler();
  float xTrans=x - vph.offsetLeft();
  float yTrans=0f;
  if (mChart.isAnyAxisInverted() && mClosestDataSetToTouch != null && mChart.isInverted(mClosestDataSetToTouch.getAxisDependency())) {
    yTrans=-(y - vph.offsetTop());
  }
 else {
    yTrans=-(mChart.getMeasuredHeight() - y - vph.offsetBottom());
  }
  return new PointF(xTrans,yTrans);
}

Fixed version (ground truth):
/** 
 * returns the correct translation depending on the provided x and y touch points
 * @param x
 * @param y
 * @return
 */
public PointF getTrans(float x,float y){
  ViewPortHandler vph=mChart.getViewPortHandler();
  float xTrans=x - vph.offsetLeft();
  float yTrans=0f;
  if (inverted()) {
    yTrans=-(y - vph.offsetTop());
  }
 else {
    yTrans=-(mChart.getMeasuredHeight() - y - vph.offsetBottom());
  }
  return new PointF(xTrans,yTrans);
}
Program: 18196
Project: 18196
Buggy source:
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the BUBBLECHART.
 * @param data
 * @return
 */
public float[] generateTransformedValuesBubble(IBubbleDataSet data,float phaseY,int from,int to){
  final int count=(int)Math.ceil(to - from) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    Entry e=data.getEntryForIndex(j / 2 + from);
    if (e != null) {
      valuePoints[j]=e.getX();
      valuePoints[j + 1]=e.getY() * phaseY;
    }
  }
  getValueToPixelMatrix().mapPoints(valuePoints);
  return valuePoints;
}

Fixed version (ground truth):
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the BUBBLECHART.
 * @param data
 * @return
 */
public float[] generateTransformedValuesBubble(IBubbleDataSet data,float phaseY,int from,int to){
  final int count=(to - from + 1) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    Entry e=data.getEntryForIndex(j / 2 + from);
    if (e != null) {
      valuePoints[j]=e.getX();
      valuePoints[j + 1]=e.getY() * phaseY;
    }
  }
  getValueToPixelMatrix().mapPoints(valuePoints);
  return valuePoints;
}
Program: 18197
Project: 18197
Buggy source:
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the CANDLESTICKCHART.
 * @param data
 * @return
 */
public float[] generateTransformedValuesCandle(ICandleDataSet data,float phaseX,float phaseY,int from,int to){
  final int count=(int)Math.ceil((to - from) * phaseX) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    CandleEntry e=data.getEntryForIndex(j / 2 + from);
    if (e != null) {
      valuePoints[j]=e.getX();
      valuePoints[j + 1]=e.getHigh() * phaseY;
    }
  }
  getValueToPixelMatrix().mapPoints(valuePoints);
  return valuePoints;
}

Fixed version (ground truth):
/** 
 * Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the CANDLESTICKCHART.
 * @param data
 * @return
 */
public float[] generateTransformedValuesCandle(ICandleDataSet data,float phaseX,float phaseY,int from,int to){
  final int count=(int)((to - from) * phaseX + 1) * 2;
  float[] valuePoints=new float[count];
  for (int j=0; j < count; j+=2) {
    CandleEntry e=data.getEntryForIndex(j / 2 + from);
    if (e != null) {
      valuePoints[j]=e.getX();
      valuePoints[j + 1]=e.getHigh() * phaseY;
    }
  }
  getValueToPixelMatrix().mapPoints(valuePoints);
  return valuePoints;
}
Program: 18200
Project: 18200
Buggy source:
/** 
 * Set this to true to make the highlight operation full-bar oriented, false to make it highlight single values (relevant only for stacked). Default: false
 * @param enabled
 */
public void setHighlightFullBarEnabled(boolean enabled){
  mHighlightFullBarEnabled=enabled;
}

Fixed version (ground truth):
/** 
 * Set this to true to make the highlight operation full-bar oriented, false to make it highlight single values (relevant only for stacked). If enabled, highlighting operations will highlight the whole bar, even if only a single stack entry was tapped. Default: false
 * @param enabled
 */
public void setHighlightFullBarEnabled(boolean enabled){
  mHighlightFullBarEnabled=enabled;
}
Program: 18201
Project: 18201
Buggy source:
/** 
 * Highlights the value at the given x-position in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting.
 * @param x
 * @param dataSetIndex
 * @param stackIndex the index inside the stack - only relevant for stacked entries
 */
public void highlightValue(float x,int dataSetIndex,int stackIndex){
  highlightValue(new Highlight(x,dataSetIndex,stackIndex),false);
}

Fixed version (ground truth):
/** 
 * Highlights the value at the given x-position in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting.
 * @param x
 * @param dataSetIndex
 * @param stackIndex   the index inside the stack - only relevant for stacked entries
 */
public void highlightValue(float x,int dataSetIndex,int stackIndex){
  highlightValue(new Highlight(x,dataSetIndex,stackIndex),false);
}
Program: 18202
Project: 18202
Buggy source:
@Override public void renderGridLines(Canvas c){
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] positions=new float[mXAxis.mEntryCount * 2];
  for (int i=0; i < positions.length; i+=2) {
    positions[i]=mXAxis.mEntries[i / 2];
  }
  mTrans.pointValuesToPixel(positions);
  mGridPaint.setColor(mXAxis.getGridColor());
  mGridPaint.setStrokeWidth(mXAxis.getGridLineWidth());
  mGridPaint.setPathEffect(mXAxis.getGridDashPathEffect());
  Path gridLinePath=new Path();
  for (int i=0; i < positions.length; i+=2) {
    float x=positions[i];
    if (x >= mViewPortHandler.offsetLeft() && x <= mViewPortHandler.getChartWidth()) {
      gridLinePath.moveTo(x,mViewPortHandler.contentBottom());
      gridLinePath.lineTo(x,mViewPortHandler.contentTop());
      c.drawPath(gridLinePath,mGridPaint);
    }
    gridLinePath.reset();
  }
}

Fixed version (ground truth):
@Override public void renderGridLines(Canvas c){
  if (!mXAxis.isDrawGridLinesEnabled() || !mXAxis.isEnabled())   return;
  float[] positions=new float[mXAxis.mEntryCount * 2];
  for (int i=0; i < positions.length; i+=2) {
    positions[i]=mXAxis.mEntries[i / 2];
    positions[i + 1]=mXAxis.mEntries[i / 2];
  }
  mTrans.pointValuesToPixel(positions);
  setupGridPaint();
  Path gridLinePath=new Path();
  for (int i=0; i < positions.length; i+=2) {
    drawGridLine(c,positions[i],positions[i + 1],gridLinePath);
  }
}
Program: 18204
Project: 18204
Buggy source:
/** 
 * Constructor for bubbles.
 * @param xValue
 * @param yValue
 * @param bubbleSize
 */
public RealmDemoData(float xValue,float yValue,float bubbleSize){
  this.xValue=xValue;
  this.yValue=yValue;
  this.bubbleSize=bubbleSize;
}

Fixed version (ground truth):
/** 
 * Constructor for pie chart.
 * @param yValue
 * @param label
 */
public RealmDemoData(float yValue,String label){
  this.yValue=yValue;
  this.label=label;
}
Program: 18205
Project: 18205
Buggy source:
protected void writeToDBPie(){
  mRealm.beginTransaction();
  mRealm.clear(RealmDemoData.class);
  float value1=15f + (float)(Math.random() * 8f);
  float value2=15f + (float)(Math.random() * 8f);
  float value3=15f + (float)(Math.random() * 8f);
  float value4=15f + (float)(Math.random() * 8f);
  float value5=100f - value1 - value2- value3- value4;
  float[] values=new float[]{value1,value2,value3,value4,value5};
  String[] xValues=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < values.length; i++) {
    RealmDemoData d=new RealmDemoData(i,values[i]);
    mRealm.copyToRealm(d);
  }
  mRealm.commitTransaction();
}

Fixed version (ground truth):
protected void writeToDBPie(){
  mRealm.beginTransaction();
  mRealm.clear(RealmDemoData.class);
  float value1=15f + (float)(Math.random() * 8f);
  float value2=15f + (float)(Math.random() * 8f);
  float value3=15f + (float)(Math.random() * 8f);
  float value4=15f + (float)(Math.random() * 8f);
  float value5=100f - value1 - value2- value3- value4;
  float[] values=new float[]{value1,value2,value3,value4,value5};
  String[] labels=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < values.length; i++) {
    RealmDemoData d=new RealmDemoData(values[i],labels[i]);
    mRealm.copyToRealm(d);
  }
  mRealm.commitTransaction();
}
Program: 18206
Project: 18206
Buggy source:
private void setData(){
  RealmResults<RealmDemoData> result=mRealm.allObjects(RealmDemoData.class);
  RealmPieDataSet<RealmDemoData> set=new RealmPieDataSet<RealmDemoData>(result,"String_Node_Str");
  set.setColors(ColorTemplate.VORDIPLOM_COLORS);
  set.setLabel("String_Node_Str");
  set.setSliceSpace(2);
  PieData data=new PieData(set);
  styleData(data);
  data.setValueTextColor(Color.WHITE);
  data.setValueTextSize(12f);
  mChart.setData(data);
  mChart.animateY(1400);
}

Fixed version (ground truth):
private void setData(){
  RealmResults<RealmDemoData> result=mRealm.allObjects(RealmDemoData.class);
  RealmPieDataSet<RealmDemoData> set=new RealmPieDataSet<RealmDemoData>(result,"String_Node_Str","String_Node_Str");
  set.setColors(ColorTemplate.VORDIPLOM_COLORS);
  set.setLabel("String_Node_Str");
  set.setSliceSpace(2);
  PieData data=new PieData(set);
  styleData(data);
  data.setValueTextColor(Color.WHITE);
  data.setValueTextSize(12f);
  mChart.setData(data);
  mChart.animateY(1400);
}
Program: 18207
Project: 18207
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_radarchart_noseekbar);
  mChart=(RadarChart)findViewById(R.id.chart1);
  setup(mChart);
  mChart.getYAxis().setEnabled(false);
  mChart.setWebAlpha(180);
  mChart.setWebColorInner(Color.DKGRAY);
  mChart.setWebColor(Color.GRAY);
}

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_radarchart_noseekbar);
  mChart=(RadarChart)findViewById(R.id.chart1);
  setup(mChart);
  mChart.getYAxis().setEnabled(false);
  mChart.getXAxis().setEnabled(false);
  mChart.setWebAlpha(180);
  mChart.setWebColorInner(Color.DKGRAY);
  mChart.setWebColor(Color.GRAY);
}
Program: 18208
Project: 18208
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_realm_wiki);
  lineChart=(LineChart)findViewById(R.id.lineChart);
  barChart=(BarChart)findViewById(R.id.barChart);
  setup(lineChart);
  setup(barChart);
  lineChart.setExtraBottomOffset(5f);
  barChart.setExtraBottomOffset(5f);
  lineChart.getAxisLeft().setDrawGridLines(false);
  lineChart.getXAxis().setDrawGridLines(false);
  barChart.getAxisLeft().setDrawGridLines(false);
  barChart.getXAxis().setDrawGridLines(false);
  barChart.getXAxis().setCenterAxisLabels(true);
}

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_realm_wiki);
  lineChart=(LineChart)findViewById(R.id.lineChart);
  barChart=(BarChart)findViewById(R.id.barChart);
  setup(lineChart);
  setup(barChart);
  lineChart.setExtraBottomOffset(5f);
  barChart.setExtraBottomOffset(5f);
  lineChart.getAxisLeft().setDrawGridLines(false);
  lineChart.getXAxis().setDrawGridLines(false);
  lineChart.getXAxis().setLabelCount(5);
  lineChart.getXAxis().setGranularity(1f);
  barChart.getAxisLeft().setDrawGridLines(false);
  barChart.getXAxis().setDrawGridLines(false);
  barChart.getXAxis().setLabelCount(5);
  barChart.getXAxis().setGranularity(1f);
}
Program: 18210
Project: 18210
Buggy source:
/** 
 * Constructor that takes the realm RealmResults, sorts & stores them.
 * @param results
 * @param yValuesField
 * @param xIndexField
 */
public RealmLineScatterCandleRadarDataSet(RealmResults<T> results,String yValuesField,String xIndexField){
  super(results,yValuesField,xIndexField);
}

Fixed version (ground truth):
/** 
 * Constructor that takes the realm RealmResults, sorts & stores them.
 * @param results
 * @param xValueField
 * @param yValuesField
 */
public RealmLineScatterCandleRadarDataSet(RealmResults<T> results,String xValueField,String yValuesField){
  super(results,xValueField,yValuesField);
}
Program: 18211
Project: 18211
Buggy source:
/** 
 * Constructor for creating a LineDataSet with realm data.
 * @param result      the queried results from the realm database
 * @param highField   the name of the field in your data object that represents the "high" yValue
 * @param lowField    the name of the field in your data object that represents the "low" yValue
 * @param openField   the name of the field in your data object that represents the "open" yValue
 * @param closeField  the name of the field in your data object that represents the "close" yValue
 * @param xIndexField the name of the field in your data object that represents the xPx-index
 */
public RealmCandleDataSet(RealmResults<T> result,String highField,String lowField,String openField,String closeField,String xIndexField){
  super(result,null,xIndexField);
  this.mHighField=highField;
  this.mLowField=lowField;
  this.mOpenField=openField;
  this.mCloseField=closeField;
  build(this.results);
  calcMinMax();
}

Fixed version (ground truth):
/** 
 * Constructor for creating a LineDataSet with realm data.
 * @param result      the queried results from the realm database
 * @param xValueField the name of the field in your data object that represents the "x" value
 * @param highField   the name of the field in your data object that represents the "high" value
 * @param lowField    the name of the field in your data object that represents the "low" value
 * @param openField   the name of the field in your data object that represents the "open" value
 * @param closeField  the name of the field in your data object that represents the "close" value
 */
public RealmCandleDataSet(RealmResults<T> result,String xValueField,String highField,String lowField,String openField,String closeField){
  super(result,xValueField,null);
  this.mHighField=highField;
  this.mLowField=lowField;
  this.mOpenField=openField;
  this.mCloseField=closeField;
  build(this.results);
  calcMinMax();
}
Program: 18212
Project: 18212
Buggy source:
public CandleEntry buildEntryFromResultObject(T realmObject,int xIndex){
  DynamicRealmObject dynamicObject=new DynamicRealmObject(realmObject);
  return new CandleEntry(mXValuesField == null ? xIndex : dynamicObject.getFloat(mXValuesField),dynamicObject.getFloat(mHighField),dynamicObject.getFloat(mLowField),dynamicObject.getFloat(mOpenField),dynamicObject.getFloat(mCloseField));
}

Fixed version (ground truth):
@Override public CandleEntry buildEntryFromResultObject(T realmObject,float x){
  DynamicRealmObject dynamicObject=new DynamicRealmObject(realmObject);
  return new CandleEntry(mXValuesField == null ? x : dynamicObject.getFloat(mXValuesField),dynamicObject.getFloat(mHighField),dynamicObject.getFloat(mLowField),dynamicObject.getFloat(mOpenField),dynamicObject.getFloat(mCloseField));
}
Program: 18213
Project: 18213
Buggy source:
/** 
 * Constructor for creating a PieDataSet with realm data.
 * @param result       the queried results from the realm database
 * @param yValuesField the name of the field in your data object that represents the yPx-yValue
 */
public RealmPieDataSet(RealmResults<T> result,String yValuesField){
  super(result,yValuesField);
  build(this.results);
  calcMinMax();
}

Fixed version (ground truth):
public RealmPieDataSet(RealmResults<T> result,String yValuesField,String labelField){
  super(result,yValuesField);
  this.mLabelField=labelField;
  build(this.results);
  calcMinMax();
}
Program: 18215
Project: 18215
Buggy source:
protected void prepareBarHighlight(float x,float y1,float y2,float barWidthHalf,Transformer trans){
  float left=x - barWidthHalf;
  float right=x + barWidthHalf;
  float top=y1;
  float bottom=y2;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
protected void prepareBarHighlight(float x,float y1,float y2,float barWidthHalf,Transformer trans){
  float left=x - barWidthHalf;
  float right=x + barWidthHalf;
  float top=y1;
  float bottom=y2;
  mBarRect.set(left,top,right,bottom);
  trans.rectToPixelPhase(mBarRect,mAnimator.getPhaseY());
}
Program: 18216
Project: 18216
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  BarData barData=mChart.getBarData();
  for (  Highlight high : indices) {
    final int minDataSetIndex=high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex();
    final int maxDataSetIndex=high.getDataSetIndex() == -1 ? barData.getDataSetCount() : (high.getDataSetIndex() + 1);
    if (maxDataSetIndex - minDataSetIndex < 1)     continue;
    for (int dataSetIndex=minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) {
      IBarDataSet set=barData.getDataSetByIndex(dataSetIndex);
      if (set == null || !set.isHighlightEnabled())       continue;
      Transformer trans=mChart.getTransformer(set.getAxisDependency());
      mHighlightPaint.setColor(set.getHighLightColor());
      mHighlightPaint.setAlpha(set.getHighLightAlpha());
      float x=high.getX();
      BarEntry e=set.getEntryForXPos(x);
      if (e == null)       continue;
      boolean isStack=high.getStackIndex() < 0 ? false : true;
      final float y1;
      final float y2;
      if (isStack) {
        y1=high.getRange().from;
        y2=high.getRange().to;
      }
 else {
        y1=e.getY();
        y2=0.f;
      }
      prepareBarHighlight(e.getX(),y1,y2,barData.getBarWidth() / 2f,trans);
      c.drawRect(mBarRect,mHighlightPaint);
    }
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  BarData barData=mChart.getBarData();
  for (  Highlight high : indices) {
    final int minDataSetIndex=high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex();
    final int maxDataSetIndex=high.getDataSetIndex() == -1 ? barData.getDataSetCount() : (high.getDataSetIndex() + 1);
    if (maxDataSetIndex - minDataSetIndex < 1)     continue;
    for (int dataSetIndex=minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) {
      IBarDataSet set=barData.getDataSetByIndex(dataSetIndex);
      if (set == null || !set.isHighlightEnabled())       continue;
      Transformer trans=mChart.getTransformer(set.getAxisDependency());
      mHighlightPaint.setColor(set.getHighLightColor());
      mHighlightPaint.setAlpha(set.getHighLightAlpha());
      float x=high.getX();
      BarEntry e=set.getEntryForXPos(x);
      float entryIndex=set.getEntryIndex(e);
      if (e == null || entryIndex > set.getEntryCount() * mAnimator.getPhaseX())       continue;
      boolean isStack=high.getStackIndex() < 0 ? false : true;
      final float y1;
      final float y2;
      if (isStack) {
        y1=high.getRange().from;
        y2=high.getRange().to;
      }
 else {
        y1=e.getY();
        y2=0.f;
      }
      prepareBarHighlight(e.getX(),y1,y2,barData.getBarWidth() / 2f,trans);
      c.drawRect(mBarRect,mHighlightPaint);
    }
  }
}
Program: 18217
Project: 18217
Buggy source:
@Override protected void prepareBarHighlight(float x,float y1,float y2,float barWidthHalf,Transformer trans){
  float top=x - barWidthHalf;
  float bottom=x + barWidthHalf;
  float left=y1;
  float right=y2;
  mBarRect.set(left,top,right,bottom);
  trans.rectValueToPixel(mBarRect,mAnimator.getPhaseY());
}

Fixed version (ground truth):
@Override protected void prepareBarHighlight(float x,float y1,float y2,float barWidthHalf,Transformer trans){
  float top=x - barWidthHalf;
  float bottom=x + barWidthHalf;
  float left=y1;
  float right=y2;
  mBarRect.set(left,top,right,bottom);
  trans.rectToPixelPhaseHorizontal(mBarRect,mAnimator.getPhaseY());
}
Program: 18218
Project: 18218
Buggy source:
/** 
 * Transform a rectangle with all matrices with potential animation phases.
 * @param r
 * @param phaseY
 */
public void rectValueToPixel(RectF r,float phaseY){
  r.top*=phaseY;
  r.bottom*=phaseY;
  mMatrixValueToPx.mapRect(r);
  mViewPortHandler.getMatrixTouch().mapRect(r);
  mMatrixOffset.mapRect(r);
}

Fixed version (ground truth):
/** 
 * Transform a rectangle with all matrices.
 * @param r
 */
public void rectValueToPixel(RectF r){
  mMatrixValueToPx.mapRect(r);
  mViewPortHandler.getMatrixTouch().mapRect(r);
  mMatrixOffset.mapRect(r);
}
Program: 18220
Project: 18220
Buggy source:
@Override public void notifyDataSetChanged(){
  if (mData == null) {
    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();
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum,mAxisLeft.isInverted());
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum,mAxisRight.isInverted());
  if (mLegend != null)   mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mData == null) {
    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();
  mAxisRendererLeft.computeAxis(mAxisLeft.mAxisMinimum,mAxisLeft.mAxisMaximum,mAxisLeft.isInverted());
  mAxisRendererRight.computeAxis(mAxisRight.mAxisMinimum,mAxisRight.mAxisMaximum,mAxisRight.isInverted());
  mXAxisRenderer.computeAxis(mXAxis.mAxisMinimum,mXAxis.mAxisMaximum,false);
  if (mLegend != null)   mLegendRenderer.computeLegend(mData);
  calculateOffsets();
}
Program: 18221
Project: 18221
Buggy source:
@Override public void renderAxisLabels(Canvas c){
  if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())   return;
  float yoffset=mXAxis.getYOffset();
  mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
  mAxisLabelPaint.setColor(mXAxis.getTextColor());
  if (mXAxis.getPosition() == XAxisPosition.TOP) {
    drawLabels(c,mViewPortHandler.contentTop() - yoffset,new PointF(0.5f,1.0f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
    drawLabels(c,mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight,new PointF(0.5f,1.0f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
    drawLabels(c,mViewPortHandler.contentBottom() + yoffset,new PointF(0.5f,0.0f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
    drawLabels(c,mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight,new PointF(0.5f,0.0f));
  }
 else {
    drawLabels(c,mViewPortHandler.contentTop() - yoffset,new PointF(0.5f,1.0f));
    drawLabels(c,mViewPortHandler.contentBottom() + yoffset,new PointF(0.5f,0.0f));
  }
}

Fixed version (ground truth):
@Override public void renderAxisLabels(Canvas c){
  if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())   return;
  float yoffset=mXAxis.getYOffset();
  mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
  mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
  mAxisLabelPaint.setColor(mXAxis.getTextColor());
  if (mXAxis.getPosition() == XAxisPosition.TOP) {
    drawLabels(c,mViewPortHandler.contentTop() - yoffset,new PointF(0.5f,0.9f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
    drawLabels(c,mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight,new PointF(0.5f,1.0f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
    drawLabels(c,mViewPortHandler.contentBottom() + yoffset,new PointF(0.5f,0.0f));
  }
 else   if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
    drawLabels(c,mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight,new PointF(0.5f,0.0f));
  }
 else {
    drawLabels(c,mViewPortHandler.contentTop() - yoffset,new PointF(0.5f,1.0f));
    drawLabels(c,mViewPortHandler.contentBottom() + yoffset,new PointF(0.5f,0.0f));
  }
}
Program: 18224
Project: 18224
Buggy source:
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  BarData barData=mChart.getBarData();
  int setCount=barData.getDataSetCount();
  for (  Highlight high : indices) {
    final int minDataSetIndex=high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex();
    final int maxDataSetIndex=high.getDataSetIndex() == -1 ? barData.getDataSetCount() : (high.getDataSetIndex() + 1);
    if (maxDataSetIndex - minDataSetIndex < 1)     continue;
    for (int dataSetIndex=minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) {
      IBarDataSet set=barData.getDataSetByIndex(dataSetIndex);
      if (set == null || !set.isHighlightEnabled())       continue;
      Transformer trans=mChart.getTransformer(set.getAxisDependency());
      mHighlightPaint.setColor(set.getHighLightColor());
      mHighlightPaint.setAlpha(set.getHighLightAlpha());
      float x=high.getX();
      BarEntry e=set.getEntryForXPos(x);
      int entryIndex=set.getEntryIndex(e);
      if (e == null)       continue;
      boolean isStack=high.getStackIndex() < 0 ? false : true;
      final float y1;
      final float y2;
      if (isStack) {
        y1=high.getRange().from;
        y2=high.getRange().to;
      }
 else {
        y1=e.getY();
        y2=0.f;
      }
      prepareBarHighlight(e.getX(),y1,y2,barData.getBarWidth() / 2f,trans);
      c.drawRect(mBarRect,mHighlightPaint);
    }
  }
}

Fixed version (ground truth):
@Override public void drawHighlighted(Canvas c,Highlight[] indices){
  BarData barData=mChart.getBarData();
  for (  Highlight high : indices) {
    final int minDataSetIndex=high.getDataSetIndex() == -1 ? 0 : high.getDataSetIndex();
    final int maxDataSetIndex=high.getDataSetIndex() == -1 ? barData.getDataSetCount() : (high.getDataSetIndex() + 1);
    if (maxDataSetIndex - minDataSetIndex < 1)     continue;
    for (int dataSetIndex=minDataSetIndex; dataSetIndex < maxDataSetIndex; dataSetIndex++) {
      IBarDataSet set=barData.getDataSetByIndex(dataSetIndex);
      if (set == null || !set.isHighlightEnabled())       continue;
      Transformer trans=mChart.getTransformer(set.getAxisDependency());
      mHighlightPaint.setColor(set.getHighLightColor());
      mHighlightPaint.setAlpha(set.getHighLightAlpha());
      float x=high.getX();
      BarEntry e=set.getEntryForXPos(x);
      int entryIndex=set.getEntryIndex(e);
      if (e == null)       continue;
      boolean isStack=high.getStackIndex() < 0 ? false : true;
      final float y1;
      final float y2;
      if (isStack) {
        y1=high.getRange().from;
        y2=high.getRange().to;
      }
 else {
        y1=e.getY();
        y2=0.f;
      }
      prepareBarHighlight(e.getX(),y1,y2,barData.getBarWidth() / 2f,trans);
      c.drawRect(mBarRect,mHighlightPaint);
    }
  }
}
Program: 18225
Project: 18225
Buggy source:
/** 
 * Returns the lowest xPx-index (yValue on the xPx-axis) that is still visible on the chart.
 * @return
 */
@Override public float getLowestVisibleX(){
  PointD pos=getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
  return (float)Math.min(mXAxis.mAxisMinimum,pos.x);
}

Fixed version (ground truth):
/** 
 * Returns the lowest xPx-index (yValue on the xPx-axis) that is still visible on the chart.
 * @return
 */
@Override public float getLowestVisibleX(){
  PointD pos=getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
  return (float)Math.max(mXAxis.mAxisMinimum,pos.x);
}
Program: 18226
Project: 18226
Buggy source:
@Override public float getLowestVisibleX(){
  PointD pos=getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
  return (float)Math.min(mXAxis.mAxisMinimum,pos.y);
}

Fixed version (ground truth):
@Override public float getLowestVisibleX(){
  PointD pos=getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(mViewPortHandler.contentLeft(),mViewPortHandler.contentBottom());
  return (float)Math.max(mXAxis.mAxisMinimum,pos.y);
}
Program: 18227
Project: 18227
Buggy source:
public static List<BarEntry> loadBarEntriesFromAssets(AssetManager am,String path){
  List<BarEntry> entries=new ArrayList<BarEntry>();
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new InputStreamReader(am.open(path),"String_Node_Str"));
    String line=reader.readLine();
    while (line != null) {
      String[] split=line.split("String_Node_Str");
      entries.add(new BarEntry(Float.parseFloat(split[1]),Integer.parseInt(split[0])));
      line=reader.readLine();
    }
  }
 catch (  IOException e) {
    Log.e(LOG,e.toString());
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        Log.e(LOG,e.toString());
      }
    }
  }
  return entries;
}

Fixed version (ground truth):
public static List<BarEntry> loadBarEntriesFromAssets(AssetManager am,String path){
  List<BarEntry> entries=new ArrayList<BarEntry>();
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new InputStreamReader(am.open(path),"String_Node_Str"));
    String line=reader.readLine();
    while (line != null) {
      String[] split=line.split("String_Node_Str");
      entries.add(new BarEntry(Float.parseFloat(split[1]),Float.parseFloat(split[0])));
      line=reader.readLine();
    }
  }
 catch (  IOException e) {
    Log.e(LOG,e.toString());
  }
 finally {
    if (reader != null) {
      try {
        reader.close();
      }
 catch (      IOException e) {
        Log.e(LOG,e.toString());
      }
    }
  }
  return entries;
}
Program: 18230
Project: 18230
Buggy source:
@Override protected void calcMinMax(){
  super.calcMinMax();
  calcAngles();
}

Fixed version (ground truth):
@Override protected void calcMinMax(){
  calcAngles();
}
Program: 18231
Project: 18231
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  float[] pts=new float[2];
  if (mKeepPositionOnRotation) {
    pts[0]=mViewPortHandler.contentLeft();
    pts[1]=mViewPortHandler.contentTop();
    getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  }
  super.onSizeChanged(w,h,oldw,oldh);
  if (mKeepPositionOnRotation) {
    getTransformer(AxisDependency.LEFT).pointValuesToPixel(pts);
    mViewPortHandler.centerViewPort(pts,this);
  }
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  float[] pts=new float[2];
  if (mKeepPositionOnRotation) {
    pts[0]=mViewPortHandler.contentLeft();
    pts[1]=mViewPortHandler.contentTop();
    getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
  }
  super.onSizeChanged(w,h,oldw,oldh);
  if (mKeepPositionOnRotation) {
    getTransformer(AxisDependency.LEFT).pointValuesToPixel(pts);
    mViewPortHandler.centerViewPort(pts,this);
  }
 else {
    mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(),this,true);
  }
}
Program: 18232
Project: 18232
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.setViewPortOffsets(0,20,0,0);
  mChart.setBackgroundColor(Color.rgb(104,241,175));
  mChart.setDescription("String_Node_Str");
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis x=mChart.getXAxis();
  x.setEnabled(false);
  YAxis y=mChart.getAxisLeft();
  y.setTypeface(tf);
  y.setLabelCount(6,false);
  y.setTextColor(Color.WHITE);
  y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
  y.setDrawGridLines(false);
  y.setAxisLineColor(Color.WHITE);
  mChart.getAxisRight().setEnabled(false);
  setData(45,100);
  mChart.getLegend().setEnabled(false);
  mChart.animateXY(2000,2000);
  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.setViewPortOffsets(0,0,0,0);
  mChart.setBackgroundColor(Color.rgb(104,241,175));
  mChart.setDescription("String_Node_Str");
  mChart.setTouchEnabled(true);
  mChart.setDragEnabled(true);
  mChart.setScaleEnabled(true);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis x=mChart.getXAxis();
  x.setEnabled(false);
  YAxis y=mChart.getAxisLeft();
  y.setTypeface(tf);
  y.setLabelCount(6,false);
  y.setTextColor(Color.WHITE);
  y.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
  y.setDrawGridLines(false);
  y.setAxisLineColor(Color.WHITE);
  mChart.getAxisRight().setEnabled(false);
  setData(45,100);
  mChart.getLegend().setEnabled(false);
  mChart.animateXY(2000,2000);
  mChart.invalidate();
}