Checking in code to perform safety checks on repair dependency graph.
[repair.git] / Repair / RepairCompiler / MCC / IR / ExprPredicate.java
1 package MCC.IR;
2
3 import java.util.*;
4
5 public class ExprPredicate extends Predicate {
6     
7     Expr expr;
8
9
10     public static final int SIZE=1;
11     public static final int COMPARISON=2;
12
13     public String name() {
14         return expr.name();
15     }
16
17     public int getType() {
18         if (((OpExpr)expr).left instanceof SizeofExpr)
19             return SIZE;
20         else if (((OpExpr)expr).left instanceof RelationExpr)
21             return COMPARISON;
22         else throw new Error("Unidentifiable Type");
23     }
24
25     public Opcode getOp() {
26         return ((OpExpr)expr).opcode;
27     }
28
29     public int leftsize() {
30         return ((IntegerLiteralExpr)((OpExpr)expr).right).getValue();
31     }
32
33     public ExprPredicate(Expr expr) {
34         if (expr == null) {
35             throw new NullPointerException();
36         }
37         this.expr = expr;
38     }
39
40     public Set getInversedRelations() {
41         return expr.getInversedRelations();
42     }
43
44     public int[] getRepairs(boolean negated) {
45         return expr.getRepairs(negated);
46     }
47
48     public Descriptor getDescriptor() {
49         return expr.getDescriptor();
50     }
51
52     public boolean inverted() {
53         return expr.inverted();
54     }
55
56     public boolean usesDescriptor(RelationDescriptor rd) {
57         return expr.usesDescriptor(rd);
58     }
59
60     public Set getRequiredDescriptors() {
61         return expr.getRequiredDescriptors();
62     }
63
64     public void generate(CodeWriter writer, VarDescriptor dest) {
65         expr.generate(writer, dest);
66     }
67 }
68