UML Learning-State diagram

Source: Internet
Author: User

1. Overview of the state diagram

A state diagram (Statechart Diagram) is primarily used to describe the dynamic behavior of an object during its lifetime, as a sequence of states experienced by an object, an event that causes state transitions, and an action (action) that is accompanied by a state transition. It is generally possible to model the life cycle of an object with state machines, and state diagrams are used to display state machines (Diagram), with emphasis on the control flow that describes the state diagram.
As an example, the state machine describes the state sequence of the gate object during its lifetime, the event that caused the transfer, and the Action (action) that accompanies the state transition.

2. State diagram elements

1. Status (States)

Refers to a condition or condition in the life cycle of an object in which the object satisfies certain conditions, performs certain activities, and waits for certain events alive. All objects have a state, and the state is the result of a series of activities that the object performs, and when an event occurs, the state of the object changes.

States are represented by rounded rectangles

Initial state and final state (Initial and final states)
The initial state is represented by a solid dot, and the final state is represented by a circular inline dot.

2. Transfer (Transitions)

A transfer (transitions) is a relationship between two states that indicates that an object will perform certain actions in the source state (in the original) and enter the target state when a particular event occurs and a particular policing condition is satisfied.

Event marker (Trigger): Is the inducement of a transfer, which can be a signal, event, condition Change (a-in some condition) and time expression.

Policing conditions (Guard Condition): When the police condition is met, the event will not cause a transfer (Transition).

Result (Effect): The result of the object's state transition.

3. Actions (State actions)

An action is an executable atomic operation, which means that the action is non-interruptible and its execution time is negligible.

In the example above, the result of the object state transition is displayed on the transfer line, if the target state has many transitions, and each transfer has the same result, then the transferred result (Effect) is better displayed in the target State (target), which defines the Enter action (Entry Action) and exit action (exit action)

4. Self-Transfer (self-transitions)

The state can have a transition back to its own state, called the self-Transfer (self-transitions) 2S, after the Poll input event is executed and transferred to its own state "waiting"

5. Combined State (Compound states)

A state that is nested in another state is called a sub-state (sub-state), and a state with a child state is called a combined state (Compound states). For example, "Check pin" is a combined state, and "Enter pin" is a child state. can also be described in the following ways

6. Enter the node (Entry point)

As shown, for some reason it does not perform initialization (initialization), but instead goes directly through a node into the state "ready", then this node is called the entry node (Entry point)

3.EA State Diagram Analysis

It is a state diagram of an ATM withdrawal drawn with an EA.


UML Learning-State diagram

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.