-
Notifications
You must be signed in to change notification settings - Fork 1
Fork
Fork is a type of Pseudostate used in State Machines to model concurrent transitions. It allows the State Machine to split its flow into multiple parallel paths, each leading to a different target state.
Each Transition outgoing from a Fork must be targeted in a State or Pseudostate defined in different orthogonal Region of Orthogonal State.
All Transitions coming out from a Fork are Default Transitions - they are not explicitly triggered by an Event.
As Fork is a Pseudostate and not a State, the State Machine cannot stop its flow on it. Therefore, no Guards are allowed in Transitions outgoing from a Fork.
In UML, a Fork pseudostate is represented by a horizontal or vertical bar with multiple outgoing transitions:
stateDiagram-v2
state Fork <<fork>>
[*] --> InitialState
InitialState --> Fork : TriggerEvent
state ParallelStates {
State1
--
State2
--
State3
}
Fork --> State1
Fork --> State2
Fork --> State3
Equivalent Stateflows notation of a Fork pseudostate:
/* fragment of State Machine definition */
.AddInitialState("InitialState", b => b
.AddTransition<TriggerEvent>("Fork")
)
.AddFork("Fork", b => b
.AddTransition("State1")
.AddTransition("State2")
.AddTransition("State3")
)
.AddState("State1")
.AddState("State2")
.AddState("State3")If there is just one Fork in the State Machine, a shortened notation with the default name can be used:
/* fragment of State Machine definition */
.AddInitialState("InitialState", b => b
.AddTransition<TriggerEvent>(Fork.Name)
)
.AddFork(b => b // no name provided here, default name is used
.AddTransition("State1")
.AddTransition("State2")
.AddTransition("State3")
)
.AddState("State1")
.AddState("State2")
.AddState("State3")Using lambda style means that the Fork pseudostate and its Transitions are defined using string names.
/* fragment of State Machine definition */
.AddInitialState<InitialState>(b => b
.AddTransition<TriggerEvent, Fork>()
)
.AddFork(b => b
.AddTransition<State1>()
.AddTransition<State2>()
.AddTransition<State3>()
)
.AddState<State1>()
.AddState<State2>()
.AddState<State3>()Using typed style here means that the Fork pseudostate is represented by a class, in the example predefined
Forkclass is used.
Fork class can be used as a target for typed style Transitions if the State Machine contains just one Fork. If there are more Forks, there is an important concern of State identity to be considered.
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