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 how to implement the UML state diagram of the UML modeling tool. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Brief introduction of UML state diagram (Briefintroduction)
State diagram (StatechartDiagram) 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 (StateMachineDiagram), 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 guardcondition, for example, it will respond to events only if the doorWay- > isEmpty condition is met.
2. UML state diagram elements (StateDiagramElements)
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
Initial state and final state (InitialandFinalStates)
The initial state is represented by solid dots and the final state is represented 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 (SourceState) and enter the target state (TargetState) 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 (achangeinsomecondition), and time expression.
Police boundary condition (GuardCondition): 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 (StateActions)
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 of the object state transfer is displayed on the transfer line. If there are many transitions in the target state, and each transfer has the same result, it is better to display the transferred result (Effect) in the target state (TargetState). You can define the EntryAction and ExitAction.
4. Self-transfer (Self-Transitions)
A state can have a transition that returns its own state, which is called Self-Transitions.
After 2s, the Pollinput event is executed and transferred to its own state [Waiting]
5. Combination status (CompoundStates)
A state nested in another state is called a sub-state, and a state containing a substate is called a CompoundStates. As shown in the figure below, [CheckPIN] is a combined state and [EnterPIN] is a sub-state.
It can also be described in the following way, where the details of the state machine [CheckPIN] are split into another diagram.
6. Enter the node (EntryPoint)
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 (EntryPoint).
7. Exit node (ExitPoint)
8. Historical status (HistoryStates)
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 above, the normal order of states is [Washing]-> [Rinsing]-> [Spinning].
If you exit from the state [Rinsing] sudden power outage (PowerCut), the washing machine stops working and goes into the state [PowerOff] and directly into the state [Running] when the power is restored.
9. Concurrency region (ConcurrentRegions)
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 [ApplyingFrontBrakes] state and the rear brake [ApplyingRearBrakes] state.
III. Summary (Summary)
State diagram focuses on describing the state of objects and the transition between them. The basic elements of UML state diagram are: state, transition, action, self-transfer, combination state, entry node, exit node, historical state, concurrent area and so on. The events in the state are divided into call events (Call), change events (Change), Time events and signal events (Singal). * * analyze the status pair with an example.
Thank you for reading! This is the end of the article on "how to realize the UML state diagram of UML modeling tools". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
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.