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() {
33 public TokenTupleSet getSetToAdd() {
37 public boolean equals(Object o) {
42 if( !(o instanceof ChangeTuple) ) {
46 ChangeTuple ct = (ChangeTuple) o;
48 return toMatch.equals(ct.getSetToMatch() ) &&
49 toAdd.equals(ct.getSetToAdd() );
52 public int hashCode() {
53 return toMatch.hashCode() + toAdd.hashCode()*3;
56 public String toString() {
57 return new String("<"+toMatch+" -> "+toAdd+">");