boolean propagateTheChange(Node currentNode) {
HashSet<Node> changed = new HashSet<Node>(currentNode.getSuccessors());
- HashMap<Node, HashSet<Node>> parentQueueMap = new HashMap<Node, HashSet<Node>>();
- HashSet<Node> parents = new HashSet<Node>();
- parents.add(currentNode);
+ boolean isChanged = false;
for (Node node : currentNode.getSuccessors()) {
- parentQueueMap.put(node, parents);
+ isChanged = false;
+ isChanged = updateTheOutSet(currentNode, node);
+ if (isChanged)
+ changed.add(node);
}
while(!changed.isEmpty()) {
Node nodeToProcess = changed.iterator().next();
changed.remove(nodeToProcess);
- // Update the changed parents
- parents.clear();
- parents = parentQueueMap.get(nodeToProcess);
- boolean isChanged = false;
-
- for (Node node : parents) {
- // Update the edge
- isChanged |= updateTheOutSet(node, nodeToProcess);
- }
-
- // All the changes in current parents are propagated
- parentQueueMap.get(nodeToProcess).clear();
-
- // Check if the node has changed or not
- if (isChanged) {
- // Check for a conflict in all the transition out of this node
- if (checkAllSuccForConflict(nodeToProcess))
- return true;
-
- // Update the parents list for the successors of the current node
- parents.clear();
- parents.add(nodeToProcess);
-
- // For all the successors of the current node
- 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);
- }
+ // Update all the successors of the node
+ for (Node node : nodeToProcess.getSuccessors()) {
+ isChanged = false;
+ isChanged = updateTheOutSet(nodeToProcess, node);
+ if (isChanged) {
+ changed.add(node);
+ if (checkAllSuccForConflict(node))
+ return true;
+ }
}
}
return false;
out.println("The state is restored to state with id: "+id+", depth: "+depth);
+ if (id == 24 && depth == 5) {
+ System.out.println("*****************************************");
+ System.out.println("*****************************************");
+ System.out.println("*****************************************");
+ }
// Update the parent node
if (nodes.containsKey(id)) {
parentNode = nodes.get(id);
// Update the outset of the current node and check if it is changed or not to propagate the change
boolean isChanged = updateTheOutSet(parentNode, currentNode);
+
+ System.out.println("######################### The outset is:");
+ for (NameValuePair nvp : currentNode.getOutSet()) {
+ System.out.println("writer: "+nvp.getAppNum());
+ System.out.println("value: "+nvp.getValue());
+ System.out.println("var : "+nvp.getVarName());
+ }
// Check if the outSet of this state has changed, update all of its successors' sets if any
if (isChanged)
conflictFound = conflictFound || checkAllSuccForConflict(currentNode) || propagateTheChange(currentNode);
out.println("The state is backtracked to state with id: "+id+", depth: "+depth);
+ if (id == 24 && depth == 5) {
+ System.out.println("*****************************************");
+ System.out.println("*****************************************");
+ System.out.println("*****************************************");
+ }
+
// Update the parent node
if (nodes.containsKey(id)) {
parentNode = nodes.get(id);
if (getWriter(ti.getStack(), manualSet) != null)
manual = true;
-
+
+ System.out.println("############################## writer: "+writer);
+ System.out.println("############################## value: "+value);
+ System.out.println("############################## var: "+var);
// Update the temporary Set set.
writeWriterAndValue(writer, value, var);
}