Change to the spec...missed a consistency property. Adding timing option.
[repair.git] / Repair / RepairCompiler / MCC / IR / TermNode.java
1 package MCC.IR;
2
3 class TermNode {
4     public final static int CONJUNCTION=1;
5     public final static int ABSTRACT=2;
6     public final static int UPDATE=3;
7     public final static int RULESCOPE=4;
8     public final static int CONSEQUENCE=5;
9
10     ConsequenceNode conseqnode;
11     Constraint constr;
12     Conjunction conj;
13     int type;
14     AbstractRepair repair;
15     ScopeNode scope;
16     MultUpdateNode update;
17     boolean quantifiernode=false;
18
19     public void setquantifiernode() {
20         quantifiernode=true;
21     }
22     
23     public boolean getquantifiernode() {
24         return quantifiernode;
25     }
26
27
28     public int getType() {
29         return type;
30     }
31
32     public TermNode(Constraint constr, Conjunction conj) {
33         this.constr=constr;
34         this.conj=conj;
35         type=CONJUNCTION;
36     }
37
38     public TermNode(AbstractRepair ar) {
39         repair=ar;
40         type=ABSTRACT;
41     }
42
43     public TermNode(ConsequenceNode cn) {
44         conseqnode=cn;
45         type=CONSEQUENCE;
46     }
47
48     public TermNode(ScopeNode sn) {
49         scope=sn;
50         type=RULESCOPE;
51     }
52
53     public TermNode(MultUpdateNode un) {
54         update=un;
55         type=UPDATE;
56     }
57
58     public ConsequenceNode getConsequence() {
59         if (type!=CONSEQUENCE)
60             throw new Error("Not Consequence Node!");
61         else
62             return conseqnode;
63     }
64
65     public Conjunction getConjunction() {
66         if (type!=CONJUNCTION)
67             throw new Error("Not Conjunction Node!");
68         else
69             return conj;
70     }
71
72     public Constraint getConstraint() {
73         if (type!=CONJUNCTION)
74             throw new Error("Not Conjunction Node!");
75         else
76             return constr;
77     }
78
79     public MultUpdateNode getUpdate() {
80         if (type!=UPDATE)
81             throw new Error("Not Update Node!");
82         else
83             return update;
84     }
85
86     public ScopeNode getScope() {
87         if (type!=RULESCOPE)
88             throw new Error("Not Scope Node!");
89         else
90             return scope;
91     }
92
93     public AbstractRepair getAbstract() {
94         if (type!=ABSTRACT)
95             throw new Error("Not Abstract Repair Node!");
96         else
97             return repair;
98     }
99 }
100