Liking cljdoc? Tell your friends :D

statecharts.impl


-do-initclj/s

(-do-init fsm)
source

-do-transitionclj/s

(-do-transition fsm
                {:keys [_state] :as state}
                event
                input-event
                ignore-unknown-event?)
source

-transition-implclj/s

(-transition-impl fsm state input-event opts)

Return the new state and the actions to execute.

Return the new state and the actions to execute.
sourceraw docstring

-transition-onceclj/s

(-transition-once fsm
                  state
                  event
                  {:keys [exec debug input-event ignore-unknown-event?]
                   :or {exec true}})

Do the transition, but would not follow new eventless transitions defined on the target state.

Do the transition, but would not follow new eventless transitions defined on
the target state.
sourceraw docstring

_state->configurationclj/s

(_state->configuration fsm _state & {:keys [no-resolve?] :as _opt})
source

_state->nodesclj/s

(_state->nodes _state)
source

absolute-target?clj/s

(absolute-target? target)
source

add-ancestors-to-entry-setclj/s

(add-ancestors-to-entry-set fsm domain path external?)
source

add-node-typeclj/s

(add-node-type node)
source

assignclj/s

(assign f)

Wrap a function into a context assignment function.

Wrap a function into a context assignment function.
sourceraw docstring

backtrack-ancestors-as-nodesclj/s

(backtrack-ancestors-as-nodes fsm path)

Like backtrack-ancestors-as-paths but resolves the paths into nodes.

Like backtrack-ancestors-as-paths but resolves the paths into nodes.
sourceraw docstring

backtrack-ancestors-as-pathsclj/s

(backtrack-ancestors-as-paths fsm path)

Return a (maybe lazy) sequence of the node path with all its ancestors, starting from the node and goes up.

Return a (maybe lazy) sequence of the node path with all its ancestors, starting from the
node and goes up.
sourceraw docstring

canon-actionsclj/s

(canon-actions x)
source

canon-eventclj/s

(canon-event x)
source

canon-one-transitionclj/s

(canon-one-transition x)
source

canon-transitionsclj/s

(canon-transitions x)
source

check-or-throwclj/s

(check-or-throw x k v & {:keys [] :as map})
source

compute-entry-setclj/s

(compute-entry-set fsm txs)
source

configuration->_stateclj/s

(configuration->_state fsm configuration)

Represent the current configuration in a user-friendly form. It's the reverse operation of _state->configuration.

Represent the current configuration in a user-friendly form. It's the reverse
operation of `_state->configuration`.
sourceraw docstring

ContextAssignmentclj/s

source

decode-delayed-mapclj/s

(decode-delayed-map m)
source

decode-delayed-transitionsclj/s

(decode-delayed-transitions x)
source

external-self-transition-actionsclj/s

(external-self-transition-actions handler nodes)

Calculate the actions for an external self-transition.

if handler is on [:s1 :s1.1] and current state is [:s1 :s1.1 :s1.1.1] then we shall exit s1.1.1 s1.1 and entry s1.1 s1.1.1 again

if handler is on [:s1] and current state is [:s1 :s1.1 :s1.1.1] then we shall exit s1.1.1 s1.1 s1 and entry s1 s1.1 s1.1.1 again

if handler is on [:s2] and current state is [:s2] then we shall exit s2 and entry s2 again

if handler is on [] and current state is [:s2] then we shall exit s2 Machine and entry Machine s2 again

Calculate the actions for an external self-transition.

if handler is on [:s1 :s1.1]
and current state is [:s1 :s1.1 :s1.1.1]
then we shall exit s1.1.1 s1.1 and entry s1.1 s1.1.1 again

if handler is on [:s1]
and current state is [:s1 :s1.1 :s1.1.1]
then we shall exit s1.1.1 s1.1 s1 and entry s1 s1.1 s1.1.1 again

if handler is on [:s2]
and current state is [:s2]
then we shall exit s2 and entry s2 again

if handler is on []
and current state is [:s2]
then we shall exit s2 Machine and entry Machine s2 again
sourceraw docstring

find-least-common-compound-ancessorclj/s

(find-least-common-compound-ancessor fsm path1 path2)
source

get-actionsclj/s

(get-actions fsm path k)
source

get-entry-actionsclj/s

(get-entry-actions fsm entry-set)
source

get-initial-pathclj/s

(get-initial-path {:keys [path initial] :as _node})
source

get-tx-domainclj/s

(get-tx-domain fsm {:keys [source target] :as tx})
source

has-eventless-transition?clj/s

(has-eventless-transition? nodes)
source

initializeclj/s

(initialize fsm)
(initialize {:keys [initial type] :as fsm}
            {:keys [exec debug context] :or {exec true context nil} :as _opts})
source

insert-eventless-transitionsclj/s

(insert-eventless-transitions node)
source

is-prefix?clj/s

(is-prefix? short long)
source

machineclj/s

(machine orig)

Create a canonical presentation of the machine using malli.

Create a canonical presentation of the machine using malli.
sourceraw docstring

matchesclj/s

(matches state value)
source

path->_stateclj/s

(path->_state xs)

Calculate the _state value based on the node paths.

In our internal code, we need to represent the current state as a series of nodes, but when presenting the current state to the user we need to extract the simplest form.

