In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the UML state diagrams and their constituent elements". Interested friends may wish to take a look at them. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the UML state diagrams and their constituent elements.
1. Brief introduction of UML state diagram (Brief introduction)
State diagram (Statechart Diagram) is mainly used to describe the dynamic behavior of an object during its existence, such as the sequence of states experienced by an object, the events that cause state transitions (Event), and the actions accompanied by state transitions (Action). Generally, the life cycle of an object can be modeled by a state machine, and the state diagram is used to display the state machine (State Machine Diagram), focusing on the control flow that describes the state diagram. In the following figure example, the state machine describes the sequence of states during the lifetime of the door object, the events that cause the transition, and the actions that accompany the state transition (Action).
The states are Opened, Closed, Locked.
Events are Open, Close, Lock, and Unlock.
Note:
1. Not all events will cause state transfer, for example, when the door is in [Opened] state, the [Lock] event cannot be carried out.
2. Transition has a guard condition, for example, it will respond to events only if the doorWay- > isEmpty condition is met.
2. UML state diagram elements (State Diagram Elements)
1. Status (States)
Refers to a condition or condition in the life cycle of an object, during which the object will meet certain conditions, perform certain activities and wait for certain events. All objects have a state, which is the result of a series of activities performed by the object. When an event occurs, the state of the object will change.
The state is represented by a rounded rectangle
The initial state and final state (Initial and Final States) are represented by solid dots and final states by circular embedded dots.
2. Transfer (Transitions)
A transition (Transitions) in a UML state diagram is a relationship between two states, indicating that an object will perform an action in the source state (Source State) and enter the target state (Target State) when a particular event occurs and a specific police boundary condition is met.
Event marker (Trigger): is the trigger for transfer and can be a signal, event, conditional change (a change in some condition), and time expression.
Police boundary condition (Guard Condition): when the police boundary condition is met, the event will trigger a transfer (Transition).
Result (Effect): the result after the state of the object is transferred.
3. Action (State Actions)
The Actions in the UML state diagram is an executable atomic operation, that is, the action is uninterruptible and its execution time is negligible.
In the above example, the result after the object state transfer is displayed on the transfer line. If there are many transitions in the target state, and each transition has the same result, it is better to display the transferred result (Effect) in the target state (Target State). You can define Entry Action and Exit Action.
4. Self-transfer (Self-Transitions)
A state can have a transition that returns its own state, which is called Self-Transitions.
After 2s, the Poll input event is executed and transferred to its own state [Waiting]
5. Combination status (Compound States)
The state embedded in another state in the UML state diagram is called sub-state, and a state with sub-states is called Compound States. As shown in the figure below, [Check PIN] is a combined state and [Enter PIN] is a sub-state.
The details of the state machine [Check PIN] are split into another diagram.
6. Enter the node (Entry Point)
Due to some reasons, initialization is not performed (initialization), but enters the state directly through a node [Ready], then this node is called an entry node (Entry Point).
7. Exit node (Exit Point)
8. Historical status (History States)
The historical state is a pseudo state (Pseudostate), whose purpose is to remember the sub-state when exiting from the combinatorial state. When entering the combinatorial state again, we can directly enter this substate instead of starting from the initial state of the combinatorial state again.
In the UML state diagram in the figure above, the normal order of states is [Washing]-> [Rinsing]-> [Spinning].
If you exit from the state [Rinsing] sudden power outage (Power Cut), the washing machine stops working and goes into the state [Power Off] and directly into the state [Running] when the power is restored.
9. Concurrency region (Concurrent Regions)
UML state diagrams can be divided into regions, which in turn include sub-states that exit or are currently executed. It shows that the combined state can reach multiple sub-states at a certain time. The braking system is shown below, entering both the front brake [Applying Front Brakes] state and the rear brake [Applying Rear Brakes] state.
At this point, I believe you have a deeper understanding of "UML state diagram and its constituent elements". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.