Liking cljdoc? Tell your friends :D

com.fulcrologic.statecharts.state-machine

Implementation using a close approximation of https://www.w3.org/TR/2015/REC-scxml-20150901, including the suggested algorithm in that document, translated as closely as possible to CLJC. Future versions of the specification will appear as new namespaces to maintain compatibility through time.

::sc/k in the docstrings of this namespace assumes the alias [com.fulcrologic.statecharts :as sc], which can be generated as only an alias, though an empty namespace of that name does exist.

Implementation using a close approximation of https://www.w3.org/TR/2015/REC-scxml-20150901, including
the suggested algorithm in that document, translated as closely as possible to CLJC. Future versions of
the specification will appear as new namespaces to maintain compatibility through time.

::sc/k in the docstrings of this namespace assumes the alias `[com.fulcrologic.statecharts :as sc]`, which
can be generated as only an alias, though an empty namespace of that name does exist.
raw docstring

all-descendantsclj/s

(all-descendants machine s)

Returns a set of IDs of the (recursive) descendants (children) of s

Returns a set of IDs of the (recursive) descendants (children) of s
sourceraw docstring

assign-parentsclj/s

(assign-parents {parent-id :id initial :initial :as parent} nodes)
source

atomic-state?clj/s

(atomic-state? machine element-or-id)
source

child-statesclj/s

(child-states machine element-or-id)

Find all of the immediate children (IDs) of element-or-id that are states (final, element-or-id, or parallel)

Find all of the immediate children (IDs) of `element-or-id` that are states
(final, element-or-id, or parallel)
sourceraw docstring

compound-state?clj/s

(compound-state? machine element-or-id)

Returns true if the given state contains other states.

Returns true if the given state contains other states.
sourceraw docstring

descendant?clj/s

(descendant? machine s1 s2)
source

elementclj/s

(element machine element-or-id)

Find the node in the machine that has the given ID (of any type)

Find the node in the machine that has the given ID (of any type)
sourceraw docstring

element-idclj/s

(element-id machine element-or-id)
source

entry-handlersclj/s

(entry-handlers machine element-or-id)
source

exit-handlersclj/s

(exit-handlers machine element-or-id)

Returns the immediate child elements that are on-exit.

Returns the immediate child elements that are on-exit.
sourceraw docstring

final-state?clj/s

(final-state? machine element-or-id)
source

find-least-common-compound-ancestorclj/s

(find-least-common-compound-ancestor machine states)

Returns the ELEMENT that is the common compound ancestor of all the states. NOTE: This may be the state machine itself. The compound state returned will be the one closest to all of the states.

Returns the ELEMENT that is the common compound ancestor of all the `states`. NOTE: This may be
the state machine itself. The compound state returned will be the one closest to all of the states.
sourceraw docstring

get-childrenclj/s

(get-children machine element-or-id type)

Returns the ID of the child nodes of the given element-or-id which have the given type.

Returns the ID of the child nodes of the given `element-or-id` which
have the given type.
sourceraw docstring

get-parentclj/s

(get-parent machine element-or-id)

Get the immediate parent (id) of the given element-or-id. Returns :ROOT if the parent is the root, and nil if the element queried is already the root.

Get the immediate parent (id) of the given element-or-id. Returns :ROOT if the parent is the root,
and nil if the element queried is already the root.
sourceraw docstring

get-parent-stateclj/s

[machine element-or-id]

Alias for nearest-ancestor-state.

[machine element-or-id]

Alias for `nearest-ancestor-state`.
sourceraw docstring

get-proper-ancestorsclj/s

(get-proper-ancestors machine element-or-id)
(get-proper-ancestors machine element-or-id stopping-element-or-id)

Returns the node ids from machine that are proper ancestors of element-or-id (an id or actual element-or-id). If stopping-element-or-id-or-id is included, then that will stop the retrieval (not including the stopping element-or-id). The results are in the ancestry order (i.e. deepest element-or-id first).

Returns the node ids from `machine` that are proper ancestors of `element-or-id` (an id or actual element-or-id). If `stopping-element-or-id-or-id`
is included, then that will stop the retrieval (not including the stopping element-or-id). The results are
in the ancestry order (i.e. deepest element-or-id first).
sourceraw docstring

history-element?clj/s

(history-element? machine element-or-id)
source

history-elementsclj/s

(history-elements machine element-or-id)
source

