Skip to main content

State machine diagram/State transition table

Overview

State machine diagrams can be used to describe the state and behavior of systems and classes. In addition to state machine diagrams, state transition tables can also be used, allowing seamless design while switching between state machine diagrams and state transition tables. In the state transition table, you can highlight where there are transitions, where there are no transitions, and see which transitions don't have triggers defined. And by noting information that the trigger should be ignored or not possible instead of the transition, you can design without omission.

On this page, the operations for using state machine diagrams and state transition tables are explained in the following order.

  • Place the state machine diagram
  • define the state
  • define transitions
  • Describe design information in state transition table

It also provides the following features to assist in user modeling: These will also be explained in order.

  • Validate the model
  • Set the display contents

State machine diagram

Place the state machine diagram

To place the state machine diagram, do the following:

Place State Machine Diagram

Operation procedure
  1. Select a package in the model navigator and click Add Model> State Machine Diagram in the context menu.
  2. The state machine diagram is placed on the child elements of the selected package.
caution

In the current version, if the display scale in the display settings is set to a value greater than 100%, some cell text in the state transition table may be cut off. To avoid this phenomenon, set the display scale in the display settings to 100%. See here for other restrictions.

Define state

To define the state, do the following:

Define State

Operation procedure
  1. Drag and drop State from the toolbox onto the displayed state machine diagram.
  2. A new state is added as a child element of the displayed state machine diagram or state.
Elements that can be added from the toolbox

In the state machine diagram, you can place the following elements displayed in the toolbox.

IconName
StateState
Entry pointEntrance point
Exit PointExit Point
StartStart
ExitExit
HistoryHistory
MergeCombine
SelectSelect
ParallelParallel
JoinJoin
NoteNote
LabelLabels
ShapeShape

The entrance and exit points are arranged as port shapes of the following elements.

  • situation
Add behavior to state

To add input processing, follow the procedure below.

Add processing at the time of input

Operation procedure
  1. Select a state.
  2. Double-click the Behavior> Input Processing field in the Property inspector to enter the edit state.
  3. When you describe the input process and confirm the edit, the input process is set in the state and the input process is displayed on the state machine diagram.
About the text notation of state behavior

When you enter text in the body of a state on a state machine diagram, it is parsed 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 figure.

Edit Behavior

Correspondence between state behavior, text notation format and each field value
The behavior for the state is displayed and analyzed as text according to the following format.

  • format:
    <Behavior> :: = ['entry/'<Entry processing>] ['\n'] ['do/'<Stay processing>] ['\n'] ['exit/'<Exit processing> >]

    • example
      Admission processing: set display on
      Stay-time processing: show distance
      Exit processing: set display off
      In the case of, the following text will be displayed.
      entry/set display on
      do/show distance
      exit/set display off
Add a stereotype to the state

To add a stereotype, do the following:

Add stereotype

Operation procedure
  1. Select a state.
  2. Click the Add button in the Basic information> Stereotype field in the Property inspector to see the choices.
  3. Select a stereotype and press the [OK] button to set the stereotype to the state and display the stereotype on the state machine diagram.
tip

Stereotype choices can be defined in the Detail view of the package model.

tip

You can edit the added stereotype from the state machine diagram by following the steps below.

  1. Double-click the stereotype displayed in the status to enter the edit status.
  2. If you change the stereotype and confirm the edit, it will be reflected on the state machine diagram and the stereotype of the state will be changed.

Define a transition

To define the transition between states, do the following:

Define Transition

Operation procedure
  1. Move the pointer over the state that is the starting point of the transition.
  2. Drag the [β–²] icon displayed on all sides of the state and drop it on the state that will be the end point of the transition.
Add a trigger to the transition

To add a trigger, do the following:

Add Trigger

Operation procedure
  1. Select a transition.
  2. Click the Add button in the Basic information> Trigger field in the Property inspector to see your choices.
  3. Select a trigger and press the [OK] button to set the trigger for the transition and display the trigger on the state machine diagram.
About the text notation of transition

When you enter text in the transition label on the state machine diagram, it is parsed 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 figure.

Edit Trigger

Correspondence between transition text notation format and each field value
The transition is displayed and analyzed 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 the case of, the following text will be displayed.
      close [doorway-> isEmpty ()]/closed
Add stereotypes to transitions

To add a stereotype, do the following:

Add stereotype to transition

Operation procedure
  1. Select a transition.
  2. Double-click the grayed out [<< stereotype>>] to enter the edit state.
  3. When you enter the stereotype you want to set, the stereotype is displayed in the transition of the state machine diagram, and the stereotype is set in the transition.

Define design information in the state transition table

Show state transition table

