Change in conflict tracker!
authoramiraj <amiraj.95@uci.edu>
Wed, 4 Dec 2019 02:11:52 +0000 (18:11 -0800)
committeramiraj <amiraj.95@uci.edu>
Wed, 4 Dec 2019 02:11:52 +0000 (18:11 -0800)
src/main/gov/nasa/jpf/listener/ConflictTracker.java

index 06e6e4a..b28d65b 100644 (file)
@@ -209,35 +209,46 @@ public class ConflictTracker extends ListenerAdapter {
   }
 
   boolean updateTheOutSet(Node parentNode, Node currentNode) {
   }
 
   boolean updateTheOutSet(Node parentNode, Node currentNode) {
-       HashMap<Transition, ArrayList<NameValuePair>> setSet = parentNode.getOutgoingEdges().get(currentNode).getSetSetMap();
+       HashMap<Transition, ArrayList<NameValuePair>> setSets = parentNode.getOutgoingEdges().get(currentNode).getSetSetMap();
        HashSet<String> updatedVarNames = new HashSet<String>();
        Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
        HashMap<String, Integer> lastWriter = currentEdge.getLastWriter();
        HashMap<String, String> lastValue = currentEdge.getLastValue();
        HashSet<String> updatedVarNames = new HashSet<String>();
        Edge currentEdge = parentNode.getOutgoingEdges().get(currentNode);
        HashMap<String, Integer> lastWriter = currentEdge.getLastWriter();
        HashMap<String, String> lastValue = currentEdge.getLastValue();
+       HashMap<String, Integer> outSetVarMap = new HashMap<String, Integer>();
        boolean isChanged = false;
 
        boolean isChanged = false;
 
-        for (Map.Entry mapElement : setSet.entrySet()) {
-            ArrayList<NameValuePair> value = (ArrayList<NameValuePair>)mapElement.getValue();
+        for (Map.Entry mapElement : setSets.entrySet()) {
+            ArrayList<NameValuePair> setSet = (ArrayList<NameValuePair>)mapElement.getValue();
   
   
-            for (int i = 0;i < value.size();i++) {
-                       updatedVarNames.add(value.get(i).getVarName());
+            for (int i = 0;i < setSet.size();i++) {
+                       updatedVarNames.add(setSet.get(i).getVarName());
            }
         }
 
 
        for (NameValuePair i : parentNode.getOutSet()) {
            }
         }
 
 
        for (NameValuePair i : parentNode.getOutSet()) {
+               outSetVarMap.put(i.getVarName(), i.getAppNum());
                if (!updatedVarNames.contains(i.getVarName()))
                        isChanged |= currentNode.getOutSet().add(i);
        }
 
 
                if (!updatedVarNames.contains(i.getVarName()))
                        isChanged |= currentNode.getOutSet().add(i);
        }
 
 
-       for (Map.Entry mapElement : setSet.entrySet()) {
-            ArrayList<NameValuePair> value = (ArrayList<NameValuePair>)mapElement.getValue();
+       for (Map.Entry mapElement : setSets.entrySet()) {
+            ArrayList<NameValuePair> setSet = (ArrayList<NameValuePair>)mapElement.getValue();
   
   
-            for (int i = 0;i < value.size();i++) {
-                       if (value.get(i).getAppNum().equals(lastWriter.get(value.get(i).getVarName())) 
-                           && value.get(i).getValue().equals(lastValue.get(value.get(i).getVarName()))) {
-                               isChanged |= currentNode.getOutSet().add(value.get(i));
+            for (int i = 0;i < setSet.size();i++) {
+                       String varName = setSet.get(i).getVarName();
+                       Integer writer = lastWriter.get(varName);
+                       String value = lastValue.get(varName);
+
+                       if (setSet.get(i).getAppNum().equals(writer) 
+                           && setSet.get(i).getValue().equals(value)) {
+                               if (outSetVarMap.containsKey(varName)) {
+                                       Integer hashCode = outSetVarMap.get(varName).hashCode() * 31 +
+                                                          varName.hashCode();
+                                       currentNode.getOutSet().remove(hashCode);
+                               }
+                               isChanged |= currentNode.getOutSet().add(setSet.get(i));
                        }
            }
         }
                        }
            }
         }