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 ) {
19 changeTuples.add( ct );
22 public ChangeTupleSet( ChangeTupleSet cts ) {
23 changeTuples = (HashSet<ChangeTuple>) cts.changeTuples.clone(); //COPY?!
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 ) {
60 if( !(o instanceof ChangeTupleSet) ) {
64 ChangeTupleSet cts = (ChangeTupleSet) o;
65 return changeTuples.equals( cts.changeTuples );
68 public int hashCode() {
69 return changeTuples.hashCode();
72 public String toString() {
75 Iterator i = this.iterator();
76 while( i.hasNext() ) {