-
Notifications
You must be signed in to change notification settings - Fork 0
Initial transitions
A born and die lifecycle is defined on a class whose instances are created and deleted during runtime.
For this type of lifecycle you need to specify one or more initial transitions between the Events section and the States sections.
In the Elevator Management domain, an instance of a Transfer class is created when a Cabin is dispatched and deleted when the transfer is complete. So its lifecycle specifies an initial transition.
initial transitions
Execute > WAITING FOR CABIN
--
The grammar:
// Initial transitions
initial_transitions = it_header transition* block_end
it_header = "initial transitions" EOL*
transition = INDENT event_name (SP '>' SP state_name)? EOL*
The unindented initial transitions header (note: two words, one space, all lowercase) is followed by any
number of indented transitions written exactly the way they're written inside a state — see Transitions
for the anatomy of that line — and closed with an unindented --.
So Execute > WAITING FOR CABIN says that a Transfer instance is created by the Execute event and begins
life in the WAITING FOR CABIN state.
The grammar allows multiple initial transitions. This is useful when an instance may be created under varied circumstances. Each such transition may lead to a different initial state.
Copyright 2023-2026 © Leon Starr under MIT Open Source License