x.f = y now prunes new edge's beta by alpha at x
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / ReachabilitySet.java
index d412cffd9b3c8a343a4b9294c459d63923fb74c9..f7a5721ac255b1b980618a8a273ee16641b9c4ff 100644 (file)
@@ -202,7 +202,8 @@ public class ReachabilitySet extends Canonical {
 
 
     public ReachabilitySet ageTokens( AllocationSite as ) {    
-
+       assert as != null;
+       
        ReachabilitySet rsOut = new ReachabilitySet();
 
        Iterator itrS = this.iterator();
@@ -215,6 +216,32 @@ public class ReachabilitySet extends Canonical {
     }
 
 
+    public ReachabilitySet pruneBy( ReachabilitySet rsIn ) {
+       assert rsIn != null;
+
+       ReachabilitySet rsOut = new ReachabilitySet();
+
+       Iterator itrB = this.iterator();
+       while( itrB.hasNext() ) {
+           TokenTupleSet ttsB = (TokenTupleSet) itrB.next();
+
+           boolean subsetExists = false;
+
+           Iterator itrA = rsIn.iterator();
+           while( itrA.hasNext() && !subsetExists ) {
+               TokenTupleSet ttsA = (TokenTupleSet) itrA.next();
+           
+               if( ttsA.isSubset( ttsB ) ) {
+                   subsetExists = true;
+                   rsOut.possibleReachabilities.add( ttsB );               
+               }
+           }
+       }
+
+       return rsOut.makeCanonical();   
+    }
+
+
     public boolean equals( Object o ) {
        if( !(o instanceof ReachabilitySet) ) {
            return false;