nus-yam/ex-repair huggingface dataset:
Program: 26791
Project: 26791
Buggy source:
@Override protected void init(){
  super.init();
  mLeftAxisTransformer=new Transformer(mViewPortHandler);
  mRightAxisTransformer=new Transformer(mViewPortHandler);
  mAxisRendererLeft=new YAxisRenderer(mViewPortHandler,mAxisLeft,mLeftAxisTransformer);
  mAxisRendererRight=new YAxisRenderer(mViewPortHandler,mAxisRight,mRightAxisTransformer);
  mXAxisRenderer=new XAxisRenderer(mViewPortHandler,mXAxis,mLeftAxisTransformer);
  mListener=new BarLineChartTouchListener(this,mViewPortHandler.getMatrixTouch());
  mBorderPaint=new Paint();
  mBorderPaint.setColor(Color.BLACK);
  mBorderPaint.setStrokeWidth(mGridWidth * 2f);
  mBorderPaint.setStyle(Style.STROKE);
  mGridBackgroundPaint=new Paint();
  mGridBackgroundPaint.setStyle(Style.FILL);
  mGridBackgroundPaint.setColor(Color.rgb(240,240,240));
}

Fixed version (ground truth):
@Override protected void init(){
  super.init();
  mAxisLeft=new YAxis(AxisDependency.LEFT);
  mAxisRight=new YAxis(AxisDependency.RIGHT);
  mXAxis=new XAxis();
  mLeftAxisTransformer=new Transformer(mViewPortHandler);
  mRightAxisTransformer=new Transformer(mViewPortHandler);
  mAxisRendererLeft=new YAxisRenderer(mViewPortHandler,mAxisLeft,mLeftAxisTransformer);
  mAxisRendererRight=new YAxisRenderer(mViewPortHandler,mAxisRight,mRightAxisTransformer);
  mXAxisRenderer=new XAxisRenderer(mViewPortHandler,mXAxis,mLeftAxisTransformer);
  mListener=new BarLineChartTouchListener(this,mViewPortHandler.getMatrixTouch());
  mBorderPaint=new Paint();
  mBorderPaint.setColor(Color.BLACK);
  mBorderPaint.setStrokeWidth(mGridWidth * 2f);
  mBorderPaint.setStyle(Style.STROKE);
  mGridBackgroundPaint=new Paint();
  mGridBackgroundPaint.setStyle(Style.FILL);
  mGridBackgroundPaint.setColor(Color.rgb(240,240,240));
}
Program: 26792
Project: 26792
Buggy source:
@Override public void notifyDataSetChanged(){
  if (!mFixedYValues) {
    prepare();
    mRightAxisTransformer.prepareMatrixValuePx(this,mDeltaX,mDeltaY);
    mLeftAxisTransformer.prepareMatrixValuePx(this,mDeltaX,mDeltaY);
  }
 else {
    calcMinMax(mFixedYValues);
  }
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (!mFixedYValues) {
    prepare();
    mRightAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaY,mYChartMin);
    mLeftAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaY,mYChartMin);
  }
 else {
    calcMinMax(mFixedYValues);
  }
}
Program: 26793
Project: 26793
Buggy source:
/** 
 * Sets up all the matrices that will be used for scaling the coordinates to the display. Offset and Value-px.
 */
protected void prepareMatrix(){
  mRightAxisTransformer.prepareMatrixValuePx(this,mDeltaX,mDeltaY);
  mLeftAxisTransformer.prepareMatrixValuePx(this,mDeltaX,mDeltaY);
  mRightAxisTransformer.prepareMatrixOffset(mViewPortHandler,mAxisRight.isInverted());
  mLeftAxisTransformer.prepareMatrixOffset(mViewPortHandler,mAxisLeft.isInverted());
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Sets up all the matrices that will be used for scaling the coordinates to the display. Offset and Value-px.
 */
protected void prepareMatrix(){
  mRightAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaY,mYChartMin);
  mLeftAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaY,mYChartMin);
  mRightAxisTransformer.prepareMatrixOffset(mViewPortHandler,mAxisRight.isInverted());
  mLeftAxisTransformer.prepareMatrixOffset(mViewPortHandler,mAxisLeft.isInverted());
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
}
Program: 26795
Project: 26795
Buggy source:
/** 
 * calculates the modulus for x-labels and grid
 */
protected void calcModulus(){
  float[] values=new float[9];
  mViewPortHandler.getMatrixTouch().getValues(values);
  mXAxis.mXAxisLabelModulus=(int)Math.ceil((mData.getXValCount() * mXAxis.mLabelWidth) / (mViewPortHandler.contentWidth() * values[Matrix.MSCALE_X]));
}

