Program: 125191
Project: 125191
Buggy source:
private Integer calculateDLCost(List<Integer> El,Vertex smallV,Vertex bigv){
  Integer e=0;
  List<Tree> trees=inference.trees;
  TaxonNameMap taxonNameMap=inference.taxonNameMap;
  if (inference.HomomorphicDL) {
    for (int k=0; k < trees.size(); k++) {
      Tree tr=trees.get(k);
      STITreeCluster treeAll=inference.counter.treeAlls.get(k);
      if (smallV.getCluster().isDisjoint(treeAll) || bigv.getCluster().isDisjoint(treeAll)) {
        continue;
      }
      if (El.get(k) == null) {
        if (taxonNameMap == null) {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster()));
        }
 else {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster(),taxonNameMap));
        }
      }
      e+=El.get(k);
    }
  }
 else {
    for (int k=0; k < trees.size(); k++) {
      Tree tr=trees.get(k);
      STITreeCluster treeAll=inference.counter.treeAlls.get(k);
      int extraTerms=0;
      boolean pDisJoint=smallV.getCluster().isDisjoint(treeAll);
      boolean qDisJoint=bigv.getCluster().isDisjoint(treeAll);
      if (pDisJoint && qDisJoint) {
        extraTerms=0;
      }
 else       if (!pDisJoint && !pDisJoint) {
        extraTerms=2;
      }
 else {
        extraTerms=1;
      }
      if (El.get(k) == null) {
        if (taxonNameMap == null) {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster()));
        }
 else {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster(),taxonNameMap));
        }
      }
      e+=(El.get(k) + extraTerms);
    }
  }
  return e;
}

Fixed version (ground truth):
private Integer calculateDLCost(List<Integer> El,Vertex smallV,Vertex bigv){
  Integer e=0;
  List<Tree> trees=inference.trees;
  TaxonNameMap taxonNameMap=inference.taxonNameMap;
  if (inference.HomomorphicDL) {
    for (int k=0; k < trees.size(); k++) {
      Tree tr=trees.get(k);
      STITreeCluster treeAll=inference.counter.treeAlls.get(k);
      if (smallV.getCluster().isDisjoint(treeAll) || bigv.getCluster().isDisjoint(treeAll)) {
        continue;
      }
      if (El.get(k) == null) {
        if (taxonNameMap == null) {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster()));
        }
 else {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster(),taxonNameMap));
        }
      }
      e+=El.get(k);
    }
  }
 else {
    for (int k=0; k < trees.size(); k++) {
      Tree tr=trees.get(k);
      STITreeCluster treeAll=inference.counter.treeAlls.get(k);
      int extraTerms=0;
      boolean pDisJoint=smallV.getCluster().isDisjoint(treeAll);
      boolean qDisJoint=bigv.getCluster().isDisjoint(treeAll);
      if (pDisJoint && qDisJoint) {
        extraTerms=0;
      }
 else       if (!pDisJoint && !qDisJoint) {
        extraTerms=2;
      }
 else {
        extraTerms=1;
      }
      if (El.get(k) == null) {
        if (taxonNameMap == null) {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster()));
        }
 else {
          El.set(k,DeepCoalescencesCounter.getClusterCoalNum_rooted(tr,v.getCluster(),taxonNameMap));
        }
      }
      e+=(El.get(k) + extraTerms);
    }
  }
  return e;
}