Main mechanism to define and navigate a statechart definition. The processing algorithm for such a statechart is protocol-based. The v20150901 implementation is the default.
::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.
Main mechanism to define and navigate a statechart definition. The processing algorithm for such a statechart is protocol-based. The v20150901 implementation is the default. ::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.
(all-descendants chart 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
(child-states chart 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)
(compare-in-document-order {:com.fulcrologic.statecharts/keys [id-ordinals]
:as chart}
a
b)
Comparator function returning -1, 0, or 1 to establish the relative order of two element IDs
Comparator function returning -1, 0, or 1 to establish the relative order of two element IDs
(compound-state? chart element-or-id)
Returns true if the given state contains other states.
Returns true if the given state contains other states.
(condition-node? chart element-or-id)
Returns true if the given element is ALL of:
Returns true if the given element is ALL of: * An atomic state * Has more than one transition * NONE of the transitions require an event
(document-ordered-set chart & initial-elements)
Returns a set that keeps the IDs in document order
Returns a set that keeps the IDs in document order
(element chart element-or-id)
Find the node in the chart that has the given ID (of any type)
Find the node in the chart that has the given ID (of any type)
(exit-handlers chart element-or-id)
Returns the immediate child elements that are on-exit.
Returns the immediate child elements that are on-exit.
(find-least-common-compound-ancestor chart states)
Returns the ELEMENT that is the common compound ancestor of all the states
. NOTE: This may be
the state chart 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 chart itself. The compound state returned will be the one closest to all of the states.
(get-children chart 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.
(get-parent chart 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.
[chart element-or-id]
Alias for nearest-ancestor-state
.
[chart element-or-id] Alias for `nearest-ancestor-state`.
(get-proper-ancestors chart element-or-id)
(get-proper-ancestors chart element-or-id stopping-element-or-id)
Returns the node ids from chart
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 `chart` 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).
(ids-in-document-order chart)
(ids-in-document-order
{desired-order :com.fulcrologic.statecharts/document-order :as chart}
{: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 chart 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 chart definition to get a depth-first interpretation vs. breadth.
(in-document-order chart 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.
[chart nodes]
Same as in-document-order.
[chart nodes] Same as in-document-order.
(in-exit-order chart nodes)
The reverse of in-document-order.
The reverse of in-document-order.
(initial-element chart 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.
(invalid-history-elements chart)
Returns a sequence of history elements from chart
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 `chart` that have errors. Each node will contain a `:msgs` key with the problem descriptions. This is a static check.
(invocations chart 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`
(nearest-ancestor-state chart 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.
See chart
. SCXML-compliant name for top-level element.
See `chart`. SCXML-compliant name for top-level element.
[chart element-or-id] Returns the source (nearest ancestor that is a state element) of an element (meant to be used for transitions).
[chart element-or-id] Returns the source (nearest ancestor that is a state element) of an element (meant to be used for transitions).
(statechart {:keys [initial name binding] :as attrs} & children)
Create a new state chart 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 chart. 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 chart 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 chart. Default is the top-most `initial` element, or the first element in document order. :name - Optional name :binding - :late or :early (default is :early)
(transition-element chart 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.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close