1 package Analysis.OwnershipAnalysis;
9 // a change touple is a pair that indicates if the
10 // first TokenTupleSet is found in a ReachabilitySet,
11 // then the second TokenTupleSet should be added
13 // THIS CLASS IS IMMUTABLE!
15 public class ChangeTuple extends Canonical
17 private TokenTupleSet toMatch;
18 private TokenTupleSet toAdd;
20 public ChangeTuple( TokenTupleSet toMatch,
21 TokenTupleSet toAdd ) {
22 this.toMatch = toMatch;
26 public ChangeTuple makeCanonical() {
27 return (ChangeTuple) Canonical.makeCanonical( this );
30 public TokenTupleSet getSetToMatch() { return toMatch; }
31 public TokenTupleSet getSetToAdd() { return toAdd; }
33 public boolean equals( Object o ) {
34 if( !(o instanceof ChangeTuple) ) {
38 ChangeTuple ct = (ChangeTuple) o;
40 return toMatch.equals( ct.getSetToMatch() ) &&
41 toAdd.equals( ct.getSetToAdd() );
44 public int hashCode() {
45 return toMatch.hashCode() + toAdd.hashCode();
48 public String toString() {
49 return new String( "<"+toMatch+" -> "+toAdd+">" );