Program: 125165
Project: 125165
Buggy source:
private void calculateDistances(AbstractInference<Tripartition> inference){
  Deque<BitSet> stack=new ArrayDeque<BitSet>();
  this.distMatrix=new float[n][n];
  int[][] denom=new int[n][n];
  int k=0;
  for (  Tree tree : inference.trees) {
    STITreeCluster treeallCL=treeAllClusters.get(k++);
    Integer treeall=treeallCL.getClusterSize();
    for (    TNode node : tree.postTraverse()) {
      if (node.isLeaf()) {
        BitSet tmp=new BitSet(GlobalMaps.taxonIdentifier.taxonCount());
        tmp.set(GlobalMaps.taxonIdentifier.taxonId(node.getName()));
        stack.push(tmp);
      }
 else       if (node.isRoot() && node.getChildCount() == 3) {
        BitSet left=stack.pop();
        BitSet middle=stack.pop();
        BitSet right=stack.pop();
        updateDistanceForTwoNodes(treeall,left,right,distMatrix);
        updateDistanceForTwoNodes(treeall,left,middle,distMatrix);
        updateDistanceForTwoNodes(treeall,middle,right,distMatrix);
      }
 else {
        BitSet left=stack.pop();
        BitSet right=stack.pop();
        BitSet both=new BitSet();
        both.or(left);
        both.or(right);
        BitSet middle=new BitSet();
        middle.or(treeallCL.getBitSet());
        middle.andNot(both);
        updateDistanceForTwoNodes(treeall,left,right,distMatrix);
        updateDistanceForTwoNodes(treeall,left,middle,distMatrix);
        updateDistanceForTwoNodes(treeall,middle,right,distMatrix);
        stack.push(both);
      }
    }
    BitSet all=treeallCL.getBitSet();
    int c=all.cardinality() - 2;
    for (int l=all.nextSetBit(0); l >= 0; l=all.nextSetBit(l + 1)) {
      for (int r=all.nextSetBit(0); r >= 0; r=all.nextSetBit(r + 1)) {
        denom[l][r]+=c * (c - 1) / 2;
        denom[r][l]=denom[l][r];
      }
    }
  }
  for (int i=0; i < n; i++) {
    for (int j=i; j < n; j++) {
      if (denom[i][j] == 0)       distMatrix[i][j]=0;
 else       distMatrix[i][j]=distMatrix[i][j] / (denom[i][j] / 2);
      distMatrix[j][i]=distMatrix[i][j];
    }
  }
}

Fixed version (ground truth):
private void calculateDistances(AbstractInference<Tripartition> inference,List<STITreeCluster> treeAllClusters){
  Deque<BitSet> stack=new ArrayDeque<BitSet>();
  this.distMatrix=new float[n][n];
  int[][] denom=new int[n][n];
  int k=0;
  for (  Tree tree : inference.trees) {
    STITreeCluster treeallCL=treeAllClusters.get(k++);
    Integer treeall=treeallCL.getClusterSize();
    for (    TNode node : tree.postTraverse()) {
      if (node.isLeaf()) {
        BitSet tmp=new BitSet(GlobalMaps.taxonIdentifier.taxonCount());
        tmp.set(GlobalMaps.taxonIdentifier.taxonId(node.getName()));
        stack.push(tmp);
      }
 else       if (node.isRoot() && node.getChildCount() == 3) {
        BitSet left=stack.pop();
        BitSet middle=stack.pop();
        BitSet right=stack.pop();
        updateDistanceForTwoNodes(treeall,left,right,distMatrix);
        updateDistanceForTwoNodes(treeall,left,middle,distMatrix);
        updateDistanceForTwoNodes(treeall,middle,right,distMatrix);
      }
 else {
        BitSet left=stack.pop();
        BitSet right=stack.pop();
        BitSet both=new BitSet();
        both.or(left);
        both.or(right);
        BitSet middle=new BitSet();
        middle.or(treeallCL.getBitSet());
        middle.andNot(both);
        updateDistanceForTwoNodes(treeall,left,right,distMatrix);
        updateDistanceForTwoNodes(treeall,left,middle,distMatrix);
        updateDistanceForTwoNodes(treeall,middle,right,distMatrix);
        stack.push(both);
      }
    }
    BitSet all=treeallCL.getBitSet();
    int c=all.cardinality() - 2;
    for (int l=all.nextSetBit(0); l >= 0; l=all.nextSetBit(l + 1)) {
      for (int r=all.nextSetBit(0); r >= 0; r=all.nextSetBit(r + 1)) {
        denom[l][r]+=c * (c - 1) / 2;
        denom[r][l]=denom[l][r];
      }
    }
  }
  for (int i=0; i < n; i++) {
    for (int j=i; j < n; j++) {
      if (denom[i][j] == 0)       distMatrix[i][j]=0;
 else       distMatrix[i][j]=distMatrix[i][j] / (denom[i][j] / 2);
      distMatrix[j][i]=distMatrix[i][j];
    }
  }
}