Follow the steps below to display the state machine diagram design information in the state transition table.

Show state machine diagram with state transition table

Operation procedure
  1. Switch the display of the editor to the [State Transition Table] view according to the following manual.
element displayed as state

The state transition table displays the following elements as states.

IconName
startstart
entry pointentry point
statestate
HistoryHistory
selectselect
parallelparallel
JoinJoin
junctionjunction
exit pointexit point
endend

The states are arranged in the order listed above. However, it will not align between the following elements:

  • Selection
  • Parallel
  • Merge
  • combine
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 be selected.

Define states

To define states in the state transition table, follow these steps:

states defined in state transition table

Operation procedure
  1. Select a state transition table cell and do one of the following:
    • Click [Add State...] in the context menu.
    • State transition table Click the [+] button displayed on the upper toolbar.
  2. In the Add State dialog that appears, enter the name of the state you want to add and confirm.
  3. A new state with the name entered in step 2 is added to the row below the selected cell.
note
  • The state is added with the same kind of elements as the row elements of the selected cell (start, entry point, state, history, etc.).
  • If you want to add a sub-state, you can add it from the context menu [Add Sub-state (U)...] in the same way as the above operation procedure.
  • 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 (D)] in the context menu.
    • State transition table Click the [-] button displayed on the upper toolbar.
    • Press the Delete key.

Defining Triggers

To define triggers in the state transition table, follow these steps:

Define a trigger in the state transition table

Operation procedure
  1. Select a cell in the state transition table and click [Add trigger (T)...] on the context menu.
  2. In the Add Trigger dialog that appears, enter the name of the trigger you want to add and confirm.
  3. A new trigger with the name entered in step 2 is added to the right column of the selected cell.
note
  • If you want to delete a trigger, select the cell in the column you want to delete and delete it from [Delete trigger (E)] in the context menu.

Define transitions

To define transitions in the state transition table, follow these steps:

Transitions defined in state transition table

Operation procedure
  1. Select a cell in the state transition table and click [Change transition destination (C)...] from the context menu.
  2. Select the transition destination state according to the displayed dialog.
  3. A transition is added to the selected cell.
caution
  • If the selected cell already has a transition defined, remove the existing transition before adding the transition. Please note that any field values ​​(guards, effects, behaviors, etc.) you have set for the transition will be removed.
note
  • If you want to add a note to a transition, please do one of the following:
    • For Ignore: Click [Ignore] in the context menu.
    • If it is not possible (NotHappen): Click [Disable (N)] in 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.
tip
  • Highlights the cell where the transition is defined. If you want to change the type of cell to be highlighted, you can do so from the drop-down list on the toolbar above the state transition table.
  • This setting is saved for each user.
Add transition

To add transitions in the state transition table, follow these steps:

add transition

Operation procedure
  1. Select a cell in the state transition table and click [Add Transition Destination (A)...] on the context menu.
  2. Select the transition destination state according to the displayed dialog.
  3. A transition is added to the selected cell. This operation preserves existing transitions.
About text notation for transitions

When text is entered into a transition cell in the state transition table, the text is parsed according to the notation format and reflected in each field value of the transition. Of course, changing each field value will be reflected in the text on the diagram.

edit transition

Transition text notation format and corresponding relationship with 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, it will be texted as:

      • Transition 1:
        • Name of transition destination state: Cleaning
        • Guard: t>1
      • Transition 2:
        • Destination state name: running
        • Guard: t<=1
      • text display
        • [t>1] cleaning <line feed> [t<=1] running
    • 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. Based on the content of the error, correct it as necessary.
      • If you delete a state, the <transition> that defined that state as <name of destination state> will be deleted.
      • Depending on the IME you are using, if you confirm the conversion status of the character string while editing the cell, the editing status of the cell will also be confirmed. To avoid this phenomenon, switch the IME.We have confirmed that this does not occur with Microsoft IME.
Copy and paste transitions

To copy and paste transitions in the State Transition Table:

copy and paste transitions

Operation procedure
  1. Select the transition cell you want to copy.
  2. Copy the selected cell with ctrl+c.
  3. Select the cell where you want to paste the transition and press ctrl+v to paste the copied transition.
tip

When selecting the transition cells you want to copy, hold ctrl and click on the cells to select additional 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.

Inspect transition details

Operation procedure
  1. Select the cell of the state row whose transition you want to check.
  2. Click View > Panes > Inspector from the ribbon to display the inspector.
  3. Make sure Transition is selected in the tabs at the top of the inspector, or click to select it.
  4. The inspector will show the transitions and fields of the selected cell's row state.
Listed fields

You can check the detailed information of the next transition in the state transition table.

