special union of reachability sets works correctly now
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / ChangeTupleSet.java
1 package Analysis.OwnershipAnalysis;
2
3 import IR.*;
4 import IR.Flat.*;
5 import java.util.*;
6 import java.io.*;
7
8
9 public class ChangeTupleSet {
10
11     private HashSet<ChangeTuple> changeTuples;
12
13     public ChangeTupleSet() {
14         changeTuples = new HashSet<ChangeTuple>();
15     }
16
17     public ChangeTupleSet( ChangeTuple ct ) {
18         this();
19         changeTuples.add( ct );
20     }
21
22     public ChangeTupleSet( ChangeTupleSet cts ) {
23         changeTuples = (HashSet<ChangeTuple>) cts.changeTuples.clone(); //COPY?!
24     }
25
26     public Iterator iterator() {
27         return changeTuples.iterator();
28     }
29
30     public ChangeTupleSet union( ChangeTupleSet ctsIn ) {
31         ChangeTupleSet ctsOut = new ChangeTupleSet( this );
32         ctsOut.changeTuples.addAll( ctsIn.changeTuples );
33         return ctsOut;
34     }
35
36     public boolean isSubset( ChangeTupleSet ctsIn ) {
37         return ctsIn.changeTuples.containsAll( this.changeTuples );
38     }
39
40     public String toString() {
41         String s = "[";
42
43         Iterator i = this.iterator();
44         while( i.hasNext() ) {
45             s += "\n  "+i.next();
46         }
47
48         s += "\n]";
49
50         return s;
51     }
52 }