-
Notifications
You must be signed in to change notification settings - Fork 1
Nodes
# Overview
Activity Nodes represent the building blocks of Activities in the Stateflows framework.
In general, an Activity Node consists of:
- Name, uniquely identifying the Node within the Activity,
- Type, specifying the kind of Activity Node (e.g., Action, Decision, Merge, Fork, Join, etc.),
- Incoming Flows, passing input Tokens into the node,
- Outgoing Flows, passing output Tokens outside the node,
- Logic, code that is invoked when the node is executed (Action Nodes only).
There are several types of Activity nodes:
- Action Node: Represents a single step or action in the Activity.
- Decision Node: Represents a branching point where one of several outgoing flows is selected based on a condition.
- Merge Node: Combines multiple incoming flows into a single outgoing flow.
- Fork Node: Splits a single incoming flow into multiple outgoing flows, enabling parallel execution.
- Join Node: Combines multiple incoming flows into a single outgoing flow, synchronizing parallel flows.
UML notation of two Activity nodes connected by a flow:
flowchart
initial@{ shape: circle, label: " " }
initial --> generator
generator(IntGenerator)
generator -->|int| decision
decision@{ shape: diamond, label: " " }
decision -->|token.Value < 100| small
decision -->|else| big
small(SmallIntProcessor)
big(BigIntProcessor)
join@{ shape: join, label: " " }
small --> join
big --> join
join --> finish
finish@{ shape: double-circle, label: " " }
Equivalent Stateflows notation of Activity Nodes:
/* fragment of Activity definition */
.AddInitial(b => b
.AddControlFlow("IntGenerator")
)
.AddAction("IntGenerator",
async c => { /* logic that generates ints */ },
b => b.AddFlow<int>(DecisionNode.Name)
)
.AddDecision(b => b
.AddFlow("SmallIntProcessor", b => b
.AddGuard(async c => c.Token.Value < 100)
)
.AddElseFlow("BigIntProcessor")
)
.AddAction("SmallIntProcessor",
async c => { /* logic that processes small ints */ },
b => b.AddControlFlow(JoinNode.Name)
)
.AddAction("BigIntProcessor",
async c => { /* logic that processes big ints */ },
b => b.AddControlFlow(JoinNode.Name)
)
.AddJoin(b => b
.AddControlFlow(FinalNode.Name)
)
.AddFinal()Using lambda style means that Activity nodes are represented by string names passed as parameters to
AddActionmethods.
/* fragment of Activity definition */
.AddAction<IntGenerator>(b => b
.AddFlow<int>(DecisionNode.Name)
)
.AddDecision(b => b
.AddFlow<SmallIntProcessor>(b => b
.AddGuard(async c => c.Token.Value < 100)
)
.AddElseFlow<BigIntProcessor>()
)
.AddAction<SmallIntProcessor>(b => b
.AddControlFlow<Join>()
)
.AddAction<BigIntProcessor>(b => b
.AddControlFlow<Join>()
)
.AddJoin(b => b
.AddControlFlow<FinalNode>()
)
.AddFinal()Using typed style means that Activity nodes are represented by classes that are referenced in typed overloads of
AddActionmethods. Such classes must implement proper interfaces - refer to detailed descriptions of Action Node, Decision Node, etc.
Home page Support Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0. © by Mikołaj Milewski, 2025
Overview
Installation
Behaviors
State Machines
Building blocks
States
State
Composite State
Orthogonal State
Final State
Pseudostates
Choice
Junction
Fork
Join
Transitions
Transition
Default Transition
Internal Transition
Concepts
Evaluation of Transitions
Activities
Building blocks
Nodes
Action Node
Decision Node
Merge Node
Initial Node
Final Node
Input Node
Output Node
Fork Node
Join Node
Accept Event Action Node
Send Event Action Node
Data Store Node
Structured Activity Node
Iterative Activity Node
Parallel Activity Node
Flows
Data Flow
Control Flow
Concepts
Implicit fork and join
Actions