Added fields to ReferenceEdgeProperties and combed over all classes that need proper...
[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 extends Canonical
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 ChangeTuple makeCanonical() {
27         return (ChangeTuple) Canonical.makeCanonical( this );
28     }
29
30     public TokenTupleSet getSetToMatch() { return toMatch; }
31     public TokenTupleSet getSetToAdd()   { return toAdd;   }
32
33     public boolean equals( Object o ) {
34         if( o == null ) {
35             return false;
36         }
37
38         if( !(o instanceof ChangeTuple) ) {
39             return false;
40         }
41
42         ChangeTuple ct = (ChangeTuple) o;
43
44         return toMatch.equals( ct.getSetToMatch() ) &&
45                  toAdd.equals( ct.getSetToAdd()   );
46     }
47
48     public int hashCode() {
49         return toMatch.hashCode() + toAdd.hashCode();
50     }
51
52     public String toString() {
53         return new String( "<"+toMatch+" -> "+toAdd+">" );
54     }
55 }