Simplify logic
[repair.git] / Repair / RepairCompiler / MCC / IR / ConcreteInterferes.java
index f9e0c3a9d31a780131ab331828bcc11e143b5f91..e82284198cd9d0b94e7d473a1646a5c518547d9a 100755 (executable)
@@ -314,40 +314,24 @@ public class ConcreteInterferes {
            return true;
        if (ar==null)
            return true;
-       if (ar.getType()!=AbstractRepair.ADDTOSET)
-           return true;
-       //      if (mun.op!=MultUpdateNode.ADD)  (Redundant)
-       //    return true;
-       if (!r.getInclusion().getTargetDescriptors().contains(ar.getDescriptor()))
-           return true;
-       boolean negated=ar.getPredicate().isNegated();
-       Predicate p=ar.getPredicate().getPredicate();
-       if (!(p instanceof ExprPredicate))
-           return true;
-       ExprPredicate ep=(ExprPredicate)p;
-       if (ep.getType()!=ExprPredicate.SIZE)
-           return true;
-       if ((ep.getOp()==Opcode.EQ)&&(ep.rightSize()==1)&&!negated)
-           return false;
-       if ((ep.getOp()==Opcode.NE)&&(ep.rightSize()==1)&&negated)
-           return false;
-
-       if ((ep.getOp()==Opcode.NE)&&(ep.rightSize()==0)&&!negated)
-           return false;
-       if ((ep.getOp()==Opcode.EQ)&&(ep.rightSize()==0)&&negated)
-           return false;
-
-
-
-       if ((ep.getOp()==Opcode.GT)&&(ep.rightSize()==0)&&!negated)
-           return false;
-       if ((ep.getOp()==Opcode.LE)&&(ep.rightSize()==0)&&negated)
-           return false;
-
-       if ((ep.getOp()==Opcode.GE)&&(ep.rightSize()==1)&&!negated)
-           return false;
-       if ((ep.getOp()==Opcode.LT)&&(ep.rightSize()==1)&&negated)
-           return false;
+       if (ar.getType()==AbstractRepair.ADDTOSET) {
+           if (!r.getInclusion().getTargetDescriptors().contains(ar.getDescriptor()))
+               return true;
+           boolean negated=ar.getPredicate().isNegated();
+           Predicate p=ar.getPredicate().getPredicate();
+           if (!(p instanceof ExprPredicate))
+               return true;
+           ExprPredicate ep=(ExprPredicate)p;
+           if (ep.getType()!=ExprPredicate.SIZE)
+               return true;
+           Opcode op=Opcode.translateOpcode(negated,ep.getOp());
+           
+           if (((op==Opcode.EQ)&&(ep.rightSize()==1))|| //(=1)
+               ((op==Opcode.NE)&&(ep.rightSize()==0))|| //(!=0)
+               ((op==Opcode.GT)&&(ep.rightSize()==0))|| //(>0)
+               ((op==Opcode.GE)&&(ep.rightSize()==1))) //(>=1)
+               return false;
+       }
        
        return true;