Fixed version (ground truth):
/** 
 * calculates the modulus for x-labels and grid
 */
protected void calcModulus(){
  float[] values=new float[9];
  mViewPortHandler.getMatrixTouch().getValues(values);
  mXAxis.mAxisLabelModulus=(int)Math.ceil((mData.getXValCount() * mXAxis.mLabelWidth) / (mViewPortHandler.contentWidth() * values[Matrix.MSCALE_X]));
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str" + mXAxis.mAxisLabelModulus + "String_Node_Str"+ mXAxis.mLabelWidth+ "String_Node_Str"+ mViewPortHandler.contentWidth());
}
Program: 26796
Project: 26796
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_barchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mChart=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawValueAboveBar(true);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  mChart.setValueTextSize(10f);
  mChart.setDrawBorder(false);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis xl=mChart.getXAxis();
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  xl.setDrawGridLines(false);
  YAxis yl=mChart.getAxisLeft();
  yl.setTypeface(tf);
  yl.setLabelCount(8);
  mChart.getAxisRight().setDrawGridLines(false);
  mChart.setValueTypeface(tf);
  setData(12,50);
  mSeekBarY.setProgress(50);
  mSeekBarX.setProgress(12);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_LEFT);
  l.setFormSize(8f);
  l.setXEntrySpace(4f);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.activity_barchart);
  tvX=(TextView)findViewById(R.id.tvXMax);
  tvY=(TextView)findViewById(R.id.tvYMax);
  mSeekBarX=(SeekBar)findViewById(R.id.seekBar1);
  mSeekBarY=(SeekBar)findViewById(R.id.seekBar2);
  mChart=(BarChart)findViewById(R.id.chart1);
  mChart.setOnChartValueSelectedListener(this);
  mChart.setDrawValueAboveBar(true);
  mChart.setDescription("String_Node_Str");
  mChart.setMaxVisibleValueCount(60);
  mChart.setPinchZoom(false);
  mChart.setDrawGridBackground(false);
  mChart.setValueTextSize(10f);
  mChart.setDrawBorder(false);
  Typeface tf=Typeface.createFromAsset(getAssets(),"String_Node_Str");
  XAxis xl=mChart.getXAxis();
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setCenterXLabelText(true);
  xl.setTypeface(tf);
  xl.setDrawGridLines(false);
  YAxis leftAxis=mChart.getAxisLeft();
  leftAxis.setTypeface(tf);
  leftAxis.setLabelCount(8);
  YAxis rightAxis=mChart.getAxisRight();
  rightAxis.setDrawGridLines(false);
  rightAxis.setTypeface(tf);
  rightAxis.setLabelCount(8);
  mChart.setValueFormatter(new MyValueFormatter());
  mChart.setValueTypeface(tf);
  setData(12,50);
  mSeekBarY.setProgress(50);
  mSeekBarX.setProgress(12);
  mSeekBarY.setOnSeekBarChangeListener(this);
  mSeekBarX.setOnSeekBarChangeListener(this);
  Legend l=mChart.getLegend();
  l.setPosition(LegendPosition.BELOW_CHART_LEFT);
  l.setFormSize(8f);
  l.setXEntrySpace(4f);
}
Program: 26797
Project: 26797
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XAxis xl=holder.chart.getXAxis();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  xl.setDrawGridLines(false);
  YAxis yl=holder.chart.getAxisLeft();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData(c);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  BarData c=getItem(position);
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(getContext()).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  holder.chart.setValueTextColor(Color.WHITE);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setCenterXLabelText(true);
  xAxis.setPosition(XLabelPosition.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(c);
  holder.chart.animateY(700);
  return convertView;
}
Program: 26798
Project: 26798
Buggy source:
/** 
 * generates a random ChartData object with just one DataSet
 * @return
 */
private LineData generateDataLine(int cnt){
  ArrayList<Entry> e1=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e1.add(new Entry((int)(Math.random() * 65) + 40,i));
  }
  LineDataSet d1=new LineDataSet(e1,"String_Node_Str" + cnt + "String_Node_Str");
  d1.setLineWidth(3f);
  d1.setCircleSize(5f);
  d1.setHighLightColor(Color.rgb(244,117,117));
  ArrayList<Entry> e2=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e2.add(new Entry(e1.get(i).getVal() - 30,i));
  }
  LineDataSet d2=new LineDataSet(e2,"String_Node_Str" + cnt + "String_Node_Str");
  d2.setLineWidth(3f);
  d2.setCircleSize(5f);
  d2.setHighLightColor(Color.rgb(244,117,117));
  d2.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  ArrayList<LineDataSet> sets=new ArrayList<LineDataSet>();
  sets.add(d1);
  sets.add(d2);
  LineData cd=new LineData(getMonths(),sets);
  return cd;
}

