Program: 125175
Project: 125175
Buggy source:
public static int getClusterCoalNum_unrootedMap(Tree tr,STITreeCluster cluster){
  Map map=new HashMap();
  List gtTaxalist=new ArrayList();
  String[] gtTaxa=tr.getLeaves();
  int ngtTaxa=gtTaxa.length;
  for (  String leaf : gtTaxa) {
    gtTaxalist.add(leaf);
  }
  STITreeCluster concluster=new STITreeCluster();
  for (  TNode n : tr.getNodes()) {
    if ((!n.isLeaf()) || (!cluster.containsLeaf((String)GlobalMaps.taxonNameMap.getTaxonName(n.getName()))))     continue;
    concluster.addLeaf(n.getName());
  }
  Object coveragelist=new ArrayList();
  for (int i=concluster.getBitSet().nextSetBit(0); i >= 0; i=concluster.getBitSet().nextSetBit(i + 1)) {
    BitSet bs=new BitSet(ngtTaxa);
    ((BitSet)bs).set(i);
    ((List)coveragelist).add(bs);
  }
  int intersect;
  BitSet virtualbs;
  for (Object tn=tr.postTraverse().iterator(); ((Iterator)tn).hasNext(); ) {
    TNode node=(TNode)((Iterator)tn).next();
    if (((List)coveragelist).size() <= 1) {
      break;
    }
    BitSet bs=new BitSet(ngtTaxa);
    intersect=0;
    virtualbs=new BitSet(ngtTaxa);
    if (node.isLeaf()) {
      int index=gtTaxalist.indexOf(node.getName());
      bs.set(index);
      map.put(node,bs);
    }
 else {
      for (      TNode child : node.getChildren()) {
        BitSet v=(BitSet)map.get(child);
        bs.or(v);
        if (concluster.containsCluster(v)) {
          intersect++;
          virtualbs.or(v);
        }
      }
      if ((concluster.containsCluster(bs)) || (intersect > 1)) {
        if (concluster.containsCluster(bs)) {
          virtualbs=bs;
        }
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)virtualbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(virtualbs);
      }
      map.put(node,bs);
    }
    if (!node.isRoot()) {
      BitSet complementbs=(BitSet)bs.clone();
      complementbs.flip(0,gtTaxa.length);
      if (intersect > 0) {
        complementbs.or(virtualbs);
      }
      if (concluster.containsCluster(complementbs)) {
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)complementbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(complementbs);
        break;
      }
    }
  }
  return Math.max(0,((List)coveragelist).size() - 1);
}

Fixed version (ground truth):
public static int getClusterCoalNum_unrootedMap(Tree tr,STITreeCluster cluster){
  Map map=new HashMap();
  List gtTaxalist=new ArrayList();
  String[] gtTaxa=tr.getLeaves();
  int ngtTaxa=gtTaxa.length;
  for (  String leaf : gtTaxa) {
    gtTaxalist.add(leaf);
  }
  STITreeCluster concluster=new STITreeCluster();
  for (  TNode n : tr.getNodes()) {
    if ((!n.isLeaf()) || (!cluster.containsLeaf((String)GlobalMaps.taxonNameMap.getTaxonName(n.getName()))))     continue;
    concluster.addLeaf(GlobalMaps.taxonIdentifier.taxonId(n.getName()));
  }
  Object coveragelist=new ArrayList();
  for (int i=concluster.getBitSet().nextSetBit(0); i >= 0; i=concluster.getBitSet().nextSetBit(i + 1)) {
    BitSet bs=new BitSet(ngtTaxa);
    ((BitSet)bs).set(i);
    ((List)coveragelist).add(bs);
  }
  int intersect;
  BitSet virtualbs;
  for (Object tn=tr.postTraverse().iterator(); ((Iterator)tn).hasNext(); ) {
    TNode node=(TNode)((Iterator)tn).next();
    if (((List)coveragelist).size() <= 1) {
      break;
    }
    BitSet bs=new BitSet(ngtTaxa);
    intersect=0;
    virtualbs=new BitSet(ngtTaxa);
    if (node.isLeaf()) {
      int index=gtTaxalist.indexOf(node.getName());
      bs.set(index);
      map.put(node,bs);
    }
 else {
      for (      TNode child : node.getChildren()) {
        BitSet v=(BitSet)map.get(child);
        bs.or(v);
        if (concluster.containsCluster(v)) {
          intersect++;
          virtualbs.or(v);
        }
      }
      if ((concluster.containsCluster(bs)) || (intersect > 1)) {
        if (concluster.containsCluster(bs)) {
          virtualbs=bs;
        }
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)virtualbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(virtualbs);
      }
      map.put(node,bs);
    }
    if (!node.isRoot()) {
      BitSet complementbs=(BitSet)bs.clone();
      complementbs.flip(0,gtTaxa.length);
      if (intersect > 0) {
        complementbs.or(virtualbs);
      }
      if (concluster.containsCluster(complementbs)) {
        for (int i=0; i < ((List)coveragelist).size(); i++) {
          BitSet exbs=(BitSet)((List)coveragelist).get(i);
          BitSet temp=(BitSet)complementbs.clone();
          temp.and(exbs);
          if (temp.equals(exbs)) {
            ((List)coveragelist).remove(i);
            i--;
          }
        }
        ((List)coveragelist).add(complementbs);
        break;
      }
    }
  }
  return Math.max(0,((List)coveragelist).size() - 1);
}