| Element | Meaning |
| Initial pseudostate |
A filled circle with no incoming edges. Every state machine has exactly one.
The transition leaving it carries no event label - the machine enters its
first state on construction.
|
| State |
A rounded rectangle. The top compartment holds the state name. Optional lower
compartments list the internal behaviors: entry / action (executes
on every entry), exit / action (executes on every exit),
do / activity (executes continuously while in the state).
|
| Transition |
An arrow from source state to target state, labeled with the full trigger
syntax: event [guard] / action. All three parts are optional.
A transition with no event label fires automatically when the source state's
do-activity completes.
|
| Event |
The named occurrence that can trigger the transition. A method call, a signal,
a timeout, or a change condition. The event name appears before the guard.
|
| Guard |
A boolean condition in square brackets: [queue empty],
[match found]. The transition fires only when the event occurs
and the guard is true. Two transitions from the same state on the
same event must have mutually exclusive guards.
|
| Action |
An operation that executes atomically when the transition fires, after the
exit action of the source state and before the entry action of the target
state. Written after the slash: find() / print path.
|
| Composite state |
A state that contains nested states. A transition into a composite state
enters its designated initial substate. A transition out of a composite state
can fire from any substate. Composite states reduce diagram clutter by
grouping related substates.
|
| History pseudostate |
A circle containing H (shallow) or H* (deep) inside a composite state.
When re-entering the composite state, the machine resumes the last active
substate rather than always entering the initial substate.
|
| Final state |
A bullseye - a filled circle inside a larger ring. Entering the final state
signals that the object's lifecycle is complete. A composite state may have
its own final state, signaling completion of that region only.
|
Figure 1. Worker state machine.
Figure 2. TextFinder state machine.
| Concern |
State diagram |
Activity diagram |
| Subject |
One object and its lifecycle. |
A process, workflow, or algorithm - often spanning multiple objects. |
| Transition trigger |
An event directed at the object: a method call, signal, or timeout. |
Completion of an action, or a guard becoming true. |
| Illegal operations |
Visible as absent transitions - if no edge leaves a state on event E, E is illegal in that state. |
Not expressible; activity diagrams show what happens, not what is forbidden. |
| Concurrency |
Concurrent regions inside a composite state - the object is in two substates simultaneously. |
Fork and join bars - two threads of action run in parallel. |
| TextFinder fit |
Models DirNav's traversal lifecycle and Output's configuration precondition. |
Models the search algorithm - nested loops and the regex match decision. |
| Resource | Description |
|
Project Story: TextFinder
|
Architecture, CLI, performance, and code metrics for all five implementations. |
|
UML Activity Diagrams
|
The companion behavioral view showing the search algorithm as a flow of control rather than an object lifecycle. |
|
UML Sequence Diagrams
|
Shows the callback message protocol - the events that drive the state transitions modeled here. |
|
Mermaid state diagram syntax
|
Full syntax reference for Mermaid stateDiagram-v2, including composite states, concurrent regions, and notes. |
|
UML State Machine Diagrams Overview
|
Formal UML notation reference covering all pseudostates, regions, history, and entry/exit point semantics. |