HashMap<IndexObject, Update> lastupdate = new HashMap<IndexObject, Update>();
boolean changed = false;
+ //Go through each update on the current transition
for(int i=0; i<edgeUpdates.size(); i++) {
Update u = edgeUpdates.get(i);
IndexObject io = u.getIndex();
HashSet<Update> confupdates = null;
+
+ //See if we have already updated this device attribute
if (lastupdate.containsKey(io)) {
confupdates = new HashSet<Update>();
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)) {
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))
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())) &&
}
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;
}
}
+ //Each Edge corresponds to a transition
static class Edge {
Node source, destination;
Transition transition;
return value;
}
+ //Gets an index object for indexing updates by just device and attribute
IndexObject getIndex() {
return new IndexObject(this);
}
}
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);
}
if (getWriter(ti.getStack(), manualSet) != null)
manual = true;
- // Update the temporary Set set.
+ // Update the current updates
writeWriterAndValue(writer, var, value);
}
}