Liking cljdoc? Tell your friends :D

com.fulcrologic.statecharts.elements

The elements you can define in charts. The intention is for this model to be potentially serializable for users that need that. Thus, the expressions used in these data structures MAY use CLJC functions/code, or may represent such elements a strings or other (quoted) EDN. The ExecutionModel is responsible for this part of the interpretation.

The overall data model is represented as a map. The DataModel implementation MAY choose scope and resolution rules. Location expressions are interpreted by the DataModel, but it is recommended they be keywords or vectors of keywords.

NOTE: The SCXML standard defines a number of elements (if, else, elseif, foreach, log) for abstract executable content. In cases where you want to transform an SCXML document to this library you should note that we treat those XML nodes as content that can be translated ON DOCUMENT READ into the code form used by this library.

The elements you can define in charts. The intention is for this model to be potentially serializable for users
that need that. Thus, the expressions used in these data structures *MAY* use CLJC functions/code, or may represent
such elements a strings or other (quoted) EDN. The ExecutionModel is responsible for this part of the interpretation.

The overall data model is represented as a map. The DataModel implementation MAY choose scope and resolution
rules. Location expressions are interpreted by the DataModel, but it is recommended they be keywords or vectors
of keywords.

NOTE: The SCXML standard defines a number of elements (if, else, elseif, foreach, log) for abstract
executable content. In cases where you want to transform an SCXML document to this library you should note that we
treat those XML nodes as content that can be translated ON DOCUMENT READ into the code form used by this library.
raw docstring

assignclj/s

(assign {:keys [id location expr] :as attrs} & children)

Assign the value of expr into the data model at location. Location expressions are typically vectors of keywords in the DataModel.

https://www.w3.org/TR/scxml/#assign

Assign the value of `expr` into the data model at `location`. Location expressions are typically vectors of
 keywords in the DataModel.

https://www.w3.org/TR/scxml/#assign
sourceraw docstring

cancelclj/s

(cancel {:keys [id sendid] :as attrs})