Fixed version (ground truth):
/** 
 * generates a random ChartData object with just one DataSet
 * @return
 */
private LineData generateDataLine(int cnt){
  ArrayList<Entry> e1=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e1.add(new Entry((int)(Math.random() * 65) + 40,i));
  }
  LineDataSet d1=new LineDataSet(e1,"String_Node_Str" + cnt + "String_Node_Str");
  d1.setLineWidth(3f);
  d1.setCircleSize(5f);
  d1.setHighLightColor(Color.rgb(244,117,117));
  d1.setDrawValues(false);
  ArrayList<Entry> e2=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e2.add(new Entry(e1.get(i).getVal() - 30,i));
  }
  LineDataSet d2=new LineDataSet(e2,"String_Node_Str" + cnt + "String_Node_Str");
  d2.setLineWidth(3f);
  d2.setCircleSize(5f);
  d2.setHighLightColor(Color.rgb(244,117,117));
  d2.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setDrawValues(false);
  ArrayList<LineDataSet> sets=new ArrayList<LineDataSet>();
  sets.add(d1);
  sets.add(d2);
  LineData cd=new LineData(getMonths(),sets);
  return cd;
}
Program: 26799
Project: 26799
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XAxis xl=holder.chart.getXAxis();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  xl.setDrawGridLines(false);
  YAxis yl=holder.chart.getAxisLeft();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((BarData)mChartData);
  holder.chart.animateY(700);
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_barchart,null);
    holder.chart=(BarChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  holder.chart.setDrawBarShadow(false);
  XAxis xAxis=holder.chart.getXAxis();
  xAxis.setCenterXLabelText(true);
  xAxis.setPosition(XLabelPosition.BOTTOM);
  xAxis.setTypeface(mTf);
  xAxis.setDrawGridLines(false);
  YAxis leftAxis=holder.chart.getAxisLeft();
  leftAxis.setTypeface(mTf);
  leftAxis.setLabelCount(5);
  leftAxis.setSpaceTop(20f);
  YAxis rightAxis=holder.chart.getAxisRight();
  rightAxis.setTypeface(mTf);
  rightAxis.setLabelCount(5);
  rightAxis.setSpaceTop(20f);
  holder.chart.setData((BarData)mChartData);
  holder.chart.animateY(700);
  return convertView;
}
Program: 26800
Project: 26800
Buggy source:
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_linechart,null);
    holder.chart=(LineChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setDrawGridBackground(false);
  XAxis xl=holder.chart.getXAxis();
  xl.setCenterXLabelText(true);
  xl.setPosition(XLabelPosition.BOTTOM);
  xl.setTypeface(mTf);
  xl.setDrawGridLines(false);
  YAxis yl=holder.chart.getAxisLeft();
  yl.setTypeface(mTf);
  yl.setLabelCount(5);
  holder.chart.setData((LineData)mChartData);
  holder.chart.animateX(1000);
  return convertView;
}

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

