+ addBinding((Binding)v.get(i));
+ }
+ }
+
+ public boolean checkupdates() {
+ if (!checkconflicts()) /* Do we have conflicting concrete updates */
+ return false;
+ if (computeordering()) /* Ordering exists */
+ return true;
+ return false;
+ }
+
+ private boolean computeordering() {
+ /* Build dependency graph between updates */
+ HashSet graph=new HashSet();
+ Hashtable mapping=new Hashtable();
+ for(int i=0;i<updates.size();i++) {
+ Updates u=(Updates)updates.get(i);
+ GraphNode gn=new GraphNode(String.valueOf(i),u);
+ mapping.put(u, gn);
+ graph.add(gn);
+ }
+ for(int i=0;i<updates.size();i++) {
+ Updates u1=(Updates)updates.get(i);
+ if (u1.isAbstract())
+ continue;
+ for(int j=0;j<updates.size();j++) {
+ Updates u2=(Updates)updates.get(j);
+ if (!u2.isExpr())
+ continue;
+ Descriptor d=u1.getDescriptor();
+ if (u2.getRightExpr().usesDescriptor(d)) {
+ /* Add edge for dependency */
+ GraphNode gn1=(GraphNode) mapping.get(u1);
+ GraphNode gn2=(GraphNode) mapping.get(u2);
+ GraphNode.Edge e=new GraphNode.Edge("dependency",gn2);
+ gn1.addEdge(e);
+ }
+ }