Cancel a delayed send (see send's idlocation parameter). :sendid can be an expression.

https://www.w3.org/TR/scxml/#cancel

Cancel a delayed send (see `send`'s idlocation parameter). `:sendid` can be an expression.

https://www.w3.org/TR/scxml/#cancel
sourceraw docstring

data-modelclj/s

(data-model {:keys [id src expr] :as attrs})

Create a data model (in a state or machine context).

:expr is an expression that can be run by your current ExecutionModel. The result of the expression becomes the value of your initial data model (typically a map). :src (if the data model supports it) is a location from which to read the data for the data model.

https://www.w3.org/TR/scxml/#data-module

Create a data model (in a state or machine context).

`:expr` is an expression that can be run by your current ExecutionModel. The result of the expression
becomes the value of your initial data model (typically a map).
`:src` (if the data model supports it) is a location from which to read the data for the data model.

https://www.w3.org/TR/scxml/#data-module
sourceraw docstring

done-dataclj/s

(done-data {:keys [id expr] :as attrs})

Data (calculated by expr) to return to caller when a final state is entered. See data-model.

NOTE: Differs from spec (uses expr instead of child elements)

https://www.w3.org/TR/scxml/#donedata

Data (calculated by expr) to return to caller when a final state is entered. See `data-model`.

NOTE: Differs from spec (uses expr instead of child elements)

https://www.w3.org/TR/scxml/#donedata
sourceraw docstring

finalclj/s

(final {:keys [id] :as attrs} & children)
https://www.w3.org/TR/scxml/#final
sourceraw docstring

historyclj/s

(history {:keys [id type deep?] :as attrs} default-transition)

Create a history node.

:type - :deep or :shallow (can also use deep? as an alias). Defaults to shallow.default-transitioncan be a transition element with a:target` (per standard), or as a shortcut simply the value you want for the target of the transition.

https://www.w3.org/TR/scxml/#history

Create a history node.

:type - :deep or :shallow (can also use `deep? as an alias). Defaults to shallow.
`default-transition` can be a transition element with a `:target` (per standard), or as a shortcut
  simply the value you want for the target of the transition.

https://www.w3.org/TR/scxml/#history
sourceraw docstring

initialclj/s

(initial {:keys [id] :as attrs} transition-or-target)

Alias for (state {:initial? true} (transition-or-target ...)).

id The (optional) ID of this state

https://www.w3.org/TR/scxml/#initial

Alias for `(state {:initial? true} (transition-or-target ...))`.

`id` The (optional) ID of this state

https://www.w3.org/TR/scxml/#initial
sourceraw docstring

invokeclj/s

(invoke attrs)

Create an instance of an external service that can return data (and send events) back to the calling state(s). An invoked service stays active while the state is active, and is terminated when the parent state is exited.

When the invocation is created it will be associated with the identifier <state-id>.<platform-id> where <state-id> is the ID of the state in which the invocation lives, and <platform-id> is a unique autogenerated id. This is stored in idlocation (if supplied) in the data model. This identifier is known as the invokeid.

Events generated by the invoked service will cause finalize to be called (if supplied). Note that each event causes this, and finalize MAY update the data model. Such processing happens before the event is handed to the rest of the state machine for evaluation.

A :done.invoke.<invokeid> event is generated if the invoked service reaches a final state and exits.

If the state of the (local) machine is exited before receiving the done event, then it cancels the invoked service and ignores any events received by it after that point.

  • :id The id of the element. See below for special considerations.
  • :params An expression in the execution model's notation that can calculate the data to send to the invocation.
  • :finalize An expression to run when the invocation returns, and may update the data model.
  • :type The type of external service (expression allowed)
  • :autoforward Enable forwarding of (external) events to the invoked process.
  • :idlocation a vector of keywords that specifies a location in the DataModel to store a generated ID that uniquely identifies the event instance being sent. If not supplied then id will be the id of the send.
  • :finalize A (fn [data-model-for-context event] data-model-for-context) that processes results from the external process.

NOTES:

  • The id can be supplied, but if not supplied a new ID per invocation (according to spec) must be generated at each execution.

https://www.w3.org/TR/scxml/#invoke

Create an instance of an external service that can return data (and send events) back to the calling state(s). An
invoked service stays active while the state is active, and is terminated when the parent state is exited.

When the invocation is created it will be associated with the identifier `<state-id>.<platform-id>` where `<state-id>`
is the ID of the state in which the invocation lives, and `<platform-id>` is a unique autogenerated id. This is
stored in `idlocation` (if supplied) in the data model. This identifier is known as the `invokeid`.

Events generated by the invoked service will cause `finalize` to be called (if supplied). Note that each event causes
this, and `finalize` MAY update the data model. Such processing happens before the event is handed to the rest of
the state machine for evaluation.

A `:done.invoke.<invokeid>` event is generated if the invoked service reaches a final state and exits.

If the state of the (local) machine is exited before receiving the done event, then it cancels the invoked service
and ignores any events received by it after that point.

* `:id` The id of the element. See below for special considerations.
* `:params` An expression in the execution model's notation that can calculate the data to send to the invocation.
* `:finalize` An expression to run when the invocation returns, and may update the data model.
* `:type` The type of external service (expression allowed)
* `:autoforward` Enable forwarding of (external) events to the invoked process.
* `:idlocation` a vector of keywords that specifies a location in the DataModel
  to store a generated ID that uniquely identifies the event instance
  being sent. If not supplied then `id` will be the id of the send.
* `:finalize` A `(fn [data-model-for-context event] data-model-for-context)`
that processes results from the external process.

 NOTES:

 * The `id` *can* be supplied, but if not supplied a new ID per invocation (according to spec) must be generated
   at each execution.

https://www.w3.org/TR/scxml/#invoke
sourceraw docstring

logclj/s

(log {:keys [id label expr] :as attrs})

Log a message. (Currently uses Timbre, with debug level)

https://www.w3.org/TR/scxml/#log

Log a message. (Currently uses Timbre, with debug level)

https://www.w3.org/TR/scxml/#log
sourceraw docstring

new-elementclj/s

(new-element type {:keys [id] :as attrs})
(new-element type {:keys [id] :as attrs} children)

Create a new element with the given type and attrs. Will auto-assign an ID if it is not supplied. Use this as a helper when creating new element types (e.g. executable content) to ensure consistency in operation.

Create a new element with the given `type` and `attrs`. Will auto-assign an ID if it is not supplied. Use
this as a helper when creating new element types (e.g. executable content) to ensure consistency in operation.
sourceraw docstring

on-entryclj/s

(on-entry {:keys [id] :as attrs} & children)
https://www.w3.org/TR/scxml/#onentry
sourceraw docstring

on-exitclj/s

(on-exit {:keys [id] :as attrs} & children)
https://www.w3.org/TR/scxml/#onexit
sourceraw docstring

parallelclj/s

(parallel {:keys [id] :as attrs} & children)

Create a parallel node.

https://www.w3.org/TR/scxml/#parallel

Create a parallel node.

https://www.w3.org/TR/scxml/#parallel
sourceraw docstring

raiseclj/s

(raise {:keys [id event] :as attrs})

Raise an event in the current session.

https://www.w3.org/TR/scxml/#raise

Raise an event in the current session.

https://www.w3.org/TR/scxml/#raise
sourceraw docstring

scriptclj/s

(script {:keys [id src expr] :as attrs})

A script to execute. MAY support loading the code via src, or supply the code via expr (in the format required by your ExecutionModel).

See the documentation for you data model to understand the semantics and operation of this element.

https://www.w3.org/TR/scxml/#script

A script to execute. MAY support loading the code via `src`, or supply the code via `expr` (in the format required
 by your ExecutionModel).

See the documentation for you data model to understand the semantics and operation of this element.

https://www.w3.org/TR/scxml/#script
sourceraw docstring

sendclj/s

(send attrs)

Sends an event to the specified (external) target (which could be an external system, this machine, or another machine).

  • :event An expression that results in the event name to send.
  • :params An expression that results in data to be included in the event.
  • :target An expression that gives the target to send to.
  • :type An expression generating a selector for which mechanism to use for sending.
  • :delay A number of milliseconds to delay the send, or an expression for computing it.
  • :namelist - List of location expressions (vector of vectors) to include from the data model.
  • :idlocation a vector of keywords that specifies a location in the DataModel to store a generated ID that uniquely identifies the event instance being sent. If not supplied then id will be the id of the element itself.
Sends an event to the specified (external) target (which could be an external system, this machine,
 or another machine).

* `:event` An expression that results in the event *name* to send.
* `:params` An expression that results in data to be included in the event.
* `:target` An expression that gives the target to send to.
* `:type` An expression generating a selector for which mechanism to use for sending.
* `:delay` A number of milliseconds to delay the send, or an expression for computing it.
* `:namelist` - List of location expressions (vector of vectors) to include from the data model.
* `:idlocation` a vector of keywords that specifies a location in the DataModel
  to store a generated ID that uniquely identifies the event instance
  being sent. If not supplied then `id` will be the id of the element itself.
sourceraw docstring

Sendclj/s

[attrs]

Same as send, but doesn't alias over clojure.core/send

Sends an event to the specified (external) target (which could be an external system, this machine, or another machine).

  • :event An expression that results in the event name to send.
  • :params An expression that results in data to be included in the event.
  • :target An expression that gives the target to send to.
  • :type An expression generating a selector for which mechanism to use for sending.
  • :delay A number of milliseconds to delay the send, or an expression for computing it.
  • :namelist - List of location expressions (vector of vectors) to include from the data model.
  • :idlocation a vector of keywords that specifies a location in the DataModel to store a generated ID that uniquely identifies the event instance being sent. If not supplied then id will be the id of the element itself.
[attrs]

Same as `send`, but doesn't alias over clojure.core/send

Sends an event to the specified (external) target (which could be an external system, this machine,
  or another machine).

 * `:event` An expression that results in the event *name* to send.
 * `:params` An expression that results in data to be included in the event.
 * `:target` An expression that gives the target to send to.
 * `:type` An expression generating a selector for which mechanism to use for sending.
 * `:delay` A number of milliseconds to delay the send, or an expression for computing it.
 * `:namelist` - List of location expressions (vector of vectors) to include from the data model.
 * `:idlocation` a vector of keywords that specifies a location in the DataModel
   to store a generated ID that uniquely identifies the event instance
   being sent. If not supplied then `id` will be the id of the element itself.
 
sourceraw docstring

sfnclj/smacro

(sfn [env-sym data-sym] & body)

A macro that emits a script element, but looks more like a normal CLJC lambda:

(sfn [env data] ...)

is shorthand for

(script {:expr (fn [env data] ...)})
A macro that emits a `script` element, but looks more like a normal CLJC lambda:

```
(sfn [env data] ...)
```

is shorthand for

```
(script {:expr (fn [env data] ...)})
```

sourceraw docstring

stateclj/s

(state {:keys [id initial initial?] :as attrs} & children)

Create a state. ID will be generated if not supplied. The initial element is an alias for this element with :initial? true. The :initial key can be used in PLACE of a nested initial element.

https://www.w3.org/TR/scxml/#state

Create a state. ID will be generated if not supplied. The `initial` element is an alias for this
element with `:initial? true`. The `:initial` key can be used in PLACE of a nested initial element.

https://www.w3.org/TR/scxml/#state
sourceraw docstring

transitionclj/s

(transition {:keys [event cond target type] :as attrs} & children)

Define a transition. The target parameter can be a single keyword or a set of them (when the transition activates multiple specific states (e.g. parallel children).

:event - Name of the event as a keyword, or a list of such keywords. See events/name-match? or SCXML for semantics. :cond - Expression that must be true for this transition to be enabled. See execution model. :target - Target state or parallel region(s) as a single keyword or list of them. :type - :internal or :external

https://www.w3.org/TR/scxml/#transition

Define a transition. The `target` parameter can be a single keyword or a set of them (when the transition activates
multiple specific states (e.g. parallel children).

`:event` - Name of the event as a keyword, or a list of such keywords. See `events/name-match?` or SCXML for semantics.
`:cond` - Expression that must be true for this transition to be enabled. See execution model.
`:target` - Target state or parallel region(s) as a single keyword or list of them.
`:type` - :internal or :external

https://www.w3.org/TR/scxml/#transition
sourceraw docstring

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

× close