-
Notifications
You must be signed in to change notification settings - Fork 1
Final State
Final State represents stable configuration of State Machine. There can be exactly one Final State per Region (if Final State is a substate of Composite State or Orthogonal State) or exactly one per State Machine (if Final State is defined on State Machine's main level).
Final State can't have any outgoing Transitions and, when reached, cannot be exited explicitly. It can be exited only implicitly when parent State is exited.
Final State can't define any OnEntry / OnExit logic.
Outcome of reaching Final State differs depending on its owner:
- Composite States and Orthogonal States are finalized when Final States in all their Regions are reached,
- State Machine Behavior is finalized when Final State that is a direct child of a State Machine is reached.
Final State consist of:
- Name, uniquely identifying Final State within State Machine,
- Parent State, if Final State is a substate of Composite State or Orthogonal State.
In UML, Final State is represented by double circle:
stateDiagram-v2
InitialState --> [*] : Finish
Equivalent Stateflows notation of States:
/* fragment of State Machine definition */
.AddState("InitialState", b => b
.AddTransition<Finish>("final")
)
.AddFinalState("final")If there is just one Final State in State Machine, shortened notation with default name can be used:
/* fragment of State Machine definition */
.AddState("InitialState", b => b
.AddTransition<Finish>(FinalState.Name)
)
.AddFinalState() // no name provided here, default name usedUsing lambda style here means that Final State is referred to by string name.
public class InitialState : IState
{ }
/* fragment of State Machine definition */
.AddState<InitialState>(b => b
.AddTransition<Finish, FinalState>()
)
.AddFinalState()Using typed style here means that Final State is represented by a class, in the example predefined
FinalStateclass is used.
FinalState class can be used as a target for typed style Transitions if State Machine contains just one Final State. If there are more Final States, 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