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 is about sample analysis of UML state diagrams in UML modeling. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
UML State Diagrams in UML Modeling
UML State Diagram (Brief Introduction)
UML State Diagram is mainly used to describe the dynamic behavior of an object during its lifetime, which is represented by the state sequence experienced by an object, the events causing state transition, and the actions accompanying state transition. Generally, a state machine can be used to model the life cycle of an object. UML state diagrams are used to show the state machine (StateMachineDiagram), focusing on describing the control flow of UML state diagrams. As shown in the example below, the state machine describes the state sequence of the door object during its lifetime, the events that cause the transition, and the actions that accompany the state transition.
The states are Open, Closed, and Locked.
Events are Open, Close, Lock and Unlock.
Note:
1. Not all events will cause state transition, for example, when the door is in the [Open] state, the [Lock] event cannot be performed.
Transition has a guard condition, such as responding to an event only if the doorWay->isEmpty condition is met.
UML StateDiagramElements
1. Status (States)
A condition or condition in the life cycle of an object during which the object will satisfy certain conditions, perform certain activities, or wait for certain events. All objects have a state, which is the result of a series of activities performed by the object, and when an event occurs, the state of the object changes.
The states are represented by rounded rectangles
Initial and Final States Initial states are indicated by solid dots and final states by circular embedded dots.
2. Transitions
Transitions is a relationship between two states, indicating that an object will perform certain actions in the Source State and enter the Target State when a specific event occurs and a specific threshold condition is satisfied.
Trigger: The trigger for a transition, which can be a signal, event, achangeinsomecondition, or time expression.
GuardCondition: When the GuardCondition is satisfied, the event will trigger Transition.
Effect: The result of the object state transition.
3. Actions (StateActions)
An action is an atomic operation that can be executed, that is, an action is non-interruptible and its execution time is negligible.
In the above example, the result of the object state transition is displayed on the transition line. If there are many transitions in the target state, and each transition has the same result, it is better to display the effect after the transition in the target state (TargetState). You can define the Entry Action and Exit Action.
Self-transitions (Self-Transitions)
States can have transitions back to their own state, called self-transitions.
After 2S, Pollinput event is executed, transition to self state [Waiting]
5. Compound States
A state nested within another state is called a sub-state, and a state containing sub-states is called a compound state. As shown in the figure below, CheckPIN is the combination state, and EnterPIN is the child state.
6. Entry Point
For some reason, initialization is not performed, but a node directly enters the state [Ready], then this node is called an Entry Point.
7. Exit Point
8. HistoryStates
A historical state is a pseudostate, the purpose of which is to remember the substate in which you exit from the combined state, and to enter this substate directly when you re-enter the combined state, rather than starting from the initial state of the combined state again.
If it is from the state [Rinsing] sudden power cut (PowerCut) exit, the washing machine stops working into the state [PowerOff], when the power is restored directly into the state [Running].
9. ConcurrentRegions
UML state diagrams can be divided into regions, which in turn include exit or currently executing sub-states. It shows that the combined state can reach several sub-states at the same time. As shown in the figure below, the brake system enters the state of Applying Front Brakes and Applying Rear Brakes at the same time.
Thank you for reading! About "UML modeling UML state diagram sample analysis" this article is shared here, I hope the above content can be of some help to everyone, so that we can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.