X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=src%2Fmain%2Fgov%2Fnasa%2Fjpf%2Flistener%2FConflictTracker.java;h=a61da9ce631738438ba055b3c7becee9936fe7b7;hp=56d4d67869dddb7957fdfcda3d885b1353e27453;hb=7228c60bf0fa159076601644688e9fbd752e3fe7;hpb=2e13195f3855e28e7cc7afd34858e15724ad6b3f diff --git a/src/main/gov/nasa/jpf/listener/ConflictTracker.java b/src/main/gov/nasa/jpf/listener/ConflictTracker.java index 56d4d67..a61da9c 100644 --- a/src/main/gov/nasa/jpf/listener/ConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/ConflictTracker.java @@ -114,17 +114,21 @@ public class ConflictTracker extends ListenerAdapter { HashMap lastupdate = new HashMap(); boolean changed = false; + //Go through each update on the current transition for(int i=0; i confupdates = null; + + //See if we have already updated this device attribute if (lastupdate.containsKey(io)) { confupdates = new HashSet(); confupdates.add(lastupdate.get(io)); } else if (srcUpdates.containsKey(io)){ confupdates = srcUpdates.get(io); } - //Check for conflict + + //Check for conflict with the appropriate update set if we are not a manual transition if (confupdates != null && !e.isManual()) { for(Update u2: confupdates) { if (conflicts(u, u2)) { @@ -135,6 +139,7 @@ public class ConflictTracker extends ListenerAdapter { lastupdate.put(io, u); } for(IndexObject io: srcUpdates.keySet()) { + //Only propagate src changes if the transition doesn't update the device attribute if (!lastupdate.containsKey(io)) { //Make sure destination has hashset in map if (!dstUpdates.containsKey(io)) @@ -153,6 +158,7 @@ public class ConflictTracker extends ListenerAdapter { return changed; } + //Method to check for conflicts between two updates //Have conflict if same device, same attribute, different app, different vaalue boolean conflicts(Update u, Update u2) { return (!u.getApp().equals(u2.getApp())) && @@ -172,6 +178,7 @@ public class ConflictTracker extends ListenerAdapter { } Edge createEdge(Node parent, Node current, Transition transition, boolean ismanual) { + //Check if this transition is explored. If so, just skip everything if (transitions.contains(transition)) return null; @@ -210,6 +217,7 @@ public class ConflictTracker extends ListenerAdapter { } } + //Each Edge corresponds to a transition static class Edge { Node source, destination; Transition transition; @@ -274,6 +282,7 @@ public class ConflictTracker extends ListenerAdapter { return value; } + //Gets an index object for indexing updates by just device and attribute IndexObject getIndex() { return new IndexObject(this); } @@ -530,7 +539,6 @@ public class ConflictTracker extends ListenerAdapter { } private void writeWriterAndValue(String writer, String attribute, String value) { - // Update the temporary Set set. Update u = new Update(writer, "DEVICE", attribute, value); currUpdates.add(u); } @@ -578,7 +586,7 @@ public class ConflictTracker extends ListenerAdapter { if (getWriter(ti.getStack(), manualSet) != null) manual = true; - // Update the temporary Set set. + // Update the current updates writeWriterAndValue(writer, var, value); } }