- // Get the first element of HashSet and remove it from the changed set
- Node nodeToProcess = changed.iterator().next();
- changed.remove(nodeToProcess);
-
- // Update the sets, store the outSet to temp before its changes
- boolean isChanged = updateSets(nodeToProcess);
-
- // Check for a conflict
- if (checkForConflict(nodeToProcess))
- return true;
-
- // Checking if the out set has changed or not(Add its successors to the change list!)
- if (isChanged) {
- for (Node i : nodeToProcess.getSuccessors()) {
- if (!changed.contains(i))
- changed.add(i);
- }
+ // Get the first element of the changed set and remove it
+ Node nodeToProcess = changed.iterator().next();
+ changed.remove(nodeToProcess);
+
+ // Update the changed parents
+ parents = parentQueueMap.get(nodeToProcess);
+ boolean isChanged = false;
+
+ for (Node node : parents) {
+ // Update the edge
+ isChanged |= updateTheOutSet(node, nodeToProcess);
+ }
+
+ // Check for a conflict if the outSet of nodeToProcess is changed
+ if (isChanged) {
+ for (Node node : nodeToProcess.getSuccessors()) {
+ HashMap<Transition, ArrayList<NameValuePair>> setSets = nodeToProcess.getOutgoingEdges().get(node).getSetSetMap();
+ for (Map.Entry mapElement : setSets.entrySet()) {
+ Transition transition = (Transition)mapElement.getKey();
+ if (checkForConflict(nodeToProcess, node, transition))
+ return true;
+ }
+ }
+ }
+
+ // Update the parents list for the successors of the current node
+ parents = new HashSet<Node>();
+ parents.add(nodeToProcess);
+
+ // Checking if the out set has changed or not(Add its successors to the change list!)
+ if (isChanged) {
+ for (Node i : nodeToProcess.getSuccessors()) {
+ if (!changed.contains(i))
+ changed.add(i);
+
+ // Update the list of updated parents for the current node
+ if (parentQueueMap.containsKey(i))
+ parentQueueMap.get(i).add(nodeToProcess);
+ else
+ parentQueueMap.put(i, parents);
+ }
+ }