More reachability set functionality, but not all there yet
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / ChangeTuple.java
1 package Analysis.OwnershipAnalysis;
2
3 import IR.*;
4 import IR.Flat.*;
5 import java.util.*;
6 import java.io.*;
7
8
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
12
13 // THIS CLASS IS IMMUTABLE!
14
15 public class ChangeTuple
16 {
17     private TokenTupleSet toMatch;
18     private TokenTupleSet toAdd;
19
20     public ChangeTuple( TokenTupleSet toMatch,
21                         TokenTupleSet toAdd ) {
22         this.toMatch = toMatch;
23         this.toAdd   = toAdd;
24     }
25
26     public TokenTupleSet getSetToMatch() { return toMatch; }
27     public TokenTupleSet getSetToAdd()   { return toAdd;   }
28
29     public boolean equals( Object o ) {
30         if( !(o instanceof ChangeTuple) ) {
31             return false;
32         }
33
34         ChangeTuple ct = (ChangeTuple) o;
35
36         return toMatch.equals( ct.getSetToMatch() ) &&
37                  toAdd.equals( ct.getSetToAdd()   );
38     }
39
40     public int hashCode() {
41         return toMatch.hashCode() + toAdd.hashCode();
42     }
43
44     public String toString() {
45         return new String( "<"+toMatch+" -> "+toAdd+">" );
46     }
47 }