Broadening implementation for reachability in ownership analysis.
[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 public class ChangeTuple
13 {
14     private TokenTupleSet toMatch;
15     private TokenTupleSet toAdd;
16
17     public ChangeTuple( TokenTupleSet toMatch,
18                         TokenTupleSet toAdd ) {
19         this.toMatch = toMatch;
20         this.toAdd   = toAdd;
21     }
22
23     public TokenTupleSet getSetToMatch() { return toMatch; }
24     public TokenTupleSet getSetToAdd()   { return toAdd;   }
25
26     public boolean equals( Object o ) {
27         if( !(o instanceof ChangeTuple) ) {
28             return false;
29         }
30
31         ChangeTuple ct = (ChangeTuple) o;
32
33         return toMatch.equals( ct.getSetToMatch() ) &&
34                  toAdd.equals( ct.getSetToAdd()   );
35     }
36
37     public int hashCode() {
38         return toMatch.hashCode() + toAdd.hashCode();
39     }
40
41     public ChangeTuple copy() {
42         return new ChangeTuple( toMatch, toAdd );
43     }
44
45     public String toString() {
46         return new String( "<"+toMatch+" -> "+toAdd+">" );
47     }
48 }