Program: 142275
Project: 142275
Buggy source:
/** 
 * The graphical representation of a series.
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series: [x1, y1, x2, y2, ... ]
 * @param seriesRenderer the series renderer
 * @param yAxisValue the minimum value of the y axis
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
@Override public void drawSeries(Canvas canvas,Paint paint,List<Float> points,XYSeriesRenderer renderer,float yAxisValue,int seriesIndex,int startIndex){
  float lineWidth=paint.getStrokeWidth();
  paint.setStrokeWidth(renderer.getLineWidth());
  final FillOutsideLine[] fillOutsideLine=renderer.getFillOutsideLine();
  for (  FillOutsideLine fill : fillOutsideLine) {
    if (fill.getType() != FillOutsideLine.Type.NONE) {
      paint.setColor(fill.getColor());
      List<Float> fillPoints=new ArrayList<Float>();
      int[] range=fill.getFillRange();
      if (range == null) {
        fillPoints.addAll(points);
      }
 else {
        if (points.size() > range[0] * 2 && points.size() > range[1] * 2) {
          fillPoints.addAll(points.subList(range[0] * 2,range[1] * 2));
        }
      }
      final float referencePoint;
      final float boundary;
switch (fill.getType()) {
case BOUNDS_ALL:
        referencePoint=yAxisValue;
      boundary=yAxisValue;
    break;
case BOUNDS_BELOW:
  referencePoint=yAxisValue;
boundary=yAxisValue;
break;
case BOUNDS_ABOVE:
referencePoint=yAxisValue;
boundary=yAxisValue;
break;
case BELOW:
referencePoint=canvas.getHeight();
boundary=0;
break;
case ABOVE:
referencePoint=0;
boundary=canvas.getHeight();
break;
default :
throw new RuntimeException("String_Node_Str");
}
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW) {
List<Float> boundsPoints=new ArrayList<Float>();
boolean add=false;
int length=fillPoints.size();
if (length > 0 && fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && fillPoints.get(1) < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && fillPoints.get(1) > referencePoint) {
boundsPoints.add(fillPoints.get(0));
boundsPoints.add(fillPoints.get(1));
add=true;
}
for (int i=3; i < length; i+=2) {
float prevValue=fillPoints.get(i - 2);
float value=fillPoints.get(i);
if (prevValue < referencePoint && value > referencePoint || prevValue > referencePoint && value < referencePoint) {
float prevX=fillPoints.get(i - 3);
float x=fillPoints.get(i - 1);
boundsPoints.add(prevX + (x - prevX) * (referencePoint - prevValue) / (value - prevValue));
boundsPoints.add(referencePoint);
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value > referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value < referencePoint) {
i+=2;
add=false;
}
 else {
boundsPoints.add(x);
boundsPoints.add(value);
add=true;
}
}
 else {
if (add || fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value > referencePoint) {
boundsPoints.add(fillPoints.get(i - 1));
boundsPoints.add(value);
}
}
}
fillPoints.clear();
fillPoints.addAll(boundsPoints);
}
int length=fillPoints.size();
if (length > 0) {
fillPoints.set(0,fillPoints.get(0) + 1);
int i=0;
while (i < length) {
if (yOutOfBounds(fillPoints.get(i + 1),fill.getType(),canvas)) {
int currentIndex=i;
if (i >= 2 && !yOutOfBounds(fillPoints.get(i - 1),fill.getType(),canvas)) {
fillPoints.add(i,getXIntermediary(fillPoints.subList(i - 2,i + 2),canvas.getWidth()));
fillPoints.add(i + 1,boundary);
i+=2;
length+=2;
currentIndex+=2;
}
if (i + 2 < fillPoints.size() && !yOutOfBounds(fillPoints.get(i + 3),fill.getType(),canvas)) {
fillPoints.add(i + 2,getXIntermediary(fillPoints.subList(i,i + 4),canvas.getWidth()));
fillPoints.add(i + 3,boundary);
i+=2;
length+=2;
}
fillPoints.set(currentIndex + 1,boundary);
}
i+=2;
}
fillPoints.add(fillPoints.get(length - 2));
fillPoints.add(referencePoint);
fillPoints.add(fillPoints.get(0));
fillPoints.add(fillPoints.get(length + 1));
paint.setStyle(Style.FILL);
drawPath(canvas,fillPoints,paint,true);
}
}
}
paint.setColor(renderer.getColor());
paint.setStyle(Style.STROKE);
drawPath(canvas,points,paint,false);
paint.setStrokeWidth(lineWidth);
}

Fixed version (ground truth):
/** 
 * The graphical representation of a series.
 * @param canvas the canvas to paint to
 * @param paint the paint to be used for drawing
 * @param points the array of points to be used for drawing the series: [x1, y1, x2, y2, ... ]
 * @param seriesRenderer the series renderer
 * @param yAxisValue the minimum value of the y axis
 * @param seriesIndex the index of the series currently being drawn
 * @param startIndex the start index of the rendering points
 */
