oagnodes library

Classes

Closure
A Closure takes a Function argument that returns a Status. The function is executed by a call to the update() method of the Closure.
Composite
Abstract base class for a node composed of multiple nodes. The update() method uses the composite Node instances.
DataNode<T>
Abstract base class for all DataNode types. It stores data of type argument T. Concrete instances can be shared across multiple DataNode instances by reference in order to compose operations that read/write from the same data.
DataSubject<T>
A DataSubject is a Subject whose notifier is a DataNode. It provides access to the DataNode data through a getter. A DataSubject observer can therefore receive data through a notification.
Decorator
Abstract base class that decorates the behavior of a Node instance.
DurationMonitor
Monitors whether the decorated node has returned the specified parameter Status since the DurationMonitor instance was updated.
Evaluator
An Evaluator instance updates its children nodes as an unordered sequence. Composite child nodes will be updated until they return Status.success, then they are ignored in any future calls update() method of the Evaluator until all other children nodes have returned Status.success.
FutureSubject<T>
A FutureSubject takes a Function returning a Future of argument type T. The FutureSubject will call the argument future and use the result to build a DataNode using the argument builder Function. The built DataNode is then used as the notifier of the FutureSubject.
Identity
An Identity exists solely to return the specified argument Status from its update() method. An Identity compares equal to another Identity if they are both constructed with the same Status.
Node
Abstract base class for all Node types. The reset() method is defined as no-op and does not require implementation.
Not
The Not decorator returns the opposite Status of its decorated Node instance.
Observer<T extends Subject>
The Observer class can subscribe to one or more Subject instances. It uses its argument handler Function in its receive(subject) method in order to handle any notifications.
Print
The Print node forwards its String argument to a call to the Dart print() function when the Print instance calls its update() method.
Selector
A Selector evaluates its composite nodes sequentially expecting one of them to return Status.success, in which case the Selector returns Status.success.
Sequence
A Sequence evaluates its composite nodes sequentially expecting all of them to return Status.success, in which case the Selector returns Status.success.
StateMachine<TEnum>
A StateMachine handles the update of a state and transitions between a state and other defined states.
Status
Status code returned by the update() method of all Node types.
Subject
The Subject class has notifier Node and a notifications List. The notifier is updated and if its Status is part of notifications, the Subject notifies any subscribed Observer.

Enums

EvaluationOrder
Determines the execution order of the transition condition.

Functions

makeClosure(void action(), {Status returning = Status.success}) Closure
Creates a Closure instance for the specified Function argument returning a predetermined Status value. The default predetermined Status is Status.success.

Typedefs

ObserverHandler<T> = void Function(T)

Exceptions / Errors

StatusError
Error thrown when a Status contains an invalid value.