Checking in code to perform safety checks on repair dependency graph.
[repair.git] / Repair / RepairCompiler / MCC / IR / TermNode.java
index 46b9f74..337c569 100755 (executable)
@@ -5,14 +5,19 @@ class TermNode {
     public final static int ABSTRACT=2;
     public final static int UPDATE=3;
     public final static int RULESCOPE=4;
-    
+    public final static int CONSEQUENCE=5;
 
+    ConsequenceNode conseqnode;
     Constraint constr;
     Conjunction conj;
     int type;
     AbstractRepair repair;
     ScopeNode scope;
+    MultUpdateNode update;
 
+    public int getType() {
+       return type;
+    }
 
     public TermNode(Constraint constr, Conjunction conj) {
        this.constr=constr;
@@ -25,11 +30,28 @@ class TermNode {
        type=ABSTRACT;
     }
 
+    public TermNode(ConsequenceNode cn) {
+       conseqnode=cn;
+       type=CONSEQUENCE;
+    }
+
     public TermNode(ScopeNode sn) {
        scope=sn;
        type=RULESCOPE;
     }
 
+    public TermNode(MultUpdateNode un) {
+       update=un;
+       type=UPDATE;
+    }
+
+    public ConsequenceNode getConsequence() {
+       if (type!=CONSEQUENCE)
+           throw new Error("Not Consequence Node!");
+       else
+           return conseqnode;
+    }
+
     public Conjunction getConjunction() {
        if (type!=CONJUNCTION)
            throw new Error("Not Conjunction Node!");
@@ -37,6 +59,27 @@ class TermNode {
            return conj;
     }
 
+    public Constraint getConstraint() {
+       if (type!=CONJUNCTION)
+           throw new Error("Not Conjunction Node!");
+       else
+           return constr;
+    }
+
+    public MultUpdateNode getUpdate() {
+       if (type!=UPDATE)
+           throw new Error("Not Update Node!");
+       else
+           return update;
+    }
+
+    public ScopeNode getScope() {
+       if (type!=RULESCOPE)
+           throw new Error("Not Scope Node!");
+       else
+           return scope;
+    }
+
     public AbstractRepair getAbstract() {
        if (type!=ABSTRACT)
            throw new Error("Not Abstract Repair Node!");