Fixed some errors in the Repair Generator code.
[repair.git] / Repair / RepairCompiler / MCC / IR / AbstractRepair.java
index aecc4e995b0022f5819dc46b77656db0ff58f36f..153677fff76fc516d2cd6521596c08f27cd85ecf 100755 (executable)
@@ -1,4 +1,5 @@
 package MCC.IR;
+import MCC.State;
 
 class AbstractRepair {
     public final static int ADDTOSET=1;
@@ -150,6 +151,17 @@ class AbstractRepair {
        return descriptor;
     }
 
+
+    /** Thie method tells whether the repair needs to remove objects *
+     *  from the relation, or whether the model definition rules make
+     *  the remove unnecessary.*/
+
+    public boolean needsRemoves(State state) {
+       assert type==MODIFYRELATION;
+       SetDescriptor sd=getPredicate().getPredicate().inverted()?getRangeSet():getDomainSet();
+       return !ConstraintDependence.rulesensurefunction(state,(RelationDescriptor)getDescriptor(), sd, getPredicate().getPredicate().inverted(), true);
+    }
+
     public AbstractRepair(DNFPredicate dp,int typ, Descriptor d, Sources s) {
        torepair=dp;
        type=typ;