Program: 9847
Project: 9847
Buggy source:
public double getAccuracyOrTooWeakExact(Description description,double noise){
  nanoStartTime=System.nanoTime();
  if (heuristic.equals(HeuristicType.JACCARD)) {
    TreeSet<Individual> coveredInstancesSet=new TreeSet<Individual>();
    for (    Individual ind : classInstances) {
      if (reasoner.hasType(description,ind)) {
        coveredInstancesSet.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    if (coveredInstancesSet.size() / (double)classInstances.size() <= 1 - noise) {
      return -1;
    }
    TreeSet<Individual> additionalInstancesSet=new TreeSet<Individual>();
    for (    Individual ind : superClassInstances) {
      if (reasoner.hasType(description,ind)) {
        additionalInstancesSet.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    Set<Individual> union=Helper.union(classInstancesSet,additionalInstancesSet);
    return (1 - (union.size() - coveredInstancesSet.size()) / (double)union.size());
  }
 else   if (heuristic.equals(HeuristicType.OWN) || heuristic.equals(HeuristicType.FMEASURE) || heuristic.equals(HeuristicType.PRED_ACC)) {
    int additionalInstances=0;
    for (    Individual ind : superClassInstances) {
      if (reasoner.hasType(description,ind)) {
        additionalInstances++;
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    int coveredInstances=0;
    for (    Individual ind : classInstances) {
      if (reasoner.hasType(description,ind)) {
        coveredInstances++;
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    double recall=coveredInstances / (double)classInstances.size();
    double precision=(additionalInstances + coveredInstances == 0) ? 0 : coveredInstances / (double)(coveredInstances + additionalInstances);
    if (heuristic.equals(HeuristicType.OWN)) {
      if ((coverageFactor * recall + 1) / (double)(coverageFactor + 1) < (1 - noise)) {
        return -1;
      }
 else {
        return getAccuracy(recall,precision);
      }
    }
 else     if (heuristic.equals(HeuristicType.FMEASURE)) {
      if (((1 + Math.sqrt(coverageFactor)) * recall) / (Math.sqrt(coverageFactor) + 1) < 1 - noise) {
        return -1;
      }
 else {
        return getFMeasure(recall,precision);
      }
    }
 else     if (heuristic.equals(HeuristicType.PRED_ACC)) {
      if ((coverageFactor * coveredInstances + superClassInstances.size()) / (double)(coverageFactor * classInstances.size() + superClassInstances.size()) < 1 - noise) {
        return -1;
      }
 else {
        return (coverageFactor * coveredInstances + superClassInstances.size() - additionalInstances) / (double)(coverageFactor * classInstances.size() + superClassInstances.size());
      }
    }
  }
 else   if (heuristic.equals(HeuristicType.GEN_FMEASURE)) {
    TreeSet<Individual> icPos=new TreeSet<Individual>();
    TreeSet<Individual> icNeg=new TreeSet<Individual>();
    Description descriptionNeg=new Negation(description);
    for (    Individual ind : classAndSuperClassInstances) {
      if (reasoner.hasType(description,ind)) {
        icPos.add(ind);
      }
 else       if (reasoner.hasType(descriptionNeg,ind)) {
        icNeg.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    Set<Individual> tmp1Pos=Helper.intersection(icPos,classInstancesSet);
    Set<Individual> tmp1Neg=Helper.intersection(icNeg,negatedClassInstances);
    int tmp1Size=tmp1Pos.size() + tmp1Neg.size();
    int icSize=icPos.size() + icNeg.size();
    double prec=(icSize == 0) ? 0 : tmp1Size / (double)icSize;
    double rec=tmp1Size / (double)(classInstances.size() + negatedClassInstances.size());
    if (rec <= 0.01) {
      return -1;
    }
    return getFMeasure(rec,prec);
  }
  throw new Error("String_Node_Str");
}

Fixed version (ground truth):
public double getAccuracyOrTooWeakExact(Description description,double noise){
  nanoStartTime=System.nanoTime();
  if (heuristic.equals(HeuristicType.JACCARD)) {
    TreeSet<Individual> coveredInstancesSet=new TreeSet<Individual>();
    for (    Individual ind : classInstances) {
      if (reasoner.hasType(description,ind)) {
        coveredInstancesSet.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    if (coveredInstancesSet.size() / (double)classInstances.size() <= 1 - noise) {
      return -1;
    }
    TreeSet<Individual> additionalInstancesSet=new TreeSet<Individual>();
    for (    Individual ind : superClassInstances) {
      if (reasoner.hasType(description,ind)) {
        additionalInstancesSet.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    Set<Individual> union=Helper.union(classInstancesSet,additionalInstancesSet);
    return (1 - (union.size() - coveredInstancesSet.size()) / (double)union.size());
  }
 else   if (heuristic.equals(HeuristicType.OWN) || heuristic.equals(HeuristicType.FMEASURE) || heuristic.equals(HeuristicType.PRED_ACC)) {
    int additionalInstances=0;
    for (    Individual ind : superClassInstances) {
      if (reasoner.hasType(description,ind)) {
        additionalInstances++;
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    int coveredInstances=0;
    for (    Individual ind : classInstances) {
      if (reasoner.hasType(description,ind)) {
        coveredInstances++;
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    double recall=coveredInstances / (double)classInstances.size();
    double precision=(additionalInstances + coveredInstances == 0) ? 0 : coveredInstances / (double)(coveredInstances + additionalInstances);
    if (heuristic.equals(HeuristicType.OWN)) {
      if ((coverageFactor * recall + 1) / (double)(coverageFactor + 1) < (1 - noise)) {
        return -1;
      }
 else {
        return getAccuracy(recall,precision);
      }
    }
 else     if (heuristic.equals(HeuristicType.FMEASURE)) {
      if (((1 + Math.sqrt(coverageFactor)) * recall) / (Math.sqrt(coverageFactor) + 1) < 1 - noise) {
        return -1;
      }
 else {
        return getFMeasure(recall,precision);
      }
    }
 else     if (heuristic.equals(HeuristicType.PRED_ACC)) {
      if ((coverageFactor * coveredInstances + superClassInstances.size()) / (double)(coverageFactor * classInstances.size() + superClassInstances.size()) < 1 - noise) {
        return -1;
      }
 else {
        return (coverageFactor * coveredInstances + superClassInstances.size() - additionalInstances) / (double)(coverageFactor * classInstances.size() + superClassInstances.size());
      }
    }
  }
 else   if (heuristic.equals(HeuristicType.GEN_FMEASURE)) {
    TreeSet<Individual> icPos=new TreeSet<Individual>();
    TreeSet<Individual> icNeg=new TreeSet<Individual>();
    Description descriptionNeg=new Negation(description);
    for (    Individual ind : classAndSuperClassInstances) {
      if (reasoner.hasType(description,ind)) {
        icPos.add(ind);
      }
 else       if (reasoner.hasType(descriptionNeg,ind)) {
        icNeg.add(ind);
      }
      if (terminationTimeExpired()) {
        return 0;
      }
    }
    Set<Individual> tmp1Pos=Helper.intersection(icPos,classInstancesSet);
    Set<Individual> tmp1Neg=Helper.intersection(icNeg,negatedClassInstances);
    int tmp1Size=tmp1Pos.size() + tmp1Neg.size();
    int icSize=icPos.size() + icNeg.size();
    double prec=(icSize == 0) ? 0 : tmp1Size / (double)icSize;
    double rec=tmp1Size / (double)(classInstances.size() + negatedClassInstances.size());
    if (rec <= 0.0000001) {
      return -1;
    }
    return getFMeasure(rec,prec);
  }
  throw new Error("String_Node_Str");
}