gpt4 book ai didi

uml - 创建显示自动展台所有状态的 UML 状态机图

转载 作者:行者123 更新时间:2023-12-05 04:21:50 24 4
gpt4 key购买 nike

我从未创建/完全理解如何根据详细描述创建状态机图,所以我想从某个地方开始。自动摊位供学生自动还书。

描述:

To return a book, it must be placed on a small conveyor belt and then the user needs to press the check-in button on the touch screen.

The chip reader in the machine then detects which book is being returned.If no book is detected, the conveyor belt returns the item to the user. If a book is detected, the screen displays all the loan information on the screen and the user can confirm the return or cancel it.

If cancelled, the book is returned to the user. If confirmed, the book is taken into the library and the booth prints a physical receipt for the user. Additionally, the machine has a maintenance mode; no books can be returned until the maintenance is completed.

示意图: enter image description here

我不确定我是否描述了机器具有的所有状态,或者我是否从根本上遗漏了状态机图规则的指导方针。我将不胜感激任何反馈,因为我仍在学习。

最佳答案

在大多数情况下,状态是指没有任何事情发生并且机器正在等待外部事件发生的情况。然后,该事件可能是去另一个州的理由。沿着转换箭头,您编写 event [ condition ]/action。在您的情况下,event 是用户执行的操作,action 是机器响应事件执行的操作。

机器等待的状态在您的情况下是:“空闲”、“显示贷款信息”和“维护”。虽然“停止服务”和“自检”看起来是合乎逻辑的状态,但描述中没有提到它们,所以我不会包括它们。

在某些情况下,您可能希望使用状态来反射(reflect)机器正在忙于做某事的情况。 事件 可能是工作完成或外部中断。在你的例子中,Scan for book 可能是这样一种状态,但你也可以将扫描视为一个 Action ,例如 user presses button/scan for book

这两个选项都有效,但让我们选择 Scan for book 作为状态(尽管我认为“Busy scanning”会是一个更像状态的名称)。

根据描述,我假设当用户按下按钮时机器从Idle 变为Scan for book。因此,我会写用户按下登记按钮,而不是请求预订[按下登记按钮]

状态 Scan for book 当机器完成扫描时离开。沿着指向决策菱形的箭头,您可以编写 finished scanning。如果是有效图书,则机器会显示借出信息,并进入状态借出信息显示。这个转换是[valid book]/display loan information。或者,您可以将 display loan information 编写为 Loan information displayed 状态中的 entry 操作。

如果该项目无效,机器将退回该项目。转换是 [else]/return item,这个转换从菱形到 Idle 状态。

以同样的方式,您可以对 IdleMaintenance 之间以及 IdleLoan information displayed 之间的转换进行建模>.

关于uml - 创建显示自动展台所有状态的 UML 状态机图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74145304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com