@Override public void drawSeries(Canvas canvas,Paint paint,List<Float> points,XYSeriesRenderer renderer,float yAxisValue,int seriesIndex,int startIndex){
  float lineWidth=paint.getStrokeWidth();
  paint.setStrokeWidth(renderer.getLineWidth());
  final FillOutsideLine[] fillOutsideLine=renderer.getFillOutsideLine();
  for (  FillOutsideLine fill : fillOutsideLine) {
    if (fill.getType() != FillOutsideLine.Type.NONE) {
      paint.setColor(fill.getColor());
      List<Float> fillPoints=new ArrayList<Float>();
      int[] range=fill.getFillRange();
      if (range == null) {
        fillPoints.addAll(points);
      }
 else {
        if (points.size() > range[0] * 2 && points.size() > range[1] * 2) {
          fillPoints.addAll(points.subList(range[0] * 2,range[1] * 2));
        }
      }
      final float referencePoint;
      final float boundary;
switch (fill.getType()) {
case BOUNDS_ALL:
        referencePoint=yAxisValue;
      boundary=yAxisValue;
    break;
case BOUNDS_BELOW:
  referencePoint=yAxisValue;
boundary=yAxisValue;
break;
case BOUNDS_ABOVE:
referencePoint=yAxisValue;
boundary=yAxisValue;
break;
case BELOW:
referencePoint=canvas.getHeight();
boundary=0;
break;
case ABOVE:
referencePoint=0;
boundary=canvas.getHeight();
break;
default :
throw new RuntimeException("String_Node_Str");
}
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW) {
List<Float> boundsPoints=new ArrayList<Float>();
boolean add=false;
int length=fillPoints.size();
if (length > 0 && fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && fillPoints.get(1) < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && fillPoints.get(1) > referencePoint) {
boundsPoints.add(fillPoints.get(0));
boundsPoints.add(fillPoints.get(1));
add=true;
}
for (int i=3; i < length; i+=2) {
float prevValue=fillPoints.get(i - 2);
float value=fillPoints.get(i);
if (prevValue < referencePoint && value > referencePoint || prevValue > referencePoint && value < referencePoint) {
float prevX=fillPoints.get(i - 3);
float x=fillPoints.get(i - 1);
boundsPoints.add(prevX + (x - prevX) * (referencePoint - prevValue) / (value - prevValue));
boundsPoints.add(referencePoint);
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value > referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value < referencePoint) {
i+=2;
add=false;
}
 else {
boundsPoints.add(x);
boundsPoints.add(value);
add=true;
}
}
 else {
if (add || fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value > referencePoint) {
boundsPoints.add(fillPoints.get(i - 1));
boundsPoints.add(value);
}
}
}
fillPoints.clear();
fillPoints.addAll(boundsPoints);
}
int length=fillPoints.size();
if (length > 0) {
fillPoints.set(0,fillPoints.get(0) + 1);
int i=0;
while (i < length) {
if (yOutOfBounds(fillPoints.get(i + 1),fill.getType(),canvas)) {
int currentIndex=i;
if (i >= 2 && !yOutOfBounds(fillPoints.get(i - 1),fill.getType(),canvas)) {
float newY=fill.getType() == FillOutsideLine.Type.ABOVE && fillPoints.get(i - 1) < canvas.getHeight() / 2 ? 0 : boundary;
System.out.println("String_Node_Str" + newY + "String_Node_Str"+ fill.getType()+ "String_Node_Str"+ fillPoints.get(i - 1));
fillPoints.add(i,getXIntermediary(fillPoints.subList(i - 2,i + 2),canvas.getWidth()));
fillPoints.add(i + 1,newY);
i+=2;
length+=2;
currentIndex+=2;
}
if (i + 2 < fillPoints.size() && !yOutOfBounds(fillPoints.get(i + 3),fill.getType(),canvas)) {
float newY=fill.getType() == FillOutsideLine.Type.ABOVE && fillPoints.get(i + 3) < canvas.getHeight() / 2 ? 0 : boundary;
System.out.println("String_Node_Str" + newY + "String_Node_Str"+ fill.getType()+ "String_Node_Str"+ fillPoints.get(i + 3));
fillPoints.add(i + 2,getXIntermediary(fillPoints.subList(i,i + 4),canvas.getWidth()));
fillPoints.add(i + 3,newY);
i+=2;
length+=2;
}
fillPoints.set(currentIndex + 1,fill.getType() == FillOutsideLine.Type.ABOVE && fillPoints.get(currentIndex + 1) < 0 ? referencePoint : boundary);
}
i+=2;
}
fillPoints.add(fillPoints.get(length - 2));
fillPoints.add(referencePoint);
fillPoints.add(fillPoints.get(0));
fillPoints.add(fillPoints.get(length + 1));
paint.setStyle(Style.FILL);
drawPath(canvas,fillPoints,paint,true);
}
}
}
paint.setColor(renderer.getColor());
paint.setStyle(Style.STROKE);
drawPath(canvas,points,paint,false);
paint.setStrokeWidth(lineWidth);
}