private void generateEdge(Rule r1,Rule r2) {
Descriptor d=(Descriptor) r1.getInclusion().getTargetDescriptors().iterator().next();
int dep=checkBody(d,r2.getDNFGuardExpr());
- if (dep==NODEPENDENCY)
- dep=checkQuantifiers(d,r2);
+ if (dep==NODEPENDENCY) {
+ SetDescriptor bsd=null;
+ if (d instanceof SetDescriptor) {
+ SetInclusion si=(SetInclusion)r1.getInclusion();
+ if (si.getExpr() instanceof VarExpr) {
+ VarDescriptor vd=((VarExpr)si.getExpr()).getVar();
+ bsd=vd.getSet();
+ }
+ }
+ dep=checkQuantifiers(bsd,d,r2);
+ }
if (dep==NODEPENDENCY)
return;
GraphNode gn1=(GraphNode) ruletonode.get(r1);
boolean dependency=false;
for(int i=0;i<drule.size();i++) {
RuleConjunction rconj=drule.get(i);
- for(int j=0;j<rconj.size();j++){
+ for(int j=0;j<rconj.size();j++) {
DNFExpr dexpr=rconj.get(j);
Expr e=dexpr.getExpr();
- if (e.usesDescriptor(d)) {
+ Set descset=e.getRequiredDescriptors();
+ descset=SetDescriptor.expand(descset);
+ if (descset.contains(d)) {
boolean negated=dexpr.getNegation();
if (negated)
return NEGDEPENDENCY;
return NODEPENDENCY;
}
- private int checkQuantifiers(Descriptor d, Quantifiers qs) {
+ private int checkQuantifiers(SetDescriptor bsd, Descriptor d, Quantifiers qs) {
for (int i=0;i<qs.numQuantifiers();i++) {
Quantifier q=qs.getQuantifier(i);
- if (q.getRequiredDescriptors().contains(d))
+ if (q instanceof SetQuantifier&&
+ d instanceof SetDescriptor) {
+ SetQuantifier sq=(SetQuantifier)q;
+ SetDescriptor sd=(SetDescriptor)d;
+ if (sq.getSet().isSubset(sd)&&
+ ((bsd==null)||!bsd.isSubset(sq.getSet())))
+ return NORMDEPENDENCY;
+ } else if (q.getRequiredDescriptors().contains(d))
return NORMDEPENDENCY;
}
return NODEPENDENCY;