From 99040b5e3460f3e28210e6b672bc8b46545a775e Mon Sep 17 00:00:00 2001 From: yeom Date: Mon, 18 Feb 2013 19:36:04 +0000 Subject: [PATCH] a bug fix... --- Robust/src/Analysis/SSJava/BuildLattice.java | 13 +++++++++++-- Robust/src/Analysis/SSJava/LocationInference.java | 8 ++++++++ Robust/src/Util/Lattice.java | 11 +++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Robust/src/Analysis/SSJava/BuildLattice.java b/Robust/src/Analysis/SSJava/BuildLattice.java index 7a38272d..61a08327 100644 --- a/Robust/src/Analysis/SSJava/BuildLattice.java +++ b/Robust/src/Analysis/SSJava/BuildLattice.java @@ -276,6 +276,7 @@ public class BuildLattice { if (hNode.isCombinationNode()) { Set combineSkeletonNodeSet = hierarchyGraph.getCombineSetByCombinationNode(hNode); + aboveSet.addAll(hierarchyGraph .getFirstNodeOfCombinationNodeChainSet(combineSkeletonNodeSet)); SCNode = scGraph.getCombinationNode(combineSkeletonNodeSet); @@ -288,9 +289,16 @@ public class BuildLattice { 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 endSet = new HashSet(); + 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); } @@ -326,6 +334,7 @@ public class BuildLattice { private String recur_getNewLocation(SSJavaLattice lattice, String cur, Set endSet, int dist, boolean isShared) { + System.out.println("H"); Set connectedSet = lattice.get(cur); if (connectedSet == null) { connectedSet = new HashSet(); diff --git a/Robust/src/Analysis/SSJava/LocationInference.java b/Robust/src/Analysis/SSJava/LocationInference.java index caa4504a..b15742f5 100644 --- a/Robust/src/Analysis/SSJava/LocationInference.java +++ b/Robust/src/Analysis/SSJava/LocationInference.java @@ -2607,7 +2607,15 @@ public class LocationInference { addMapDescToSimpleLattice(desc, simpleLattice); + if (desc instanceof ClassDescriptor) { + writeInferredLatticeDotFile((ClassDescriptor) desc, null, simpleLattice, "_SC"); + } else { + MethodDescriptor md = (MethodDescriptor) desc; + writeInferredLatticeDotFile(md.getClassDesc(), md, simpleLattice, "_SC"); + } + HierarchyGraph simpleHierarchyGraph = getSimpleHierarchyGraph(desc); + // System.out.println("\n## insertIntermediateNodesToStraightLine:" // + simpleHierarchyGraph.getName()); SSJavaLattice lattice = diff --git a/Robust/src/Util/Lattice.java b/Robust/src/Util/Lattice.java index b76b7bb0..0418d237 100644 --- a/Robust/src/Util/Lattice.java +++ b/Robust/src/Util/Lattice.java @@ -66,12 +66,12 @@ public class Lattice { } public boolean put(T key, T value) { - - if(isGreaterThan(key, value)){ + + if (isComparable(key, value) && isGreaterThan(key, value)) { // this relation already exists return false; } - + Set s; Set topNeighbor = table.get(top); @@ -95,10 +95,9 @@ public class Lattice { } // if value is already connected with top, it is no longer to be - if(!key.equals(top)){ - topNeighbor.remove(value); + if (!key.equals(top)) { + topNeighbor.remove(value); } - // if key is already connected with bottom,, it is no longer to be if (!value.equals(getBottomItem())) { -- 2.34.1