Committing changes to leftsize->rightSize, more comments, and handling
[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 rightSize() {
30         return OpExpr.getInt(((OpExpr)expr).right);
31     }
32
33     public boolean isRightInt() {
34         return OpExpr.isInt(((OpExpr)expr).right);
35     }
36
37     public ExprPredicate(Expr expr) {
38         if (expr == null) {
39             throw new NullPointerException();
40         }
41         this.expr = expr;
42     }
43
44     public Set getInversedRelations() {
45         return expr.getInversedRelations();
46     }
47
48     public int[] getRepairs(boolean negated) {
49         return expr.getRepairs(negated);
50     }
51
52     public Descriptor getDescriptor() {
53         return expr.getDescriptor();
54     }
55
56     public boolean inverted() {
57         return expr.inverted();
58     }
59
60     public boolean usesDescriptor(RelationDescriptor rd) {
61         return expr.usesDescriptor(rd);
62     }
63
64     public Set getRequiredDescriptors() {
65         return expr.getRequiredDescriptors();
66     }
67
68     public void generate(CodeWriter writer, VarDescriptor dest) {
69         expr.generate(writer, dest);
70     }
71 }
72