Committing changes to leftsize->rightSize, more comments, and handling
[repair.git] / Repair / RepairCompiler / MCC / IR / ExprPredicate.java
index 3242de1cc784050ff6ab86b3094bd12bb7febe3f..4bed2313f7468f854b7fc2ffb7db3fab749ed9ef 100755 (executable)
@@ -3,14 +3,41 @@ package MCC.IR;
 import java.util.*;
 
 public class ExprPredicate extends Predicate {
-
+    
     Expr expr;
 
+
+    public static final int SIZE=1;
+    public static final int COMPARISON=2;
+
+    public String name() {
+       return expr.name();
+    }
+
+    public int getType() {
+       if (((OpExpr)expr).left instanceof SizeofExpr)
+           return SIZE;
+       else if (((OpExpr)expr).left instanceof RelationExpr)
+           return COMPARISON;
+       else throw new Error("Unidentifiable Type");
+    }
+
+    public Opcode getOp() {
+       return ((OpExpr)expr).opcode;
+    }
+
+    public int rightSize() {
+       return OpExpr.getInt(((OpExpr)expr).right);
+    }
+
+    public boolean isRightInt() {
+       return OpExpr.isInt(((OpExpr)expr).right);
+    }
+
     public ExprPredicate(Expr expr) {
         if (expr == null) {
             throw new NullPointerException();
         }
-
         this.expr = expr;
     }
 
@@ -18,6 +45,22 @@ public class ExprPredicate extends Predicate {
         return expr.getInversedRelations();
     }
 
+    public int[] getRepairs(boolean negated) {
+       return expr.getRepairs(negated);
+    }
+
+    public Descriptor getDescriptor() {
+       return expr.getDescriptor();
+    }
+
+    public boolean inverted() {
+       return expr.inverted();
+    }
+
+    public boolean usesDescriptor(RelationDescriptor rd) {
+       return expr.usesDescriptor(rd);
+    }
+
     public Set getRequiredDescriptors() {
         return expr.getRequiredDescriptors();
     }
@@ -25,9 +68,5 @@ public class ExprPredicate extends Predicate {
     public void generate(CodeWriter writer, VarDescriptor dest) {
         expr.generate(writer, dest);
     }
-
-    public int[] getRepairs(boolean negated) {
-       return new int[] {};
-    }
 }