Calculate the _state value based on the node paths.

In our internal code, we need to represent the current state as a series of
nodes, but when presenting the current state to the user we need to extract the
simplest form.
sourceraw docstring

PathElementclj/s

Schema of an element of a expanded path. We need the transitions/exit/entry information to:

  1. transitions: in a compound node, decide which level handles the event
  2. :id of each level to resolve the target state node.
  3. entry/exit: collect the actions during a transtion transition.
Schema of an element of a expanded path. We need the
transitions/exit/entry information to:
1. transitions: in a compound node, decide which level handles
   the event
2. :id of each level to resolve the target state node.
3. entry/exit: collect the actions during a transtion transition.
sourceraw docstring

resolve-nodeclj/s

(resolve-node root path)
(resolve-node root path full?)
source

resolve-targetclj/s

(resolve-target base target)

Resolve the given transition target given the current state context.

Rules for resolving the target:

  • If the target is nil, it's the same as the current state, a.k.a self-transition

  • If the target is a vector and the first element is :>, it's an absolute path

    (f :whatever [:> :s2]) => [:s2]

  • If the target is a vector and the first element is not :>, it's an relative path

    (f [:s1] [:s2]) => :s2 (f [:s1 :s1.1] [:s1.2]) => [:s1 :s1.2]

  • If the target is a keyword, it's the same as an one-element vector

    (f [:s1] :s2) => :s2 (f [:s1 :s1.1] :s1.2) => [:s1 :s1.2]

  • If the target is a vector and the first element is :., it's a child state of current node:

    (f [:s1] [:. :s1.1]) => [:s1 :s1.1]

E.g. given current state [:s1 :s1.1] and a target of :s1.2, it should resolve to [:s1 :s1.2]

Resolve the given transition target given the current state context.

Rules for resolving the target:
- If the target is nil, it's the same as the current state, a.k.a self-transition

- If the target is a vector and the first element is :>, it's an absolute path

  (f :whatever [:> :s2]) => [:s2]

- If the target is a vector and the first element is not :>, it's an relative path

  (f [:s1] [:s2]) => :s2
  (f [:s1 :s1.1] [:s1.2]) => [:s1 :s1.2]

- If the target is a keyword, it's the same as an one-element vector

  (f [:s1] :s2) => :s2
  (f [:s1 :s1.1] :s1.2) => [:s1 :s1.2]

- If the target is a vector and the first element is :., it's a
  child state of current node:

  (f [:s1] [:. :s1.1]) => [:s1 :s1.1]

E.g. given current state [:s1 :s1.1] and a target of :s1.2, it
should resolve to [:s1 :s1.2]
sourceraw docstring

RT_Nodeclj/s

source

RT_NodePathclj/s

source

RT_TXclj/s

source

select-one-txclj/s

(select-one-tx fsm
               {:keys [path] :as node}
               state
               {:keys [type] :as event}
               input-event)

Given an atomic node and an event, find the first satistifed transition by walking from the node and then its ancestors, until the root.

Return a two-tuple:

  • The first element is the a boolean indicates whether any transition is found at all (regarding it's satisfied or not)
  • The second element is the found transition, if any.
Given an atomic node and an event, find the first satistifed transition by
walking from the node and then its ancestors, until the root.

Return a two-tuple:
- The first element is the a boolean indicates whether any transition is found at
  all (regarding it's satisfied or not)
- The second element is the found transition, if any.
sourceraw docstring

simple-stateclj/s

(simple-state x)
source

T_Actionsclj/s

source

T_Afterclj/s

source

T_Configurationclj/s

source

T_DelayedEventclj/s

Generated internal event for delayed transitions.

Generated internal event for delayed transitions.
sourceraw docstring

T_DelayedTransitionclj/s

source

T_DelayedTransitionsclj/s

source

T_DelayExpressionclj/s

source

T_Entryclj/s

source

T_Eventclj/s

source

T_EventlessTransitionsclj/s

source

T_Exitclj/s

source

T_Initialclj/s

source

T_Integrationsclj/s

source

T_Machineclj/s

source

T_Statesclj/s

source

T_Targetclj/s

See resolve-target for the synatx of target definition.

See `resolve-target` for the synatx of target definition.
sourceraw docstring

T_Transitionclj/s

source

T_Transitionsclj/s

source

T_Typeclj/s

source

transitionclj/s

(transition fsm state event)
(transition fsm state event {:as opts :keys [exec debug] :or {exec true}})

Given a machine with its current state, trigger a transition to the next state based on the given event.

The nature and purpose of the transition impl is to get two outputs:

  • the new state
  • the actions to execute

By default it executes all actions, unless the exec opt is false, in which case it is a pure function.

Given a machine with its current state, trigger a transition to the
next state based on the given event.

The nature and purpose of the transition impl is to get two outputs:
- the new state
- the actions to execute

By default it executes all actions, unless the `exec` opt is false,
in which case it is a pure function.
sourceraw docstring

validate-targetsclj/s

(validate-targets root)
(validate-targets root node current-path)

Walk the fsm and try to resolve all transition targets. Raise an exception if any target is invalid.

Walk the fsm and try to resolve all transition targets. Raise an
exception if any target is invalid.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close