46b9f749e77c586c92410310d59475fec4ff08ca
[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     
9
10     Constraint constr;
11     Conjunction conj;
12     int type;
13     AbstractRepair repair;
14     ScopeNode scope;
15
16
17     public TermNode(Constraint constr, Conjunction conj) {
18         this.constr=constr;
19         this.conj=conj;
20         type=CONJUNCTION;
21     }
22
23     public TermNode(AbstractRepair ar) {
24         repair=ar;
25         type=ABSTRACT;
26     }
27
28     public TermNode(ScopeNode sn) {
29         scope=sn;
30         type=RULESCOPE;
31     }
32
33     public Conjunction getConjunction() {
34         if (type!=CONJUNCTION)
35             throw new Error("Not Conjunction Node!");
36         else
37             return conj;
38     }
39
40     public AbstractRepair getAbstract() {
41         if (type!=ABSTRACT)
42             throw new Error("Not Abstract Repair Node!");
43         else
44             return repair;
45     }
46 }
47