-
Notifications
You must be signed in to change notification settings - Fork 0
Action block
An action block is a set of one or more actions within an activity that may be enabled. The actions sandwiched between an ?: (if then) clause, for example, constitutes an action block. If the set consists of more than one action, it is generally surrounded by {} brackets. Read further to see what exactly is meant by “enabling an action block”.
On a data flow diagram, there is no action block concept since you can just follow dashed arrows to see what upstream actions are triggered and then trace the outputs of those actions downstream to work out the complete activity subset triggered by a decision. With text, we need the help of brackets to visualize the same subset.
In the diagram below, two actions are enabled by a true condition. The dashed rectangle isn’t needed on a data flow diagram, but it does indicate what we would enclose in brackets to form an action block.

This example shows a state activity from the Elevator 3 Case Study where a search for the next Cabin destination (Accessible Shaft Level: aslev) is initiated. One may or may not be found. Here is the equivalent Scrall:
// The Cabin in this Shaft is stationary and has no Transfer
cabin in shaft .= /R2/Cabin
destination aslev .= cabin in shaft.Ping both ways()
destination aslev? {
Execute -> *Transfer &R53 cabin in shaft, destination aslev
Transfer created ->
} : No destination -> me
The execution of an activity begins immediately, upon either state entry or explicit invocation depending on the activity type, state, method, etc. Each action in the activity may execute only when all of its inputs are available. An input to an action is either a data flow, as represented by a variable or a class model access, an input parameter designated in the activity signature, or a sequence token. Upon invocation, all input parameters are considered available. The class model content is always available. A variable is available once it is initialized with a value. A sequence token is available upon completion of an associated action block.
If an individual action is enabled, it means that the action has all the data it needs and is ready for execution.
An action block is considered enabled when all input and sequence tokens are available to enable one or more triggering actions within the action block. A triggering action is an action within an action block that can execute as soon as the action block is enabled. All non-triggering actions in that action block must be enabled by data or sequence tokens originating within that same action block. In other words, once an action block is enabled, it is assumed that all of its content will ultimately be enabled.
All sequencing within an activity is determined exclusively by data availability. The vertical order in which the actions are written, for example, has no relevance to the sequence of execution. To process an activity during runtime, it is necessary to convert an activity into a data flow graph to determine the essential sequencing. In most cases, it is possible to work this out by determining when data variables have been initialized and when they are accessed. If, however, a data variable is accessed more than once, it may be necessary to be more explicit about the data dependencies.
One action may alter instance data in the class model which serves as input to a subsequent action. Since no data variables are involved, it is necessary to explicitly sequence the actions. This is done on a data flow diagram using a dashed control flow. In action language, we can set a sequence token to represent the same idea.
A control token is any name between angled <> brackets and is set upon completion of one action block. When set, it is placed as the rightmost element after the end of an action block; either to the right of a single action or to the right for a closing } bracket. It can then be seen as an activating input by placing it as the leftmost element of some other action block.
See the example in the Action Semantics section for an example.
Activation of an action block may depend on the result of some prior evaluation. This can be accomplished by sandwiching the action blocks within an if-else action or through the use of guards.
The if-then-else statement follows the usual programming language format where:
(<predicate>)?
<action block> : <action block>
For example:
(x > y)?
doA : doB
Copyright 2020, 2021, 2022, 2023, 2025 © Leon Starr under MIT Open Source License
- Why they are problematic
- Instance attribute creation values
- Boolean values
- Special values
- Enumerated values
- Action block
- Statement
- Single line action
- Multiple dependent actions on a single line
- An action spread across multiple lines
- A conditional group of single line actions
- Comments
- Finding instances
- Attribute access
- Creation and deletion
- Subclass migration
- Creating a table from a class
- Creating a table with a definition
- Converting a table into a class
- Set operations on tables
- Set comparisons on tables
- Join
- Rename
- Extend
- Aggregation
- Rank
- Image
- Input values
- Signatures and name doubling
- Output values
- Execution order
- Sequential execution
- Conditional execution
- Signals
- Scrall has no for_each action
- Iteration