Fixed some analysis problems...
[repair.git] / Repair / RepairCompiler / MCC / IR / InvariantValue.java
1 package MCC.IR;
2 import java.util.*;
3
4 public class InvariantValue {
5     Hashtable maybevalue;
6     Hashtable value;
7
8     public InvariantValue() {
9         maybevalue=new Hashtable();
10         value=new Hashtable();
11     }
12
13     void assignPair(Expr e, VarDescriptor val, VarDescriptor maybe) {
14         value.put(e,val);
15         maybevalue.put(e,maybe);
16     }
17
18     VarDescriptor getValue(Expr e) {
19         if (value.containsKey(e))
20             return (VarDescriptor)value.get(e);
21         throw new Error("No Value");
22     }
23     
24     VarDescriptor getMaybe(Expr e) {
25         if (maybevalue.containsKey(e))
26             return (VarDescriptor)maybevalue.get(e);
27         throw new Error("No Value");
28     }
29
30     boolean isInvariant(Expr e) {
31         return maybevalue.containsKey(e);
32     }
33 }