当前位置:网站首页>UML 状态图
UML 状态图
2022-07-07 12:12:00 【sinat_36789271】
一、状态图
类定义的是一组对象的抽象,而每个对象时类的一个实例,但对于一个对象而言,它在其整个生命周期中有一系列的状态。状态描绘了对象的动态生命周期。
“人” 就是一个类,而“你”、“我”、“张三” 等都是“人”这个类的一个实例,“站着”、“躺着”等都是对象的一个状态。
在对象的整个生命周期中,它的状态是会发生变化的,而状态机就是用来表示一个对象在它的生命周期中响应的时间所发生的状态变化以及对事件的响应。
二、组成元素、状态机
状态机是一个对象的局部视图、一个将对象与其外部世界分离开来并独立考查其行为的视图。状态机是精确描述行为的一种好办法。
如描述烧水器在工作时的详细行为细节:

状态:是指在对象生命周期中满足某些条件、执行某些活动或等待某些事件的一个条件和状况。
开始状态
结束状态
命名状态 
在一张状态机图中,最为核心的元素无外乎有两个:一个是用圆角矩形表示的状态;另一个是在状态之间、包含一些文字描述的有向箭头线,这些箭头成为转换。
一个转换是两个状态之间的一种关系,表示对象将在第一个状态中执行一定的动作,并在某个特定事件发生时且满足条件时进入第二个状态。
三、如何绘制状态图
绘制状态图的理想步骤:寻找主要的状态、确定状态之间的转换,细化状态内的活动与转换,用复合状态来展开细节
1、寻扎主要状态
在绘制状态机图时,最重要的一个活动就是寻找出主要的状态。对于航班机票预订系统而言,显然包括的状态主要有:
a、在确定飞行计划时,显然是没有任何预订的,并且在有人预订机票之前都将处于这种“无预订”状态
b、对于订座而言,显然有“部分预订”和“预定完”两种状态
c、当航班快要起飞时,显然要“预订关闭”
总结:有四种状态:无预定、部分预订、预定完和预订关闭
2、确定状态之间的关系
确定主状态之后分析状态之间的转换,画出相应的状态机图

边栏推荐
- [fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
- Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
- mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
- Help tenants
- c#通过frame 和 page 切换页面
- Leecode3. Longest substring without repeated characters
- 云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
- Flask session forged hctf admin
- Vmware共享主机的有线网络IP地址
- [1] Basic knowledge of ros2 - summary version of operation commands
猜你喜欢

The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)

Help tenants

数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】

"New red flag Cup" desktop application creativity competition 2022

2022-7-6 beginner redis (I) download, install and run redis under Linux

Battle Atlas: 12 scenarios detailing the requirements for container safety construction

TPG x AIDU | AI leading talent recruitment plan in progress!

Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
![SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1](/img/10/6de1ee8467b18ae03894a8d5ba95ff.png)
SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1

Vmware 与主机之间传输文件
随机推荐
为租客提供帮助
Realize the IP address home display function and number home query
mysql ”Invalid use of null value“ 解决方法
Supply chain supply and demand estimation - [time series]
AutoCAD - how to input angle dimensions and CAD diameter symbols greater than 180 degrees?
FCOS3D label assignment
请问,我kafka 3个分区,flinksql 任务中 写了 join操作,,我怎么单独给join
How to check the ram and ROM usage of MCU through Keil
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
【日常训练--腾讯精选50】231. 2 的幂
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
2022-7-6 Leetcode 977. Square of ordered array
参数关键字Final,Flags,Internal,映射关键字Internal
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
PC端页面如何调用QQ进行在线聊天?
postgresql array类型,每一项拼接
requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
call undefined function openssl_ cipher_ iv_ length
Dry goods | summarize the linkage use of those vulnerability tools
ndk初学习(一)