Fixed version (ground truth):
@Override public View getView(int position,View convertView,Context c){
  ViewHolder holder=null;
  if (convertView == null) {
    holder=new ViewHolder();
    convertView=LayoutInflater.from(c).inflate(R.layout.list_item_piechart,null);
    holder.chart=(PieChart)convertView.findViewById(R.id.chart);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.chart.setValueTypeface(mTf);
  holder.chart.setDescription("String_Node_Str");
  holder.chart.setHoleRadius(52f);
  holder.chart.setTransparentCircleRadius(57f);
  holder.chart.setCenterText("String_Node_Str");
  holder.chart.setCenterTextTypeface(mTf);
  holder.chart.setCenterTextSize(18f);
  holder.chart.setValueTextSize(11f);
  holder.chart.setValueFormatter(new PercentFormatter(holder.chart));
  holder.chart.setData((PieData)mChartData);
  Legend l=holder.chart.getLegend();
  l.setPosition(LegendPosition.RIGHT_OF_CHART);
  holder.chart.animateXY(900,900);
  return convertView;
}
Program: 26803
Project: 26803
Buggy source:
private void prepareValuePxMatrix(){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str" + mDeltaYLeft + "String_Node_Str"+ mDeltaYRight);
  mRightAxisTransformer.prepareMatrixValuePx(mDeltaX,mDeltaYRight,mAxisRight.mAxisMinimum);
  mLeftAxisTransformer.prepareMatrixValuePx(mDeltaX,mDeltaYLeft,mAxisLeft.mAxisMinimum);
}

Fixed version (ground truth):
private void prepareValuePxMatrix(){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str" + mAxisLeft.mAxisRange + "String_Node_Str"+ mAxisRight.mAxisRange);
  mRightAxisTransformer.prepareMatrixValuePx(mDeltaX,mAxisRight.mAxisRange,mAxisRight.mAxisMinimum);
  mLeftAxisTransformer.prepareMatrixValuePx(mDeltaX,mAxisLeft.mAxisRange,mAxisLeft.mAxisMinimum);
}
Program: 26804
Project: 26804
Buggy source:
@Override protected void calcMinMax(){
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  float leftRange=Math.abs(maxLeft - minLeft);
  float rightRange=Math.abs(maxRight - minRight);
  float topSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceTop();
  float topSpaceRight=rightRange / 100f * mAxisRight.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceBottom();
  float bottomSpaceRight=rightRange / 100f * mAxisRight.getSpaceBottom();
  mDeltaX=mData.getXVals().size() - 1;
  mAxisLeft.mAxisMaximum=maxLeft + topSpaceLeft;
  mAxisRight.mAxisMaximum=maxRight + topSpaceRight;
  mAxisLeft.mAxisMinimum=minLeft - bottomSpaceLeft;
  mAxisRight.mAxisMinimum=minRight - bottomSpaceRight;
  mDeltaYLeft=Math.abs(mAxisLeft.mAxisMaximum - mAxisLeft.mAxisMinimum);
  mDeltaYRight=Math.abs(mAxisRight.mAxisMaximum - mAxisRight.mAxisMinimum);
}

Fixed version (ground truth):
@Override protected void calcMinMax(){
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  float leftRange=Math.abs(maxLeft - minLeft);
  float rightRange=Math.abs(maxRight - minRight);
  float topSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceTop();
  float topSpaceRight=rightRange / 100f * mAxisRight.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceBottom();
  float bottomSpaceRight=rightRange / 100f * mAxisRight.getSpaceBottom();
  mDeltaX=mData.getXVals().size() - 1;
  mAxisLeft.mAxisMaximum=!Float.isNaN(mAxisLeft.getAxisMaxValue()) ? mAxisLeft.getAxisMaxValue() : maxLeft + topSpaceLeft;
  mAxisRight.mAxisMaximum=!Float.isNaN(mAxisRight.getAxisMaxValue()) ? mAxisRight.getAxisMaxValue() : maxRight + topSpaceRight;
  mAxisLeft.mAxisMinimum=!Float.isNaN(mAxisLeft.getAxisMinValue()) ? mAxisLeft.getAxisMinValue() : minLeft - bottomSpaceLeft;
  mAxisRight.mAxisMinimum=!Float.isNaN(mAxisRight.getAxisMinValue()) ? mAxisRight.getAxisMinValue() : minRight - bottomSpaceRight;
  mAxisLeft.mAxisRange=Math.abs(mAxisLeft.mAxisMaximum - mAxisLeft.mAxisMinimum);
  mAxisRight.mAxisRange=Math.abs(mAxisRight.mAxisMaximum - mAxisRight.mAxisMinimum);
}
Program: 26805
Project: 26805
Buggy source:
/** 
 * Returns the delta-y value (y-value range) of the specified axis.
 * @param axis
 * @return
 */
public float getDeltaY(AxisDependency axis){
  if (axis == AxisDependency.LEFT)   return mDeltaYLeft;
 else   return mDeltaYRight;
}

Fixed version (ground truth):
/** 
 * Returns the delta-y value (y-value range) of the specified axis.
 * @param axis
 * @return
 */
public float getDeltaY(AxisDependency axis){
  if (axis == AxisDependency.LEFT)   return mAxisLeft.mAxisRange;
 else   return mAxisRight.mAxisRange;
}
Program: 26806
Project: 26806
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);
    }
  }
 else {
    if (!Float.isNaN(mYAxis.getAxisMaxValue())) {
      yMax=mYAxis.getAxisMaxValue();
    }
    if (!Float.isNaN(mYAxis.getAxisMinValue())) {
      yMin=mYAxis.getAxisMinValue();
    }
  }
  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 {
      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);
}
Program: 26807
Project: 26807
Buggy source:
/** 
 * generates a random ChartData object with just one DataSet
 * @return
 */
