From 7cf0dd26c5d9553d7dd622ada18d4c61739fbbe4 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 8 Jul 2004 03:48:35 +0000 Subject: [PATCH 1/1] Invariant Value class --- .../RepairCompiler/MCC/IR/InvariantValue.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 Repair/RepairCompiler/MCC/IR/InvariantValue.java diff --git a/Repair/RepairCompiler/MCC/IR/InvariantValue.java b/Repair/RepairCompiler/MCC/IR/InvariantValue.java new file mode 100755 index 0000000..f1b57c1 --- /dev/null +++ b/Repair/RepairCompiler/MCC/IR/InvariantValue.java @@ -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); + } +} -- 2.34.1