start of new file
authorjjenista <jjenista>
Mon, 11 Aug 2008 23:17:47 +0000 (23:17 +0000)
committerjjenista <jjenista>
Mon, 11 Aug 2008 23:17:47 +0000 (23:17 +0000)
Robust/src/Analysis/OwnershipAnalysis/SubstitutionTuple.java [new file with mode: 0644]

diff --git a/Robust/src/Analysis/OwnershipAnalysis/SubstitutionTuple.java b/Robust/src/Analysis/OwnershipAnalysis/SubstitutionTuple.java
new file mode 100644 (file)
index 0000000..ce36f67
--- /dev/null
@@ -0,0 +1,55 @@
+package Analysis.OwnershipAnalysis;
+
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+
+// a change touple is a pair that indicates if the
+// first TokenTupleSet is found in a ReachabilitySet,
+// then the second TokenTupleSet should be added
+
+// THIS CLASS IS IMMUTABLE!
+
+public class ChangeTuple extends Canonical
+{
+    private TokenTupleSet toMatch;
+    private TokenTupleSet toAdd;
+
+    public ChangeTuple( TokenTupleSet toMatch,
+                       TokenTupleSet toAdd ) {
+       this.toMatch = toMatch;
+       this.toAdd   = toAdd;
+    }
+
+    public ChangeTuple makeCanonical() {
+       return (ChangeTuple) Canonical.makeCanonical( this );
+    }
+
+    public TokenTupleSet getSetToMatch() { return toMatch; }
+    public TokenTupleSet getSetToAdd()   { return toAdd;   }
+
+    public boolean equals( Object o ) {
+       if( o == null ) {
+           return false;
+       }
+
+       if( !(o instanceof ChangeTuple) ) {
+           return false;
+       }
+
+       ChangeTuple ct = (ChangeTuple) o;
+
+       return toMatch.equals( ct.getSetToMatch() ) &&
+                toAdd.equals( ct.getSetToAdd()   );
+    }
+
+    public int hashCode() {
+       return toMatch.hashCode() + toAdd.hashCode();
+    }
+
+    public String toString() {
+       return new String( "<"+toMatch+" -> "+toAdd+">" );
+    }
+}