Step by step UML modeling Series 4. State Diagram)

Source: Internet
Author: User

Overview

Statechart divisor is mainly used to describe the dynamic behavior of an object during its survival, as a sequence of States experienced by an object, and events that cause state transfer ), and actions that are accompanied by status transfer ). Generally, you can use a state machine to model the lifecycle of an object. A state chart is used to display the state machine digoal, focusing on and describing the control flow of a state chart.

 

State dimo-elements) 1. Status)

A condition or condition in the lifecycle of an object. During this period, the object will meet certain conditions and execute certain activities to wait for certain events. All objects are in a State. The State is the result of a series of activities executed by the object. when an event occurs, the state of the object changes.

The status is represented by a rounded rectangle.

 

Initial and final states)
The initial State is represented by a solid dot, and the final State is represented by a circular embedded dot.

2. Transfer (transitions)

Transitions is a relationship between two States, indicating that the object will execute certain actions in the source State, and enters the target State when a specific event occurs and a specific alert condition is met)

 

Trigger: an event is a transfer trigger. It can be a signal, event, a change in some condition, or a time expression. For example, approve

Result (effect): The result of object state transfer.

3. Action (State actions)

An action is an executable atomic operation. That is to say, an action cannot be interrupted and its execution time is negligible.

In the preceding example, the object status transfer result is displayed on the transfer line. If the target status has many transfers and each transfer has the same results, for example, the center hospital doctor has a forward diagnosis operation:

 

4. Self-transitions)

A status can be called self-transitions. For example, forward is a self-loop.

 

5. Decision)

It is determined to be represented by a small hollow diamond. A workflow is distributed here based on the value of the monitoring condition.

6. Concurrent regions)

The status chart can be divided into regions, and the regions include the exited or currently executed sub-states. It indicates that the combination status can reach multiple sub-states at the same time. For example, the brake system enters the applying front brakes status and the applying rear brakes status.

 

7. Historical Status:

The state machine describes the dynamics of an object. The current behavior of this object depends on the past.

Unless otherwise stated, when a conversion enters a combination state, the action of the nested state machine is in its initial state (unless the conversion target directly points to a substate ). However, in many cases, to model the state of an object, you need to remember the substate that is last active before leaving the composite state. For example, when modeling a computer backup proxy over a network, if it was interrupted (for example, it was interrupted by an operator's query ), remember where the process was interrupted.

 

Historical and historical pseudo states:

The history is a pseudo State. Only the history of the directly nested state machine is remembered;

The deep history pseudo State will remember the deepest nested state in any depth, expressed.

 

Next, let's look at a completed status chart.

 

Let's take a look at the effects drawn from visio:

 

It is more intuitive and easier to understand.

 

Summary) The state chart focuses on describing the state of the object and the transfer between States. The basic elements of the state chart mainly include: status, transfer, action, self-transfer, combination status, entry to node, exit node, history status, concurrent region, etc. Events in status are divided into call and change events) time and Singal ). Finally, an instance is used to analyze the status.

 

References:

Http://www.omg.org/UML

State chart (statechart di) for UML modeling of http://www.cnblogs.com/ywqu/archive/2009/12/17/1626043.html)

 

You are welcome to participate in the discussion. If you find it helpful, please clickRecommended. Thank you very much.

Author: Spring Yang

Source: http://www.cnblogs.com/springyangwc/

The copyright of this article is shared by the author and the blog. You are welcome to repost this article, but you must keep this statement without the author's consent andArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.

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.