15. State Transition Diagrams

<< Previous Table of Contents   |   Detailed Index Next >>
1. State Machine in a flowchart

-   A rectangular border is drawn around the sequence of statements that correspond to a state.

-   One or more statements in a state can trigger a transition to another state. A transition is shown by     drawing an arrow from that statement to the border of destination state.

-   You can attach a comment or a note to a transition arrow.

2. State Machines as a switch-case

Often a state machine is coded in the form of a switch-case

      Expanding and collapsing a switch

-   Double-click on a switch symbol to collapse the whole switch to a high-level symbol.

-   Right-click on the high-level symbol, then click <Expand Symbol> in the pop-up menu. The switch will be     fully expanded.

-   Double-click on the high-level symbol to expand the switch by two levels

3. Create a State Transition - process

To create a State Transition Diagram:

-   Enclose each state in a rectangular border

-   Create a State Transition

-   Change the routing of a State Transition

-   Provide a comment to a State Transition

      Enclose each state n a rectangular border

To mark only a few cases as states :

-   Right-click on the desired case symbol.

-   Click : State Diagrams→Mark as State

In general, you can also right-click on a for, while, do, if symbol and mark the whole body as a state.

You can also mark all cases as a state in one go.

      Create a State Transition

-   Identify statement which causes a transition to another state (trigger statement).

-   Right-click in the trigger statement symbol, then click: State Diagrams→Create Transition.

-   In the "Flowchart State Transition" dialog box, specify the resulting state.

-   Then, provide a comment that will be attached to the transition arrow

      Change the routing of a State Transition

-   Right-click on the symbol which contains the trigger statement.

-   Click: State Diagrams→Transition Route

-   In the "Flowchart Transition Route" dialog, change the "From" and "To" settings.

      Provide a comment to a State Transition

-   Right-click in the symbol that contains the trigger statement.

-   In the pop-up menu, click : State Diagrams→Add Comment to Transition

4. Modifying the comment in a State Transition

-   Right-click in the comment attached to the State Transition

-   Click : State Diagrams→Transition Comment Properties

-   Provide the new comment there!

5. Display the State Transition with a desired detail level

-   Right-click on the switch symbol, then click: State Diagrams?Collapse All Cases.

-   Double-click in the switch symbol to collapse the switch.

-   Double-click in the high-level symbol. The switch is expanded to two-levels of detail.

-   Double-click in the switch symbol to collapse the switch.

-   Right-click in the switch symbol, then click Expand Symbol. You get a fully expanded State Transition     Diagram.

6. To save the State Transition Diagram

To save the State Transition Diagram :

-   Right-click anywhere in the flowchart window.

-   In the pop-up menu, click: State Diagrams→Save & Close Flowchart.

<< Previous Table of Contents   |   Detailed Index Next >>