special union of reachability sets works correctly now
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / TokenTupleSet.java
index 626e5327fd9e679957b70373979e73d7c094a626..9a81a6583d1fb99f79ceec2e66f8ea949acc823e 100644 (file)
@@ -8,7 +8,7 @@ import java.io.*;
 
 public class TokenTupleSet {
 
-    public HashSet<TokenTuple> tokenTuples;
+    private HashSet<TokenTuple> tokenTuples;
 
     public TokenTupleSet() {
        tokenTuples = new HashSet<TokenTuple>();
@@ -33,10 +33,26 @@ public class TokenTupleSet {
        return ttsOut;
     }
 
-    public boolean contains( TokenTuple tt ) {
+    public boolean isEmpty() {
+       return tokenTuples.isEmpty();
+    }
+
+    public boolean containsTuple( TokenTuple tt ) {
        return tokenTuples.contains( tt );
     }
 
+    // this should be a hash table so we can do this by key
+    public boolean containsToken( Integer token ) {
+       Iterator itr = tokenTuples.iterator();
+       while( itr.hasNext() ) {
+           TokenTuple tt = (TokenTuple) itr.next();
+           if( token.equals( tt.getToken() ) ) {
+               return true;
+           }
+       }
+       return false;
+    }
+
     public String toString() {
        return tokenTuples.toString();
     }