private LineData generateDataLine(int cnt){
  ArrayList<Entry> e1=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e1.add(new Entry((int)(Math.random() * 65) + 40,i));
  }
  LineDataSet d1=new LineDataSet(e1,"String_Node_Str" + cnt + "String_Node_Str");
  d1.setLineWidth(3f);
  d1.setCircleSize(5f);
  d1.setHighLightColor(Color.rgb(244,117,117));
  d1.setDrawValues(false);
  ArrayList<Entry> e2=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e2.add(new Entry(e1.get(i).getVal() - 30,i));
  }
  LineDataSet d2=new LineDataSet(e2,"String_Node_Str" + cnt + "String_Node_Str");
  d2.setLineWidth(3f);
  d2.setCircleSize(5f);
  d2.setHighLightColor(Color.rgb(244,117,117));
  d2.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setDrawValues(false);
  ArrayList<LineDataSet> sets=new ArrayList<LineDataSet>();
  sets.add(d1);
  sets.add(d2);
  LineData cd=new LineData(getMonths(),sets);
  return cd;
}

Fixed version (ground truth):
/** 
 * generates a random ChartData object with just one DataSet
 * @return
 */
private LineData generateDataLine(int cnt){
  ArrayList<Entry> e1=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e1.add(new Entry((int)(Math.random() * 65) + 40,i));
  }
  LineDataSet d1=new LineDataSet(e1,"String_Node_Str" + cnt + "String_Node_Str");
  d1.setLineWidth(2.5f);
  d1.setCircleSize(4.5f);
  d1.setHighLightColor(Color.rgb(244,117,117));
  d1.setDrawValues(false);
  ArrayList<Entry> e2=new ArrayList<Entry>();
  for (int i=0; i < 12; i++) {
    e2.add(new Entry(e1.get(i).getVal() - 30,i));
  }
  LineDataSet d2=new LineDataSet(e2,"String_Node_Str" + cnt + "String_Node_Str");
  d2.setLineWidth(2.5f);
  d2.setCircleSize(4.5f);
  d2.setHighLightColor(Color.rgb(244,117,117));
  d2.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
  d2.setDrawValues(false);
  ArrayList<LineDataSet> sets=new ArrayList<LineDataSet>();
  sets.add(d1);
  sets.add(d2);
  LineData cd=new LineData(getMonths(),sets);
  return cd;
}
Program: 26808
Project: 26808
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.actionToggleValues:
{
      for (      DataSet<?> set : mChart.getData().getDataSets())       set.setDrawValues(!set.isDrawValuesEnabled());
      mChart.invalidate();
      break;
    }
case R.id.actionToggleHole:
{
    if (mChart.isDrawHoleEnabled())     mChart.setDrawHoleEnabled(false);
 else     mChart.setDrawHoleEnabled(true);
    mChart.invalidate();
    break;
  }
case R.id.actionDrawCenter:
{
  if (mChart.isDrawCenterTextEnabled())   mChart.setDrawCenterText(false);
 else   mChart.setDrawCenterText(true);
  mChart.invalidate();
  break;
}
case R.id.actionToggleXVals:
{
mChart.setDrawAxisLabels(!mChart.isDrawAxisLabelsEnabled());
mChart.invalidate();
break;
}
case R.id.actionSave:
{
mChart.saveToPath("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str");
break;
}
case R.id.animateX:
{
mChart.animateX(1800);
break;
}
case R.id.animateY:
{
mChart.animateY(1800);
break;
}
case R.id.animateXY:
{
mChart.animateXY(1800,1800);
break;
}
}
return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.actionToggleValues:
{
      for (      DataSet<?> set : mChart.getData().getDataSets())       set.setDrawValues(!set.isDrawValuesEnabled());
      mChart.invalidate();
      break;
    }
case R.id.actionToggleHole:
{
    if (mChart.isDrawHoleEnabled())     mChart.setDrawHoleEnabled(false);
 else     mChart.setDrawHoleEnabled(true);
    mChart.invalidate();
    break;
  }
case R.id.actionDrawCenter:
{
  if (mChart.isDrawCenterTextEnabled())   mChart.setDrawCenterText(false);
 else   mChart.setDrawCenterText(true);
  mChart.invalidate();
  break;
}
case R.id.actionToggleXVals:
{
mChart.setDrawSliceText(!mChart.isDrawSliceTextEnabled());
mChart.invalidate();
break;
}
case R.id.actionSave:
{
mChart.saveToPath("String_Node_Str" + System.currentTimeMillis(),"String_Node_Str");
break;
}
case R.id.animateX:
{
mChart.animateX(1800);
break;
}
case R.id.animateY:
{
mChart.animateY(1800);
break;
}
case R.id.animateXY:
{
mChart.animateXY(1800,1800);
break;
}
}
return true;
}
Program: 26810
Project: 26810
Buggy source:
/** 
 * Returns the position (in pixels) the provided Entry has inside the chart view or null, if the provided Entry is null.
 * @param e
 * @return
 */
