automata v0.1.0 Automaton.Types.BT.Behavior behaviour

An Automaton.Types.BT.Behavior is an abstract interface for composites and components that can be activated, run, and deactivated. Actions(Execution Nodes) provide specific implementations of this interface. Branches in the tree can be thought of as high level behaviors, heirarchically combining smaller behaviors to provide more complex and interesting behaviors.

Note: there is a bunch of placeholder stuff in here right now and needs thought and cleanup. The specs for the callbacks are not accurate, just needed something that compiled and ran. Needs more thought and attention as the design process continues.

Link to this section Summary

Types

All nodes start with a statuses of :bh_fresh. A BT node can be in one of five statuses

Link to this section Types

Specs

status() :: :bh_aborted | :bh_failure | :bh_fresh | :bh_running | :bh_success

All nodes start with a statuses of :bh_fresh. A BT node can be in one of five statuses:

  1. :bh_fresh (when never run, or when reset)
  2. :bh_running (when running an async user action)
  3. :bh_failure
  4. :bh_success
  5. :bh_aborted (when aborted due to exits & exceptions)

Link to this section Callbacks

Specs

abort() :: atom()

Specs

aborted?() :: bool() | nil

Specs

on_init(term()) :: term() | {:error, String.t()}
Link to this callback

on_terminate(term)

Specs

on_terminate(term()) :: status()

Specs

reset() :: atom()

Specs

running?() :: bool() | nil

Specs

status() :: status()

Specs

terminated?() :: bool() | nil

Specs

update(any()) :: {:ok, Module.t()}