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

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

边栏推荐
- 作战图鉴:12大场景详述容器安全建设要求
- Laravel Form-builder使用
- Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
- mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
- requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
- Dry goods | summarize the linkage use of those vulnerability tools
- Parsing of XML files
- Attribute keywords aliases, calculated, cardinality, ClientName
- MySQL "invalid use of null value" solution
- Excellent open source system recommendation of ThinkPHP framework
猜你喜欢

js 获取当前时间 年月日,uniapp定位 小程序打开地图选择地点

Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)

Realize the IP address home display function and number home query

使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )

得物客服热线的演进之路

2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers

最长上升子序列模型 AcWing 482. 合唱队形
![[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?](/img/fb/17e029b1d955965d7e2e0f58701d91.png)
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
![供应链供需预估-[时间序列]](/img/2c/82d118cfbcef4498998298dd3844b1.png)
供应链供需预估-[时间序列]

docker部署oracle
随机推荐
Build a secure and trusted computing platform based on Kunpeng's native security
Common response status codes
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
Redis只能做缓存?太out了!
AI talent cultivation new ideas, this live broadcast has what you care about
Navicat run SQL file import data incomplete or import failed
Laravel Form-builder使用
Laravel form builder uses
[daily training] 648 Word replacement
Evolution of customer service hotline of dewu
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
现在网上开户安全么?那么网上开户选哪个证券公司?
为租客提供帮助
【AI实战】应用xgboost.XGBRegressor搭建空气质量预测模型(二)
Excusez - moi, l'exécution a été réussie lors de l'utilisation des données de puits SQL Flink à Kafka, mais il n'y a pas de nombre dans Kafka
Dry goods | summarize the linkage use of those vulnerability tools
Wired network IP address of VMware shared host
Xshell connection server changes key login to password login
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Beginner XML