public PointF getPosition(Entry e,AxisDependency axis){
  if (e == null)   return null;
  float[] vals=new float[]{e.getXIndex(),e.getVal()};
  if (this instanceof BarChart) {
    BarDataSet set=(BarDataSet)mData.getDataSetForEntry(e);
    if (set != null)     vals[0]+=set.getBarSpace() / 2f;
  }
  if (axis == AxisDependency.LEFT)   mLeftAxisTransformer.pointValuesToPixel(vals);
 else   mRightAxisTransformer.pointValuesToPixel(vals);
  return new PointF(vals[0],vals[1]);
}

Fixed version (ground truth):
/** 
 * Returns the position (in pixels) the provided Entry has inside the chart view or null, if the provided Entry is null.
 * @param e
 * @return
 */
public PointF getPosition(Entry e,AxisDependency axis){
  if (e == null)   return null;
  float[] vals=new float[]{e.getXIndex(),e.getVal()};
  if (this instanceof BarChart) {
    BarDataSet set=(BarDataSet)mData.getDataSetForEntry(e);
    if (set != null)     vals[0]+=set.getBarSpace() / 2f;
  }
  getTransformer(axis).pointValuesToPixel(vals);
  return new PointF(vals[0],vals[1]);
}
Program: 26811
Project: 26811
Buggy source:
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=getEntryByDataSetIndex(high.getXIndex(),high.getDataSetIndex());
      mSelectionListener.onValueSelected(e,high.getDataSetIndex());
    }
  }
}

Fixed version (ground truth):
/** 
 * Highlights the value selected by touch gesture. Unlike highlightValues(...), this generates a callback to the OnChartValueSelectedListener.
 * @param highs
 */
public void highlightTouch(Highlight high){
  if (high == null)   mIndicesToHightlight=null;
 else {
    mIndicesToHightlight=new Highlight[]{high};
  }
  invalidate();
  if (mSelectionListener != null) {
    if (!valuesToHighlight())     mSelectionListener.onNothingSelected();
 else {
      Entry e=mData.getEntryForHighlight(high);
      mSelectionListener.onValueSelected(e,high.getDataSetIndex());
    }
  }
}
Program: 26812
Project: 26812
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;
  }
  if (mDrawBitmap == null || mDrawCanvas == null) {
    mDrawBitmap=Bitmap.createBitmap(getWidth(),getHeight(),Bitmap.Config.ARGB_4444);
    mDrawCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
}

Fixed version (ground truth):
@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;
  }
  if (mDrawCanvas == null) {
    mDrawCanvas=new Canvas(mDrawBitmap);
  }
  mDrawBitmap.eraseColor(Color.TRANSPARENT);
}
Program: 26813
Project: 26813
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;
  mData=data;
  notifyDataSetChanged();
  calcFormats(data.getYMin(),data.getYMax());
  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;
  notifyDataSetChanged();
  calcFormats(data.getYMin(),data.getYMax());
  Log.i(LOG_TAG,"String_Node_Str");
}
Program: 26814
Project: 26814
Buggy source:
/** 
 * Clears the chart from all data and refreshes it (by calling invalidate()).
 */
public void clear(){
  mData=null;
  mData=null;
  mDataNotSet=true;
  invalidate();
}

Fixed version (ground truth):
/** 
 * Clears the chart from all data and refreshes it (by calling invalidate()).
 */
public void clear(){
  mData=null;
  mDataNotSet=true;
  invalidate();
}
Program: 26815
Project: 26815
Buggy source:
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mAnimator.getPhaseX()) {
      Entry e=getEntryByDataSetIndex(xIndex,dataSetIndex);
      if (e == null)       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (!mViewPortHandler.isInBounds(pos[0],pos[1]))       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      if (pos[1] - mMarkerView.getHeight() <= 0) {
        float y=mMarkerView.getHeight() - pos[1];
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1] + y);
      }
 else {
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1]);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * draws all MarkerViews on the highlighted positions
 */