Field nameSummary
TriggerThe name of the trigger that the transition refers to
guardstransition guards
EffectTransition Effect
transition behaviorname of the transition behavior owned by the transition
caution
  • Changing the Trigger, Transition Behavior textbox will change the name of the owning/referenced model. Please note that the owning/referenced model is not repositioned.

Set display contents

Only the information of interest can be displayed in the state transition table without modifying the model. To hide transitions that do not have triggers defined:

hide transitions with undefined triggers

Operation procedure
  1. Click the Show Triggerless button from the toolbar above the state transition table.
  2. Trigger <None> hides column transitions.
tip
  • This setting is saved for each user.

Export to Excel

To export the state transition table to Excel, follow the steps below.

Expot to Excel

Operation procedure
  1. Click the Export to Excel button from the toolbar above the state transition table.
  2. In the Export to Excel dialog, decide where to export the Excel file and save it.

Validate the model

The contents verified in the state machine diagram are as follows.

  • Is there a transition that ends in the initial state?
  • Is there a transition starting from the end state?

To validate your model, do the following:

Validate model

Operation procedure
  1. From the ribbon, run UML> Verification> Check Consistency.
  2. If an invalid transition is detected for all models under the project, an error will be displayed.
tip

Click the Home> Model> Check Error button on the ribbon to perform validation on all models in addition to standard validation. Also, when a new transition is added on the state machine diagram, the added transition is checked in real time.

Set the display contents

You can display only the information you are interested in in the state machine diagram without changing the model. To set the display content of the transition behavior, follow the procedure below.

Simple display of text

Operation procedure
  1. Display the state machine diagram for which you want to switch the display.
  2. Toggle the behavior check box in the Transition group on the UML Diagram tab of the Inspector.
Elements that can switch the display

You can switch the display of the following elements in the state machine diagram.

CategoryElements
CommonStereotype
StateBehavior
TransitionGuard
Behavior

Restrictions

  • If the display scale in the display settings is set to a value greater than 100%, some of the cell text in the state transition table may be cut off.
  • Parallel state cannot be defined.
  • State areas, list displays, and functions cannot be expressed or described.
  • Unlike the UML standard notation, the subsystem state is an underlined expression in the state name.
  • You cannot specify the underline in the style of the state name. When the status is a submachine, it is automatically underlined.
  • When you toggle the checkbox in the Transition group on the UML Diagram tab of the Inspector, the display is not updated immediately. After displaying another view once, the display contents are updated by displaying the state machine diagram again.
  • The following values ​​are reserved words. It can be misinterpreted when used in state names or guards.
    • Strings containing "[" (open half-width bracket), "]" (close half-width bracket)
    • I
    • N
  • If there are many matrix elements in the state transition table view, it may take time to respond when displaying or editing. Hierarchize and use as necessary.
  • When performing clipboard operations (copy/cut/paste) in the state transition table view, use the toolbar buttons at the top of the state transition table instead of the [Home] > [Clipboard] buttons on the ribbon.
  • The state transition table view is not documented.
  • Even if you execute [Export to Excel] in the state transition table view toolbar, the alignment of cell contents (arrangement direction) and cell color will not be reflected in the output Excel file.
  • Supports only state transition tables where state is row and trigger is column. A state transition table in which the trigger is a row and the state is a column, or a state transition table in which the previous state is a row and the next state is a column is not supported.
  • Notes cannot be set for the no-trigger column of the State Transition Table view.
  • Even if a state or trigger is added or deleted in a view other than the state transition table while the state transition table is being displayed, the display contents are not immediately updated in the state transition table. It is updated by pressing [Update] on the toolbar, or by displaying the state transition table again after displaying another view.
  • Even if you edit attributes (trigger, guard) of a newly added transition while the state transition table is displayed in a view other than the state transition table, the display contents are not immediately updated in the state transition table. It is updated by pressing [Update] on the toolbar, or by displaying the state transition table again after displaying another view.
  • Immediately after adding a state with the [+] in the state transition table toolbar, text editing in a cell fails to create a transition to that state. Please use [Change transition destination (C)...] in the context menu of the cell.
  • If there is a unique class model derived from a meta model (state machine diagram, state base, trigger) related to the state machine diagram, the state transition table view cannot be displayed correctly.
  • If there is an unloaded model in the child element of the state machine diagram, the state transition table view cannot be displayed correctly.
  • State names must be unique in the state transition table view. If the same name is used in multiple states, transitions may be misidentified.
  • If multiple triggers are assigned to a transition, the transition may be misidentified in the state transition table view.
  • For future advanced enhancements, state transition table view definitions can be added from the various navigator context menus and ribbons.
    • Please do not use it because it is a reservation function.