Invariant Value class
authorbdemsky <bdemsky>
Thu, 8 Jul 2004 03:48:35 +0000 (03:48 +0000)
committerbdemsky <bdemsky>
Thu, 8 Jul 2004 03:48:35 +0000 (03:48 +0000)
Repair/RepairCompiler/MCC/IR/InvariantValue.java [new file with mode: 0755]

diff --git a/Repair/RepairCompiler/MCC/IR/InvariantValue.java b/Repair/RepairCompiler/MCC/IR/InvariantValue.java
new file mode 100755 (executable)
index 0000000..f1b57c1
--- /dev/null
@@ -0,0 +1,33 @@
+package MCC.IR;
+import java.util.*;
+
+public class InvariantValue {
+    Hashtable maybevalue;
+    Hashtable value;
+
+    public InvariantValue() {
+       maybevalue=new Hashtable();
+       value=new Hashtable();
+    }
+
+    void assignPair(Expr e, VarDescriptor val, VarDescriptor maybe) {
+       value.put(e,val);
+       maybevalue.put(e,maybe);
+    }
+
+    VarDescriptor getValue(Expr e) {
+       if (value.containsKey(e))
+           return (VarDescriptor)value.get(e);
+       throw new Error("No Value");
+    }
+    
+    VarDescriptor getMaybe(Expr e) {
+       if (maybevalue.containsKey(e))
+           return (VarDescriptor)maybevalue.get(e);
+       throw new Error("No Value");
+    }
+
+    boolean isInvariant(Expr e) {
+       return maybevalue.containsKey(e);
+    }
+}