Clean node conditional branching
Be notified when a parent does not notify of change
Last updated
Be notified when a parent does not notify of change
Last updated
The goal is to only let the execution path propagate if a node does not mark itself as being dirty. This is the inverse of dirty node monitoring.
Sometimes we want to know if a node did not issue a dirty notification after processing an update. Taking the example of the breach indicator we may want to trigger an execution path branch when the limit is not breached.
An OnEvent method with a boolean return type is monitored as a dirty status flag by Fluxtion with the following rules:
A true value marks the node as dirty Fluxtion swallows the event wave and no child OnEvent methods are invoked.
A false value marks the node as clean and the event wave propagates to child nodes.
The child node indicates it wants to be notified on clean status by adding the dirty = true attribute to its OnEvent annotation:
We create an event handler that issues a change notification flag. We connect three listener to this each with different behaviours depending upon the dirty flag status of the parent. The listeners are:
The nodes CleanListener and DirtyCleanListener use the dirty flag = false on the OnEvent annotation to indicate they are interested in receiving clean notifications.
the code for the example is located here.
The dispatch method inverts the return type from the parent node when the child is listening for "clean" parents. As we expect there are four callback methods in the dispatch.
The graphical representation of this execution graph as generated by Fluxtion ESC:
Node
Behaviour
DirtyListener
changeUpdate() invoked when the parent indicates a change
CleanListener
noChangeUpdate() invoked when parent indicates no change
DirtyCleanListener
Combines clean and dirty listeners into one class:
changeUpdate() invoked when the parent indicates a change
noChangeUpdate() invoked when parent indicates no change