当前位置:网站首页>UML 状态图
UML 状态图
2022-07-07 12:12:00 【sinat_36789271】
一、状态图
类定义的是一组对象的抽象,而每个对象时类的一个实例,但对于一个对象而言,它在其整个生命周期中有一系列的状态。状态描绘了对象的动态生命周期。
“人” 就是一个类,而“你”、“我”、“张三” 等都是“人”这个类的一个实例,“站着”、“躺着”等都是对象的一个状态。
在对象的整个生命周期中,它的状态是会发生变化的,而状态机就是用来表示一个对象在它的生命周期中响应的时间所发生的状态变化以及对事件的响应。
二、组成元素、状态机
状态机是一个对象的局部视图、一个将对象与其外部世界分离开来并独立考查其行为的视图。状态机是精确描述行为的一种好办法。
如描述烧水器在工作时的详细行为细节:
状态:是指在对象生命周期中满足某些条件、执行某些活动或等待某些事件的一个条件和状况。
开始状态
结束状态
命名状态
在一张状态机图中,最为核心的元素无外乎有两个:一个是用圆角矩形表示的状态;另一个是在状态之间、包含一些文字描述的有向箭头线,这些箭头成为转换。
一个转换是两个状态之间的一种关系,表示对象将在第一个状态中执行一定的动作,并在某个特定事件发生时且满足条件时进入第二个状态。
三、如何绘制状态图
绘制状态图的理想步骤:寻找主要的状态、确定状态之间的转换,细化状态内的活动与转换,用复合状态来展开细节
1、寻扎主要状态
在绘制状态机图时,最重要的一个活动就是寻找出主要的状态。对于航班机票预订系统而言,显然包括的状态主要有:
a、在确定飞行计划时,显然是没有任何预订的,并且在有人预订机票之前都将处于这种“无预订”状态
b、对于订座而言,显然有“部分预订”和“预定完”两种状态
c、当航班快要起飞时,显然要“预订关闭”
总结:有四种状态:无预定、部分预订、预定完和预订关闭
2、确定状态之间的关系
确定主状态之后分析状态之间的转换,画出相应的状态机图
边栏推荐
- 最长上升子序列模型 AcWing 1012. 友好城市
- Regular expression integer positive integer some basic expressions
- Beginner XML
- 648. Word replacement: the classic application of dictionary tree
- Excuse me, I have three partitions in Kafka, and the flinksql task has written the join operation. How can I give the join operation alone
- Mysql怎样控制replace替换的次数?
- Wired network IP address of VMware shared host
- 请问,如图,pyhon云函数提示使用了 pymysql模块,这个是怎么回事?
- Excuse me, why is it that there are no consumption messages in redis and they are all piled up in redis? Cerely is used.
- [untitled]
猜你喜欢
Help tenants
Supply chain supply and demand estimation - [time series]
Realize the IP address home display function and number home query
Redis can only cache? Too out!
【立体匹配论文阅读】【三】INTS
Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
一个简单LEGv8处理器的Verilog实现【四】【单周期实现基础知识及模块设计讲解】
作战图鉴:12大场景详述容器安全建设要求
2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
How to check the ram and ROM usage of MCU through Keil
随机推荐
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
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
Cargo placement problem
Laravel form builder uses
Help tenants
Supply chain supply and demand estimation - [time series]
Cesium knows the longitude and latitude of one point and the distance to find the longitude and latitude of another point
postgresql array类型,每一项拼接
Parameter keywords final, flags, internal, mapping keywords internal
请问,redis没有消费消息,都在redis里堆着是怎么回事?用的是cerely 。
最长上升子序列模型 AcWing 1012. 友好城市
Oracle advanced (V) schema solution
ARM Cortex-A9,MCIMX6U7CVM08AD 处理器应用
最长上升子序列模型 AcWing 1014. 登山
566. Reshaping the matrix
The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
Realization of search box effect [daily question]
Cesium 已知一点经纬度和距离求另一个点的经纬度
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
Vmware共享主机的有线网络IP地址