State machine diagram/state transition table
Overview
State machine diagrams can be used to describe the state of a system or class and its behavior. In addition to state machine diagrams, state transition tables can also be used, allowing you to design seamlessly by switching between state machine diagrams and state transition tables.
In the state transition table, you can highlight locations with transitions and locations without transitions, and check transitions for which triggers are not defined. Then, by noting the information that the trigger should be ignored or cannot occur instead of the transition, you can design without missing anything.
This page explains operations for using state machine diagrams and state transition tables in the following order.
- Place state machine diagram
- Define the state
- Define transitions
- Describe design information in state transition table
We also provide the following features to assist users in their modeling:
These will also be explained in turn.
- Validate the model
- Set display content
Place the state machine diagram
To place a state machine diagram, follow these steps:
- Select the package in the model navigator and click [Add Model] > [State Machine Diagram] in the context menu.
- The state machine diagram is placed in the child element of the selected package.
In the current version, if the display scale in the display settings is set to a value greater than 100%, some text in cells in the state transition table may be cut off.
To avoid this phenomenon, please set the display scale in the display settings to 100%.
For other restrictions, see here.
Define the state
To define a state, follow these steps:
- Drag and drop [State] from the toolbox onto the displayed state machine diagram.
- A new state is added as a child element of the displayed state machine diagram or state.
In the state machine diagram, you can place the following elements displayed in the toolbox.
Icon | Name |
---|---|
State | |
Entrance point | |
Exit Point | |
Start | |
End | |
History | |
Join | |
Select | |
Parallel | |
Join | |
Note | |
Label | |
Shape |
Arrange the entry and exit points as port shapes of the following elements.
- situation
Add behavior to state
To add an entry process, follow these steps:
- Select a state.
- Double-click the Behavior > On Entry field in the Property Inspector to enter editing state.
- When you write the process at the time of admission and confirm the edit, the process at the time of admission is set in the state and the process at the time of admission is displayed on the state machine diagram.
When you enter text into the body of a state on a state machine diagram, the text is analyzed according to the notation format and reflected in each field value of the state.
Of course, if you change each field value, it will be reflected in the text on the diagram.
Correspondence between state behavior, text representation format, and each field value
Behaviors for states are displayed and parsed as text according to the following format:
-
Format:
<Behavior> ::= ['entry/'<Processing upon entry>]['\n']['do/'<Processing during stay>]['\n']['exit/'<Processing upon exiting >]
- Example
Entry process:set display on
Processing while staying:show distance
Exit processing:set display off
In this case, the following text will be displayed.
entry/set display on
do/show distance
exit/set display off
- Example
Adding stereotypes to states
To add a stereotype, follow these steps:
- Select a state.
- Click the Add button in the Basic information > Stereotype field in the Property Inspector to display the choices.
- Select a stereotype and press the [OK] button to set the stereotype in the state and display the stereotype on the state machine diagram.
Stereotype choices can be defined in the package model's Detail view.
Once you have added a stereotype, you can edit it from the state machine diagram by following these steps:
- Double-click the stereotype displayed in the status to enter the editing status.
- If you change the stereotype and confirm the edit, it will be reflected on the state machine diagram and the state stereotype will be changed.
Define transitions
To define transitions between states:
- Move the pointer over the state where you want the transition to start.
- Drag the [▲] icons that appear on all sides of the state and drop them on the state that will be the end point of the transition.
Add triggers to transitions
To add a trigger, follow these steps:
- Select a transition.
- Click the Add button in the Basic information > Trigger field in the Property Inspector to display the choices.
- Select a trigger and press the [OK] button to set the trigger on the transition and display the trigger on the state machine diagram.
When you enter text into a transition label on a state machine diagram, the text is analyzed according to the notation format and reflected in each field value of the transition.
Of course, if you change each field value, it will be reflected in the text on the diagram.
Correspondence between transition text notation format and each field value
Transitions are displayed and parsed as text according to the following format:
- Format:
<Transition> ::= [<List of triggers>] ['[' <Guard> ']'] ['/' <Effect>]
- supplement
<List of triggers>
is displayed in the following format.<List of triggers> ::= <trigger>[','<trigger>]*
- Example
Trigger:close
Guard:doorway -> isEmpty()
Effect:closed
In this case, the following text will be displayed.
close [doorway -> isEmpty()]/closed
- supplement
Add stereotypes to transitions
To add a stereotype, follow these steps:
- Select a transition.
- Double-click the grayed-out [<<stereotype>>] to enter editing mode.
- Enter the stereotype you want to set, the stereotype will be displayed on the transition in the state machine diagram, and the stereotype will be set on the transition.
Define design information in state transition table
Display state transition table
To display the design information of a state machine diagram in the state transition table, follow the steps below.
- Switch the editor display to the State Transition Table view according to the following documentation:
- [Next Design User's Manual > Modeling > Model Editing > Basics of Model Editing > Editing in the Main Editor > Switching Views](../../../../docs/modeling-guide/model-edit/model-edit-basics.md#Switch views)
The state transition table displays the following elements as states.
Icon | Name |
---|---|
Start | |
Entrance point | |
State | |
History | |
Select | |
Parallel | |
Join | |
Join | |
Exit Point | |
End |
States are ordered in the order listed above.
However, the following elements are not aligned:
- choice
- parallel
- Merging
- Join
:::note
- All states including substates are displayed.
- Transitions without triggers are displayed in the
<None>
column. - When you select a range of merged cells, cells outside the range may also become selected.
- The position of the state and trigger (row and column) can be switched by selecting [State-Trigger] and [Trigger-State] in the [Switch View] combo box.
:::
Define the state
To define states in the state transition table, follow these steps:
- Select a cell in the state transition table and do one of the following:
- Click [Add state...] in the context menu.
- State transition table Click the [+] button displayed on the top toolbar.
- In the Add State dialog that appears, enter the name of the state you want to add and confirm.
- A new state with the name entered in 2. will be added to the row below the selected cell.
- A state is added with the same type of element as the row element of the selected cell (start, entry point, state, history, etc.).
- If you want to add a sub-state, you can do so by selecting [Add sub-state...] from the context menu and following the same steps as above.
- If you want to delete a state, select the cell in the row you want to delete and do one of the following:
- Click [Delete state] in the context menu.
- State transition table Click the [-] button displayed on the top toolbar.
- Press the Delete key.
- If there is no state definition row, you cannot add a state in the [State Transition Table] view.
Switch to the [State Machine Diagram] view and add according to [Define a state](#Define a state).
Define the trigger
To define a trigger on a state transition table, follow these steps:
- Select a cell in the state transition table and click [Add Trigger...] on the context menu.
- The Add Trigger dialog will appear; enter the name of the trigger you want to add and confirm.
- A new trigger with the name entered in 2. is added to the column to the right of the selected cell.
- If you want to delete a trigger, select the cell in the column you want to delete and select [Delete trigger] from the context menu.
- If there is no trigger column defined, you cannot add a trigger in the [State Transition Table] view.
Switch to the [State Machine Diagram] view and add it according to [Define a transition > Add a trigger to a transition](#Add a trigger to a transition).
Define transitions
To define transitions in the state transition table, follow these steps:
- Select a cell in the state transition table and click [Change transition destination...] on the context menu.
- Follow the dialog that appears to select the state you want to transition to.
- A transition is added to the selected cell.
- If the selected cell already has a transition defined, delete the existing transition before adding the transition.
Please note that field values (guards, effects, behaviors, etc.) set for transitions will be deleted.
:::note
- If you want to add a note to a transition, please do one of the following:
- For Ignore: Click [Ignore] on the context menu.
- If Not Happen: Click [Make Not Happen] on the context menu.
- If you want to delete a transition, select the cell of the transition you want to delete and delete it from [Clear cell value (L)] in the context menu.
:::
- Cells with transitions defined are highlighted.
If you want to change the type of cell to be emphasized, you can do so from the drop-down list on the toolbar at the top of the state transition table. - This setting is saved for each user.
Add a transition
To add a transition in the state transition table, follow these steps:
- Select a cell in the state transition table and click [Add transition destination...] on the context menu.
- Follow the dialog that appears to select the state you want to transition to.
- A transition is added to the selected cell. This operation preserves existing transitions.
When you enter text into a transition cell in the state transition table, the text is analyzed according to the notation format and reflected in each field value of the transition.
Of course, if you change each field value, it will be reflected in the text on the diagram.
Correspondence between transition text notation format and each field value
Transitions are displayed and parsed as text according to the following format:
-
Format:
<text> ::= <transition> [ <newline> <transition> ] *
-
<transition>
is displayed in the following format.<transition> ::= ['['<guard>']'] <name of destination state>
-
Example: If one trigger has two conditional transitions, the text will be displayed as follows:
- Transition 1:
- Name of destination state:
Cleaning
- Guard:
t>1
- Name of destination state:
- Transition 2:
- Name of transition state:
Driving
- Guard:
t<=1
- Name of transition state:
- Text display
[t>1]Cleaning <line break>[t<=1]Driving
- Transition 1:
-
supplement
- If
<name of transition destination state>
is not found in the selected state machine diagram, an error will be notified in the [Information Window] > [Output] tab > [State Transition Table] category.
Please make corrections as necessary based on the error details. - If you delete a state, the
<transition>
that defined that state as<transition destination state name>
will be deleted. - Depending on the IME you are using, if you confirm the string conversion status while editing a cell, the editing status of the cell will also be finalized.
To avoid this phenomenon, please switch the IME. We have confirmed that this phenomenon does not occur with Microsoft IME.
- If
-
Copy and paste transitions
To copy and paste transitions in the state transition table, follow these steps:
- Select the transition cell you want to copy.
- Copy the selected cell with ctrl+c.
- Select the cell where you want to paste the transition and press ctrl+v to paste the copied transition.
When selecting the cells of the transition you want to copy, hold down ctrl and click the cells to select multiple cells to copy and paste them all at once. I can.
Check transition details
To check the transition details in the state transition table, follow the steps below.
- Select the cell in the row whose state you want to check the transition.
- Click View > Pane > Inspector from the ribbon to display the Inspector.
- Make sure Transitions is selected in the tab at the top of the inspector, or click to select it.
- The Inspector displays the transitions that the row state of the selected cell has and its fields.
You can check detailed information on the next transition in the state transition table.
Field Name | Summary |
---|---|
Trigger | Name of the trigger that the transition refers to |
Guard | Transition Guard |
Effect | Transition Effect |
Transition Behavior | Name of the transition behavior owned by the transition |
- If you change the trigger or transition behavior text box, the name of the owned/referenced model will be changed.
Please note that the owned/referenced model will not be replaced.
Set display content
You can display only the information of interest in the state transition table without changing the model.
To hide transitions that do not have triggers defined:
- Click the [Show no triggers] button on the toolbar at the top of the state transition table.
- The column transition for the trigger<None> is hidden.
- This setting is saved for each user.
Export to Excel
To export the state transition table to Excel, follow the steps below.
- Click the [Export to Excel] button from the toolbar at the top of the state transition table.
- Decide where to export the Excel file in the Export to Excel dialog and save it.
Validate the model
The contents verified by the state machine diagram are as follows.
- Is there a transition that ends at the initial state?
- Is there a transition starting from the end state?
To validate your model, follow these steps:
- Run UML > Validation > Check Consistency from the ribbon.
- If an invalid transition is detected for all models under the project, an error will be displayed.
Click the [Home] > [Model] > [Check Error] button on the ribbon to perform validation on all models in addition to the standard validation.
Also, when you add a new transition on the state machine diagram, the added transition will be checked in real time.
Set display content
You can display only the information you are interested in in a state machine diagram without changing the model.
To configure the display content of transition behavior, follow the steps below.
- Display the state machine diagram whose display you want to switch.
- Select the behavior checkbox in the [Transition] group on the [UML Diagram] tab in the Inspector.
You can switch the display of the following elements in the state machine diagram.
Category | Element |
---|---|
Common | Stereotype |
State | Behavior |
Transition | Guard |
Behavior |
Restrictions
- If the display scale in the display settings is set to a value greater than 100%, some text in cells in the state transition table may be cut off.
- Concurrent states cannot be defined.
- Status areas, list displays, and functions cannot be expressed or described.
- Subsystem status is different from the UML standard notation, and the status name is underlined.
- Underline cannot be specified in the state name style. When the state is submachine, it is automatically underlined.
- When switching the checkbox in the [Transition] group on the [UML Diagram] tab in the Inspector, the displayed content is not updated immediately. After displaying another view, displaying the state machine diagram again will update the displayed content.
- The following values are reserved words. May be misinterpreted when used in state names or guards.
- String containing "[" (open half-width parenthesis) and "]" (close half-width parenthesis)
- I
- N
- In the state transition table view, if the matrix has a large number of elements, it may take time to respond when displaying or editing. Please use layers as necessary.
- When performing clipboard operations (copy, cut, paste) in the state transition table view, use the buttons on the toolbar at the top of the state transition table, not the [Home] > [Clipboard] button on the ribbon.
- Documentation is not generated for state transition table views.
- Even if you execute [Export to Excel] on the toolbar of the state transition table view, the alignment of cell contents (direction of arrangement) and cell color will not be reflected in the output Excel file.
- Only supports state transition tables where the state is a row and the trigger is a column. It does not support state transition tables where the trigger is a row and the state is a column, or state transition tables where the previous state is a row and the next state is a column.
- Notes cannot be set on non-trigger columns in the state transition table view.
- If a state or trigger is added or deleted in a view other than the state transition table while the state transition table is displayed, the displayed contents in the state transition table will not be updated immediately. It is updated by clicking [Update] on the toolbar or by displaying the state transition table again after displaying another view.
- If you edit the attributes (trigger, guard) of a newly added transition while displaying the state transition table in a view other than the state transition table, the contents displayed in the state transition table will not be updated immediately. It is updated by clicking [Update] on the toolbar or by displaying the state transition table again after displaying another view.
- Immediately after adding a state with [+] on the state transition table toolbar, you cannot create a transition to that state by editing the text of the cell. Please use [Change transition destination...] from the cell's context menu.
- If there is a unique class model derived from a metamodel related to state machine diagrams (state machine diagrams, state bases, triggers), the state transition table view cannot be displayed correctly.
- If a child element of a state machine diagram has an unloaded model, the state transition table view cannot be displayed correctly.
- State names must be unique in state transition table views. If the same name is used in multiple states, the transition may be misidentified.
- If multiple triggers are assigned to a transition, the transition may be misidentified in the state transition table view.
- For advanced future enhancements, view definitions for state transition tables can be added from the context menu of various navigators or from the ribbon.
- Please do not use this as it is a reservation function.