protected void drawMarkers(){
  if (mMarkerView == null || !mDrawMarkerViews || !valuesToHighlight())   return;
  for (int i=0; i < mIndicesToHightlight.length; i++) {
    int xIndex=mIndicesToHightlight[i].getXIndex();
    int dataSetIndex=mIndicesToHightlight[i].getDataSetIndex();
    if (xIndex <= mDeltaX && xIndex <= mDeltaX * mAnimator.getPhaseX()) {
      Entry e=mData.getEntryForHighlight(mIndicesToHightlight[i]);
      if (e == null)       continue;
      float[] pos=getMarkerPosition(e,dataSetIndex);
      if (!mViewPortHandler.isInBounds(pos[0],pos[1]))       continue;
      mMarkerView.refreshContent(e,dataSetIndex);
      mMarkerView.measure(MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED),MeasureSpec.makeMeasureSpec(0,MeasureSpec.UNSPECIFIED));
      mMarkerView.layout(0,0,mMarkerView.getMeasuredWidth(),mMarkerView.getMeasuredHeight());
      if (pos[1] - mMarkerView.getHeight() <= 0) {
        float y=mMarkerView.getHeight() - pos[1];
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1] + y);
      }
 else {
        mMarkerView.draw(mDrawCanvas,pos[0],pos[1]);
      }
    }
  }
}
Program: 26816
Project: 26816
Buggy source:
@Override public void notifyDataSetChanged(){
  prepare();
  mRightAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaYRight,mAxisRight.mAxisMinimum);
  mLeftAxisTransformer.prepareMatrixValuePx(mViewPortHandler,mDeltaX,mDeltaYLeft,mAxisLeft.mAxisMinimum);
}

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");
  }
  calcMinMax(false);
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  mAxisRendererLeft.computeAxis(minLeft,maxLeft);
  mAxisRendererRight.computeAxis(minRight,maxRight);
  mXAxisRenderer.computeAxis(mData.getXValAverageLength(),mData.getXVals());
  prepareLegend();
  calculateOffsets();
}
Program: 26817
Project: 26817
Buggy source:
@Override protected void calcMinMax(boolean fixedValues){
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  mDeltaX=mData.getXVals().size() - 1;
  mDeltaYLeft=Math.abs(maxLeft - minLeft);
  mDeltaYRight=Math.abs(maxRight - minRight);
}

Fixed version (ground truth):
@Override protected void calcMinMax(boolean fixedValues){
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  mDeltaX=mData.getXVals().size() - 1;
  mDeltaYLeft=Math.abs(maxLeft - minLeft);
  mDeltaYRight=Math.abs(maxRight - minRight);
  mAxisLeft.mAxisMaximum=maxLeft;
  mAxisRight.mAxisMaximum=maxRight;
  mAxisLeft.mAxisMinimum=minLeft;
  mAxisRight.mAxisMinimum=minRight;
}
Program: 26819
Project: 26819
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mDrawCanvas=new Canvas(mDrawBitmap);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
  }
  prepare();
  super.onSizeChanged(w,h,oldw,oldh);
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  if (mLogEnabled)   Log.i(LOG_TAG,"String_Node_Str");
  if (w > 0 && h > 0 && w < 10000 && h < 10000) {
    mDrawBitmap=Bitmap.createBitmap(w,h,Bitmap.Config.ARGB_4444);
    mDrawCanvas=new Canvas(mDrawBitmap);
    mViewPortHandler.setChartDimens(w,h);
    if (mLogEnabled)     Log.i(LOG_TAG,"String_Node_Str" + w + "String_Node_Str"+ h);
  }
  notifyDataSetChanged();
  super.onSizeChanged(w,h,oldw,oldh);
}
Program: 26820
Project: 26820
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;
  mData=data;
  prepare();
  calcFormats(data.getYMin(),data.getYMax());
  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;
  mData=data;
  notifyDataSetChanged();
  calcFormats(data.getYMin(),data.getYMax());
  Log.i(LOG_TAG,"String_Node_Str");
}
Program: 26821
Project: 26821
Buggy source:
@Override public void notifyDataSetChanged(){
  prepare();
}

Fixed version (ground truth):
@Override public void notifyDataSetChanged(){
  if (mDataNotSet)   return;
  calcMinMax(false);
  prepareLegend();
  calculateOffsets();
}
Program: 26822
Project: 26822
Buggy source:
@Override protected void calculateOffsets(){
  super.calculateOffsets();
  float offset=mData.getGreatestShapeSize() / 2f;
  mViewPortHandler.restrainViewPort(mViewPortHandler.offsetLeft() - offset,mViewPortHandler.offsetTop(),mViewPortHandler.offsetRight() - offset,mViewPortHandler.offsetBottom());
  prepareMatrix();
}

Fixed version (ground truth):
@Override protected void calculateOffsets(){
  super.calculateOffsets();
  float offset=mData.getGreatestShapeSize() / 2f;
  mViewPortHandler.restrainViewPort(mViewPortHandler.offsetLeft() - offset,mViewPortHandler.offsetTop(),mViewPortHandler.offsetRight() - offset,mViewPortHandler.offsetBottom());
  prepareOffsetMatrix();
}
Program: 26823
Project: 26823
Buggy source:
public void setAxisMinValue(float min){
  mCustomAxisMin=min;
}

Fixed version (ground truth):
/** 
 * Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data. Use resetAxisMinValue() to undo this.
 * @param min
 */
