return false;
}
+ public boolean checkrelationconstraint(AbstractRepair ar, Constraint c) {
+ if (c.numQuantifiers()==1&&
+ (c.getQuantifier(0) instanceof RelationQuantifier)) {
+ RelationQuantifier rq=(RelationQuantifier)c.getQuantifier(0);
+ if (rq.getRelation()==ar.getDescriptor()) {
+ Hashtable ht=new Hashtable();
+ if (ar.getDomainSet()!=null)
+ ht.put(rq.x,ar.getDomainSet());
+ if (ar.getRangeSet()!=null)
+ ht.put(rq.y,ar.getRangeSet());
+ DNFConstraint dconst=c.dnfconstraint;
+ conjloop:
+ for(int i=0;i<dconst.size();i++) {
+ Conjunction conj=dconst.get(i);
+ predloop:
+ for(int j=0;j<conj.size();j++) {
+ DNFPredicate dpred=conj.get(j);
+ Predicate p=dpred.getPredicate();
+ if ((p instanceof InclusionPredicate)&&(!dpred.isNegated())) {
+ InclusionPredicate ip=(InclusionPredicate)p;
+ if (ip.expr instanceof VarExpr&&
+ ip.setexpr.getDescriptor() instanceof SetDescriptor) {
+ VarDescriptor vd=((VarExpr)ip.expr).getVar();
+ if (ht.containsKey(vd)) {
+ SetDescriptor td=(SetDescriptor)ip.setexpr.getDescriptor();
+ SetDescriptor s=(SetDescriptor)ht.get(vd);
+ if (td.isSubset(s))
+ continue predloop;
+ }
+ }
+ }
+ continue conjloop;
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/** Does performing the AbstractRepair ar falsify the predicate dp */
public boolean interfereswithpredicate(AbstractRepair ar, DNFPredicate dp) {
//Abstract updates don't have concrete interference1
if (update.isAbstract())
continue;
-
+
DNFRule drule=satisfy?r.getDNFNegGuardExpr():r.getDNFGuardExpr();
Descriptor updated_des=update.getDescriptor();
assert updated_des!=null;
continue;
-
// See if the update interferes with the inclusion
// condition for the rule
if (r.getInclusion().usesDescriptor(updated_des)) {
} else throw new Error();
}
+ if ((un.getRule()==r)&&
+ ((mun.op==MultUpdateNode.ADD)&&!satisfy)&&
+ modifiesremoves(mun,un,r)) {
+ Inclusion inclusion=r.getInclusion();
+ if (inclusion instanceof RelationInclusion) {
+ RelationInclusion ri=(RelationInclusion)inclusion;
+ if ((!testdisjoint(update,r,ri.getLeftExpr()))&&
+ (!testdisjoint(update,r,ri.getRightExpr())))
+ ok=true; /* Update is specific to
+ given binding of the rule,
+ and adds are only performed
+ if the removal is desired or
+ the tuple doesn't exist.*/
+ }
+ }
+
if (!ok) {
if (satisfy) {
/** Check to see if the update definitely falsifies r, thus
intended one, so we're
okay */
}
+ if ((un.getRule()==r)&&
+ ((mun.op==MultUpdateNode.ADD)&&!satisfy)&&
+ modifiesremoves(mun,un,r)) {
+ if (!testdisjoint(update,r,dexpr.getExpr()))
+ continue; /* Update is specific to
+ given binding of the
+ rule, and adds are only
+ performed if the removal
+ is desired or the tuple
+ doesn't exist.*/
+ }
+
if (interferes(update,dexpr))
return true;
}
}
return false;
}
+
+
+ static private boolean modifiesremoves(MultUpdateNode mun,UpdateNode un, Rule r) {
+ AbstractRepair ar=mun.getRepair();
+ boolean inverted=ar.getPredicate().getPredicate().inverted();
+
+ if (ar.getType()!=AbstractRepair.MODIFYRELATION)
+ return false;
+ RelationInclusion ri=(RelationInclusion)r.getInclusion();
+ Expr e=inverted?ri.getRightExpr():ri.getLeftExpr();
+ while(e instanceof CastExpr) {
+ e=((CastExpr)e).getExpr();
+ }
+ if (!(e instanceof VarExpr))
+ return false;
+ VarExpr ve=(VarExpr)e;
+ if (ve.isValue())
+ return false;
+ return true;
+ }
static private boolean updateonlytonewobject(MultUpdateNode mun, UpdateNode un, Updates updates) {
AbstractRepair ar=mun.getRepair();