+ RelationDescriptor rd=(RelationDescriptor)ar.getDescriptor();
+ ExprPredicate exprPredicate=(ExprPredicate)ar.getPredicate().getPredicate();
+ boolean inverted=exprPredicate.inverted();
+ int leftindex=0;
+ int rightindex=1;
+ if (inverted)
+ leftindex=2;
+ else
+ rightindex=2;
+
+
+ Vector possiblerules=new Vector();
+ for(int i=0;i<state.vRules.size();i++) {
+ Rule r=(Rule) state.vRules.get(i);
+ if ((r.getInclusion() instanceof RelationInclusion)&&
+ (rd==((RelationInclusion)r.getInclusion()).getRelation()))
+ possiblerules.add(r);
+ }
+ if (possiblerules.size()==0)
+ return;
+ int[] count=new int[possiblerules.size()];
+ while(remains(count,possiblerules,false)) {
+ MultUpdateNode mun=new MultUpdateNode(ar,MultUpdateNode.MODIFY);
+ TermNode tn=new TermNode(mun);
+ GraphNode gn2=new GraphNode("UpdateMod"+removefromcount,tn);
+
+ boolean goodflag=true;
+ for(int i=0;i<possiblerules.size();i++) {
+ Rule r=(Rule)possiblerules.get(i);
+ UpdateNode un=new UpdateNode(r);
+ /* No Need to construct bindings on modify */
+
+ int c=count[i];
+ if (!processconjunction(un,r.getDNFGuardExpr().get(c))) {
+ goodflag=false;break;
+ }
+ RelationInclusion ri=(RelationInclusion)r.getInclusion();
+ if (!(ri.getLeftExpr() instanceof VarExpr)) {
+ Updates up=new Updates(ri.getLeftExpr(),leftindex);
+ un.addUpdate(up);
+ } else {
+ VarDescriptor vd=((VarExpr)ri.getLeftExpr()).getVar();
+ if (vd.isGlobal()) {
+ Updates up=new Updates(ri.getLeftExpr(),leftindex);
+ un.addUpdate(up);
+ } else if (inverted)
+ goodflag=false;
+ }
+ if (!(ri.getRightExpr() instanceof VarExpr)) {
+ Updates up=new Updates(ri.getRightExpr(),rightindex);
+ un.addUpdate(up);
+ } else {
+ VarDescriptor vd=((VarExpr)ri.getRightExpr()).getVar();
+ if (vd.isGlobal()) {
+ Updates up=new Updates(ri.getRightExpr(),rightindex);
+ un.addUpdate(up);
+ } else if (!inverted)
+ goodflag=false;
+ }
+
+ if (!un.checkupdates()) {
+ goodflag=false;
+ break;
+ }
+ mun.addUpdate(un);
+ }
+ if (goodflag) {
+ GraphNode.Edge e=new GraphNode.Edge("abstract"+modifycount,gn2);
+ modifycount++;
+ gn.addEdge(e);
+ updatenodes.add(gn2);
+ }
+ increment(count,possiblerules,false);
+ }