Program: 143977
Project: 143977
Buggy source:
@Override public void addResult(String name,List<PredictedDataInstance<T,S>> predictions,Function<PredictedDataInstance<T,S>,Boolean> groundTruth){
  Collections.sort(predictions,Collections.reverseOrder(Comparator.comparing(PredictedDataInstance::probability)));
  List<CurvePoint> points=new ArrayList<>();
  int truePositivesNumber=0;
  int falsePositivesNumber=0;
  int falseNegativesNumber=0;
  for (  PredictedDataInstance<T,S> prediction : predictions)   if (groundTruth.apply(prediction))   falseNegativesNumber++;
  points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
  double areaUnderCurve=0;
  if (numberOfCurvePoints < 0) {
    for (int predictionIndex=0; predictionIndex < predictions.size(); predictionIndex++) {
      do {
        if (groundTruth.apply(predictions.get(predictionIndex))) {
          falseNegativesNumber--;
          truePositivesNumber++;
        }
 else {
          falsePositivesNumber++;
        }
        predictionIndex++;
        if (predictionIndex == predictions.size())         break;
      }
 while (predictions.get(predictionIndex - 1).probability() == predictions.get(predictionIndex).probability());
      if (predictionIndex < predictions.size())       predictionIndex--;
      points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
      int k=points.size() - 1;
      areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
    }
  }
 else {
    int previousThresholdPredictionIndex=0;
    for (double thresholdIndex=1; thresholdIndex < numberOfCurvePoints; thresholdIndex++) {
      double threshold=1 - thresholdIndex / (numberOfCurvePoints - 1);
      PredictedDataInstance<T,S> prediction=predictions.get(previousThresholdPredictionIndex);
      while (prediction.probability() >= threshold) {
        if (groundTruth.apply(prediction)) {
          falseNegativesNumber--;
          truePositivesNumber++;
        }
 else {
          falsePositivesNumber++;
        }
        if (++previousThresholdPredictionIndex < predictions.size())         prediction=predictions.get(previousThresholdPredictionIndex);
 else         break;
      }
      points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
      int k=points.size() - 1;
      areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
      if (previousThresholdPredictionIndex == predictions.size())       break;
    }
  }
  curves.add(new Curve(name,points));
  areaUnderCurves.add(areaUnderCurve);
}

Fixed version (ground truth):
@Override public void addResult(String name,List<PredictedDataInstance<T,S>> predictions,Function<PredictedDataInstance<T,S>,Boolean> groundTruth){
  if (predictions.size() == 0) {
    List<CurvePoint> points=new ArrayList<>();
    points.add(new CurvePoint(0,1));
    points.add(new CurvePoint(1,1));
    curves.add(new Curve(name,points));
    areaUnderCurves.add(1.0);
    return;
  }
  Collections.sort(predictions,Collections.reverseOrder(Comparator.comparing(PredictedDataInstance::probability)));
  List<CurvePoint> points=new ArrayList<>();
  int truePositivesNumber=0;
  int falsePositivesNumber=0;
  int falseNegativesNumber=0;
  for (  PredictedDataInstance<T,S> prediction : predictions)   if (groundTruth.apply(prediction))   falseNegativesNumber++;
  points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
  double areaUnderCurve=0;
  if (numberOfCurvePoints < 0) {
    for (int predictionIndex=0; predictionIndex < predictions.size(); predictionIndex++) {
      do {
        if (groundTruth.apply(predictions.get(predictionIndex))) {
          falseNegativesNumber--;
          truePositivesNumber++;
        }
 else {
          falsePositivesNumber++;
        }
        predictionIndex++;
        if (predictionIndex == predictions.size())         break;
      }
 while (predictions.get(predictionIndex - 1).probability() == predictions.get(predictionIndex).probability());
      if (predictionIndex < predictions.size())       predictionIndex--;
      points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
      int k=points.size() - 1;
      areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
    }
  }
 else {
    int previousThresholdPredictionIndex=0;
    for (double thresholdIndex=1; thresholdIndex < numberOfCurvePoints; thresholdIndex++) {
      double threshold=1 - thresholdIndex / (numberOfCurvePoints - 1);
      PredictedDataInstance<T,S> prediction=predictions.get(previousThresholdPredictionIndex);
      while (prediction.probability() >= threshold) {
        if (groundTruth.apply(prediction)) {
          falseNegativesNumber--;
          truePositivesNumber++;
        }
 else {
          falsePositivesNumber++;
        }
        if (++previousThresholdPredictionIndex < predictions.size())         prediction=predictions.get(previousThresholdPredictionIndex);
 else         break;
      }
      points.add(new CurvePoint((truePositivesNumber + epsilon) / (truePositivesNumber + falseNegativesNumber + epsilon),(truePositivesNumber + epsilon) / (truePositivesNumber + falsePositivesNumber + epsilon)));
      int k=points.size() - 1;
      areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
      if (previousThresholdPredictionIndex == predictions.size())       break;
    }
  }
  curves.add(new Curve(name,points));
  areaUnderCurves.add(areaUnderCurve);
}