a bug fix...
[IRC.git] / Robust / src / Analysis / SSJava / BuildLattice.java
index 7a38272d4fd3d67c84a9bac1a92868f5f7aeb002..61a083274e84e97c7968442d8bc6d5d502d343f8 100644 (file)
@@ -276,6 +276,7 @@ public class BuildLattice {
           if (hNode.isCombinationNode()) {
             Set<HNode> combineSkeletonNodeSet =
                 hierarchyGraph.getCombineSetByCombinationNode(hNode);
           if (hNode.isCombinationNode()) {
             Set<HNode> combineSkeletonNodeSet =
                 hierarchyGraph.getCombineSetByCombinationNode(hNode);
+
             aboveSet.addAll(hierarchyGraph
                 .getFirstNodeOfCombinationNodeChainSet(combineSkeletonNodeSet));
             SCNode = scGraph.getCombinationNode(combineSkeletonNodeSet);
             aboveSet.addAll(hierarchyGraph
                 .getFirstNodeOfCombinationNodeChainSet(combineSkeletonNodeSet));
             SCNode = scGraph.getCombinationNode(combineSkeletonNodeSet);
@@ -288,9 +289,16 @@ public class BuildLattice {
             SCNode = aboveSet.iterator().next();
           }
 
             SCNode = aboveSet.iterator().next();
           }
 
-          numNonSharedNodes = hierarchyGraph.countNonSharedNode(hNode, aboveSet);
+          // update above set w.r.t the hierarchy graph with SC nodes
+          // because the skeleton nodes in the origianl hierarchy graph may merged to a new node
+          Set<HNode> endSet = new HashSet<HNode>();
+          for (Iterator iterator2 = aboveSet.iterator(); iterator2.hasNext();) {
+            HNode aboveNode = (HNode) iterator2.next();
+            endSet.add(scGraph.getCurrentHNode(aboveNode));
+          }
+          numNonSharedNodes = hierarchyGraph.countNonSharedNode(hNode, endSet);
 
 
-          System.out.println("   node=" + hNode + " above=" + aboveSet + " distance="
+          System.out.println("   node=" + hNode + " above=" + endSet + " distance="
               + numNonSharedNodes + "   SCNode=" + SCNode);
         }
 
               + numNonSharedNodes + "   SCNode=" + SCNode);
         }
 
@@ -326,6 +334,7 @@ public class BuildLattice {
 
   private String recur_getNewLocation(SSJavaLattice<String> lattice, String cur,
       Set<String> endSet, int dist, boolean isShared) {
 
   private String recur_getNewLocation(SSJavaLattice<String> lattice, String cur,
       Set<String> endSet, int dist, boolean isShared) {
+    System.out.println("H");
     Set<String> connectedSet = lattice.get(cur);
     if (connectedSet == null) {
       connectedSet = new HashSet<String>();
     Set<String> connectedSet = lattice.get(cur);
     if (connectedSet == null) {
       connectedSet = new HashSet<String>();