ids-in-document-orderclj/s

(ids-in-document-order machine)
(ids-in-document-order
  {desired-order :com.fulcrologic.statecharts/document-order :as machine}
  {:keys [id] :as node})

Returns the IDs of the states in the given node, in document order (not including the node itself). You can specify ::sc/document-order :breadth-first on the top-level machine definition to get a depth-first interpretation vs. breadth.

Returns the IDs of the states in the given node, in document order (not including the node itself).
You can specify `::sc/document-order :breadth-first` on the top-level machine definition to get a
depth-first interpretation vs. breadth.
sourceraw docstring

in-document-orderclj/s

(in-document-order machine nodes-or-ids)

Given a set/sequence of actual nodes-or-ids (as maps), returns a vector of those nodes-or-ids, but in document order.

Given a set/sequence of actual nodes-or-ids (as maps), returns a vector of those nodes-or-ids, but in document order.
sourceraw docstring

in-entry-orderclj/s

[machine nodes]

Same as in-document-order.

[machine nodes]

Same as in-document-order.
sourceraw docstring

in-exit-orderclj/s

(in-exit-order machine nodes)

The reverse of in-document-order.

The reverse of in-document-order.
sourceraw docstring

initial-elementclj/s

(initial-element machine element-or-id)

Returns the element that represents the <initial> element of a compound state element-or-id. Returns nil if the element isn't a compound state.

Returns the element that represents the <initial> element of a compound state element-or-id.
Returns nil if the element isn't a compound state.
sourceraw docstring

invalid-history-elementsclj/s

(invalid-history-elements machine)

Returns a sequence of history elements from machine that have errors. Each node will contain a :msgs key with the problem descriptions. This is a static check.

Returns a sequence of history elements from `machine` that have errors. Each node will contain a `:msgs` key
with the problem descriptions. This is a static check.
sourceraw docstring

invocationsclj/s

(invocations machine element-or-id)

Returns the IDs of the nodes that are invocations within element-or-id

Returns the IDs of the nodes that are invocations within `element-or-id`
sourceraw docstring

machineclj/s

(machine {:keys [initial name binding] :as attrs} & children)

Create a new state machine definition that mimics the structure and semantics of SCXML.

Attributes:

::sc/document-order - :breadth-first or :depth-first (default). See Conformance.adoc. :initial - ID(s) of initial state(s) of the machine. Default is the top-most initial element, or the first element in document order. :name - Optional name :binding - :late or :early (default is :early)

Create a new state machine definition that mimics the structure and semantics of SCXML.

Attributes:

::sc/document-order - :breadth-first or :depth-first (default). See Conformance.adoc.
:initial - ID(s) of initial state(s) of the machine. Default is the top-most `initial` element,
           or the first element in document order.
:name - Optional name
:binding - :late or :early (default is :early)
sourceraw docstring

nearest-ancestor-stateclj/s

(nearest-ancestor-state machine element-or-id)

Returns the ID of the state (if any) that encloses the given element-or-id, or nil if there is no ancestor state.

Returns the ID of the state (if any) that encloses the given element-or-id, or nil if there is no
ancestor state.
sourceraw docstring

parallel-state?clj/s

(parallel-state? machine element-or-id)
source

scxmlclj/s

See machine. SCXML-compliant name for top-level element.

See `machine`. SCXML-compliant name for top-level element.
sourceraw docstring

sourceclj/s

[machine element-or-id] Returns the source (nearest ancestor that is a state element) of an element (meant to be used for transitions).

[machine element-or-id]
Returns the source (nearest ancestor that is a state element) of an element (meant to be used for transitions).
sourceraw docstring

state?clj/s

(state? machine element-or-id)
source

transition-elementclj/s

(transition-element machine element-or-id)

Returns the element that represents the first transition of element-or-id. This should only be used on nodes that have a single required transition, such as <initial> and <history> nodes.

Returns the element that represents the first transition of element-or-id.
This should only be used on nodes that have a single required transition, such as
<initial> and <history> nodes.
sourceraw docstring

transitionsclj/s

(transitions machine element-or-id)
source

with-default-initial-stateclj/s

(with-default-initial-state {:keys [id initial] :as parent} children)

Scans children for an initial state. If no such state is found then it creates one and sets the target to the first child that is a state.

Scans children for an initial state. If no such state is found then it creates one and sets the target to the
first child that is a state.
sourceraw docstring

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

× close