Sets the parent of this Node, and all children Nodes.
Sets the parent of this Node, and all children Nodes.
Returns the children of this node, i.e. the consequent
and the optional alternative
.
this is to support the DOT & Archy visualizers
see Composite<S,E>.addEventCounterToChildren
Getter for the previous event seen.
Getter for the result of the last handled Event.
Returns storage unique to this Node, keyed on the Node's path.
Handles the Event, and invokes onEvent(state, event)
The state when the event occured.
The event to handle.
Initializes the parent of our list of children. Only required to be called if you know your children at construction time. If your children are dynamic, then you are responsible for setting their parent properly when they are created. Note: this repeats code from set parent() because at construction time, this.children will not return anything (this isn't this yet), which is why we have to pass children in as a parameter
list of children to init (can't call getChildren() yet because this is called from the constructor)
If conditional
resolves to true
, then the consequent
node handles the event.
Otherwise, the alternative
node handles the event.
If no alternative
is provided, this node resolves to FAILURE
The state when the event occured.
The event to handle.
Return true if this Node should proceed handling the event. false otherwise.
Resets the storage unique to this Node, via the Node's path. If this node is a parent, then also reset all children.
If-Else Conditional Composite Node.
If
conditional(state: S, event: E)
returns true, control is passed to the consequent node.If
conditional(state: S, event: E)
returns false, control is passed to the alternative node, or if alternative is a result code, that is returned, or if one is not provided, 'FAILURE' is returned.5/29/16
Joshua Chaitin-Pollak