From: bdemsky Date: Thu, 8 Jul 2004 03:48:35 +0000 (+0000) Subject: Invariant Value class X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=commitdiff_plain;h=7cf0dd26c5d9553d7dd622ada18d4c61739fbbe4;hp=50ce88df425daa0b6ee8777df6fce3ad5cc14c7f Invariant Value class --- 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); + } +}