![](/img/trans.png)
[英]How to generate UML diagrams (especially sequence diagrams) from Java code?
[英]How to call complete internal flows multiple times in Sequence Diagrams
活動圖和序列圖不應該是等價的。 兩者都設置了不同的焦點(流程與交互),因此您可能必須通過識別更高級別的結構來進行映射。
在這里,您顯然有一個循環:
您可以用偽代碼重新編寫為: REPEAT action 1 and action 2 UNTIL action 2 passes
,這是一個最終進行測試的循環。 您可以進一步將此循環重寫為: Last did not passed; WHILE last did not pass, DO action 1 and action 2
Last did not passed; WHILE last did not pass, DO action 1 and action 2
,或者WHILE true DO action 1 and action 2 and BREAk if it succeeds
。
現在您可以使用循環片段在序列圖中實現此行為。 該片段將包含動作 1、動作 2 和成功測試,在循環之后,將出現成功案例的交互。 嵌套使得重復什么和不重復什么變得非常明確。 例如,一些變體:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.