updates
[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 int getType() {
14         if (((OpExpr)expr).left instanceof SizeofExpr)
15             return SIZE;
16         else if (((OpExpr)expr).left instanceof RelationExpr)
17             return COMPARISON;
18         else throw new Error("Unidentifiable Type");
19     }
20
21     public Opcode getOp() {
22         return ((OpExpr)expr).opcode;
23     }
24
25     public int leftsize() {
26         return ((IntegerLiteralExpr)((OpExpr)expr).right).getValue();
27     }
28
29     public ExprPredicate(Expr expr) {
30         if (expr == null) {
31             throw new NullPointerException();
32         }
33         this.expr = expr;
34     }
35
36     public Set getInversedRelations() {
37         return expr.getInversedRelations();
38     }
39
40     public int[] getRepairs(boolean negated) {
41         return expr.getRepairs(negated);
42     }
43
44     public Descriptor getDescriptor() {
45         return expr.getDescriptor();
46     }
47
48     public boolean inverted() {
49         return expr.inverted();
50     }
51
52     public boolean usesDescriptor(RelationDescriptor rd) {
53         return expr.usesDescriptor(rd);
54     }
55
56     public Set getRequiredDescriptors() {
57         return expr.getRequiredDescriptors();
58     }
59
60     public void generate(CodeWriter writer, VarDescriptor dest) {
61         expr.generate(writer, dest);
62     }
63 }
64