1 package Analysis.OwnershipAnalysis;
9 public class ChangeTupleSet extends Canonical {
11 private HashSet<ChangeTuple> changeTuples;
13 public ChangeTupleSet() {
14 changeTuples = new HashSet<ChangeTuple>();
17 public ChangeTupleSet(ChangeTuple ct) {
22 public ChangeTupleSet(ChangeTupleSet cts) {
23 changeTuples = (HashSet<ChangeTuple>)cts.changeTuples.clone();
26 public ChangeTupleSet makeCanonical() {
27 return (ChangeTupleSet) Canonical.makeCanonical(this);
30 public Iterator iterator() {
31 return changeTuples.iterator();
34 public ChangeTupleSet union(ChangeTupleSet ctsIn) {
37 ChangeTupleSet ctsOut = new ChangeTupleSet(this);
38 ctsOut.changeTuples.addAll(ctsIn.changeTuples);
39 return ctsOut.makeCanonical();
42 public ChangeTupleSet union(ChangeTuple ctIn) {
45 ChangeTupleSet ctsOut = new ChangeTupleSet(this);
46 ctsOut.changeTuples.add(ctIn);
47 return ctsOut.makeCanonical();
50 public boolean isEmpty() {
51 return changeTuples.isEmpty();
54 public boolean isSubset(ChangeTupleSet ctsIn) {
56 return ctsIn.changeTuples.containsAll(this.changeTuples);
59 public boolean equals(Object o) {
64 if( !(o instanceof ChangeTupleSet) ) {
68 ChangeTupleSet cts = (ChangeTupleSet) o;
69 return changeTuples.equals(cts.changeTuples);
72 public int hashCode() {
73 return changeTuples.hashCode();
76 public String toString() {
79 Iterator i = this.iterator();
80 while( i.hasNext() ) {