public void setAxisMinValue(float min){
  mCustomAxisMin=min;
}
Program: 26824
Project: 26824
Buggy source:
public void resetAxisMaxValue(){
  mCustomAxisMax=Float.NaN;
}

Fixed version (ground truth):
/** 
 * By calling this method, any custom maximum value that has been previously set is reseted, and the calculation is done automatically.
 */
public void resetAxisMaxValue(){
  mCustomAxisMax=Float.NaN;
}
Program: 26825
Project: 26825
Buggy source:
public void setAxisMaxValue(float max){
  mCustomAxisMax=max;
}

Fixed version (ground truth):
/** 
 * Set a custom maximum value for this axis. If set, this value will not be calculated automatically depending on the provided data. Use resetAxisMaxValue() to undo this.
 * @param max
 */
public void setAxisMaxValue(float max){
  mCustomAxisMax=max;
}
Program: 26826
Project: 26826
Buggy source:
public void resetAxisMinValue(){
  mCustomAxisMin=Float.NaN;
}

Fixed version (ground truth):
/** 
 * By calling this method, any custom minimum value that has been previously set is reseted, and the calculation is done automatically.
 */
public void resetAxisMinValue(){
  mCustomAxisMin=Float.NaN;
}
Program: 26827
Project: 26827
Buggy source:
@Override public void drawValues(Canvas c){
  if (mChart.getData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    ArrayList<ScatterDataSet> dataSets=mChart.getData().getDataSets();
    for (int i=0; i < mChart.getData().getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      ArrayList<Entry> entries=dataSet.getYVals();
      float[] positions=mChart.getTransformer(dataSet.getAxisDependency()).generateTransformedValuesLineScatter(entries,mAnimator.getPhaseY());
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length * mAnimator.getPhaseX(); j+=2) {
        if (!mViewPortHandler.isInBoundsRight(positions[j]))         break;
        if (j != 0 && !mViewPortHandler.isInBoundsLeft(positions[j - 1]) && !mViewPortHandler.isInBoundsY(positions[j + 1]))         continue;
        float val=entries.get(j / 2).getVal();
        c.drawText(mChart.getValueFormatter().getFormattedValue(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void drawValues(Canvas c){
  if (mChart.getData().getYValCount() < mChart.getMaxVisibleCount() * mViewPortHandler.getScaleX()) {
    ArrayList<ScatterDataSet> dataSets=mChart.getData().getDataSets();
    for (int i=0; i < mChart.getData().getDataSetCount(); i++) {
      ScatterDataSet dataSet=dataSets.get(i);
      if (!dataSet.isDrawValuesEnabled())       continue;
      ArrayList<Entry> entries=dataSet.getYVals();
      float[] positions=mChart.getTransformer(dataSet.getAxisDependency()).generateTransformedValuesLineScatter(entries,mAnimator.getPhaseY());
      float shapeSize=dataSet.getScatterShapeSize();
      for (int j=0; j < positions.length * mAnimator.getPhaseX(); j+=2) {
        if (!mViewPortHandler.isInBoundsRight(positions[j]))         break;
        if (j != 0 && !mViewPortHandler.isInBoundsLeft(positions[j - 1]) && !mViewPortHandler.isInBoundsY(positions[j + 1]))         continue;
        float val=entries.get(j / 2).getVal();
        c.drawText(mChart.getValueFormatter().getFormattedValue(val),positions[j],positions[j + 1] - shapeSize,mValuePaint);
      }
    }
  }
}
Program: 26828
Project: 26828
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);
    }
  }
 else {
    if (!Float.isNaN(mYAxis.getAxisMaxValue())) {
      yMax=mYAxis.getAxisMaxValue();
    }
    if (!Float.isNaN(mYAxis.getAxisMinValue())) {
      yMin=mYAxis.getAxisMinValue();
    }
 else {
      if (mYAxis.isStartAtZeroEnabled()) {
        yMin=0;
      }
    }
  }
  mYAxis.mAxisMaximum=yMax;
  mYAxis.mAxisMinimum=yMin;
  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 {
      if (!mYAxis.isStartAtZeroEnabled())       yMin=(float)Math.min(p1.y,p2.y);
 else       yMin=0;
      yMax=(float)Math.max(p1.y,p2.y);
    }
  }
 else {
    if (!Float.isNaN(mYAxis.getAxisMaxValue())) {
      yMax=mYAxis.getAxisMaxValue();
    }
    if (!Float.isNaN(mYAxis.getAxisMinValue())) {
      yMin=mYAxis.getAxisMinValue();
    }
 else {
      if (mYAxis.isStartAtZeroEnabled()) {
        yMin=0;
      }
    }
  }
  computeAxisValues(yMin,yMax);
}