Program: 9431
Project: 9431
Buggy source:
private void computeTopRefinements(int maxLength,OWLClass domain){
  long topComputationTimeStartNs=System.nanoTime();
  if (domain == null && m.size() == 0)   computeM();
  if (domain != null && !mA.containsKey(domain))   computeM(domain);
  int refinementsLength;
  if (domain == null) {
    refinementsLength=topRefinementsLength;
  }
 else {
    if (!topARefinementsLength.containsKey(domain))     topARefinementsLength.put(domain,0);
    refinementsLength=topARefinementsLength.get(domain);
  }
  for (int i=refinementsLength + 1; i <= maxLength; i++) {
    combos.put(i,MathOperations.getCombos(i,mMaxLength));
    if (domain == null) {
      topRefinements.put(i,new TreeSet<OWLClassExpression>());
    }
 else {
      if (!topARefinements.containsKey(domain))       topARefinements.put(domain,new TreeMap<Integer,SortedSet<OWLClassExpression>>());
      topARefinements.get(domain).put(i,new TreeSet<OWLClassExpression>());
    }
    for (    List<Integer> combo : combos.get(i)) {
      if (combo.size() == 1) {
        if (domain == null)         topRefinements.get(i).addAll(m.get(i));
 else         topARefinements.get(domain).get(i).addAll(mA.get(domain).get(i));
      }
 else {
        boolean validCombo=true;
        for (        Integer j : combo) {
          if ((domain == null && m.get(j).size() == 0) || (domain != null && mA.get(domain).get(j).size() == 0))           validCombo=false;
        }
        if (validCombo) {
          SortedSet<OWLObjectUnionOf> baseSet=new TreeSet<OWLObjectUnionOf>();
          for (          Integer j : combo) {
            if (domain == null)             baseSet=MathOperations.incCrossProduct(baseSet,m.get(j));
 else             baseSet=MathOperations.incCrossProduct(baseSet,mA.get(domain).get(j));
          }
          for (          OWLClassExpression concept : baseSet) {
            ConceptTransformation.transformToOrderedForm(concept);
          }
          if (applyExistsFilter) {
            Iterator<OWLObjectUnionOf> it=baseSet.iterator();
            while (it.hasNext()) {
              if (MathOperations.containsDoubleObjectSomeRestriction(it.next()))               it.remove();
            }
          }
          if (domain == null)           topRefinements.get(i).addAll(baseSet);
 else           topARefinements.get(domain).get(i).addAll(baseSet);
        }
      }
    }
    TreeSet<OWLClassExpression> cumulativeRefinements=new TreeSet<OWLClassExpression>();
    for (int j=1; j <= i; j++) {
      if (domain == null) {
        cumulativeRefinements.addAll(topRefinements.get(j));
      }
 else {
        cumulativeRefinements.addAll(topARefinements.get(domain).get(j));
      }
    }
    if (domain == null) {
      topRefinementsCumulative.put(i,cumulativeRefinements);
    }
 else {
      if (!topARefinementsCumulative.containsKey(domain))       topARefinementsCumulative.put(domain,new TreeMap<Integer,TreeSet<OWLClassExpression>>());
      topARefinementsCumulative.get(domain).put(i,cumulativeRefinements);
    }
  }
  if (domain == null)   topRefinementsLength=maxLength;
 else   topARefinementsLength.put(domain,maxLength);
  topComputationTimeNs+=System.nanoTime() - topComputationTimeStartNs;
}

Fixed version (ground truth):
private void computeTopRefinements(int maxLength,OWLClassExpression domain){
  long topComputationTimeStartNs=System.nanoTime();
  if (domain == null && m.size() == 0)   computeM();
  if (domain != null && !mA.containsKey(domain))   computeM(domain);
  int refinementsLength;
  if (domain == null) {
    refinementsLength=topRefinementsLength;
  }
 else {
    if (!topARefinementsLength.containsKey(domain))     topARefinementsLength.put(domain,0);
    refinementsLength=topARefinementsLength.get(domain);
  }
  for (int i=refinementsLength + 1; i <= maxLength; i++) {
    combos.put(i,MathOperations.getCombos(i,mMaxLength));
    if (domain == null) {
      topRefinements.put(i,new TreeSet<OWLClassExpression>());
    }
 else {
      if (!topARefinements.containsKey(domain))       topARefinements.put(domain,new TreeMap<Integer,SortedSet<OWLClassExpression>>());
      topARefinements.get(domain).put(i,new TreeSet<OWLClassExpression>());
    }
    for (    List<Integer> combo : combos.get(i)) {
      if (combo.size() == 1) {
        if (domain == null)         topRefinements.get(i).addAll(m.get(i));
 else         topARefinements.get(domain).get(i).addAll(mA.get(domain).get(i));
      }
 else {
        boolean validCombo=true;
        for (        Integer j : combo) {
          if ((domain == null && m.get(j).size() == 0) || (domain != null && mA.get(domain).get(j).size() == 0))           validCombo=false;
        }
        if (validCombo) {
          SortedSet<OWLObjectUnionOf> baseSet=new TreeSet<OWLObjectUnionOf>();
          for (          Integer j : combo) {
            if (domain == null)             baseSet=MathOperations.incCrossProduct(baseSet,m.get(j));
 else             baseSet=MathOperations.incCrossProduct(baseSet,mA.get(domain).get(j));
          }
          for (          OWLClassExpression concept : baseSet) {
            ConceptTransformation.transformToOrderedForm(concept);
          }
          if (applyExistsFilter) {
            Iterator<OWLObjectUnionOf> it=baseSet.iterator();
            while (it.hasNext()) {
              if (MathOperations.containsDoubleObjectSomeRestriction(it.next()))               it.remove();
            }
          }
          if (domain == null)           topRefinements.get(i).addAll(baseSet);
 else           topARefinements.get(domain).get(i).addAll(baseSet);
        }
      }
    }
    TreeSet<OWLClassExpression> cumulativeRefinements=new TreeSet<OWLClassExpression>();
    for (int j=1; j <= i; j++) {
      if (domain == null) {
        cumulativeRefinements.addAll(topRefinements.get(j));
      }
 else {
        cumulativeRefinements.addAll(topARefinements.get(domain).get(j));
      }
    }
    if (domain == null) {
      topRefinementsCumulative.put(i,cumulativeRefinements);
    }
 else {
      if (!topARefinementsCumulative.containsKey(domain))       topARefinementsCumulative.put(domain,new TreeMap<Integer,TreeSet<OWLClassExpression>>());
      topARefinementsCumulative.get(domain).put(i,cumulativeRefinements);
    }
  }
  if (domain == null)   topRefinementsLength=maxLength;
 else   topARefinementsLength.put(domain,maxLength);
  topComputationTimeNs+=System.nanoTime() - topComputationTimeStartNs;
}