plantuml 方法图_UML与软件建模:第四次作业(学习PlantUML活动图绘制方法)

@startuml

|Swimlane1|

start

:foo1;

|#AntiqueWhite|Swimlane2|

:foo2;

:foo3;

|Swimlane1|

:foo4;

|Swimlane2|

:foo5;

stop

@enduml

43ef69271283bb2239d134162de18d9d.png

(12)分离(detach)

可以使用关键字detach移除箭头。

@startuml

:start;

fork

:foo1;

:foo2;

fork again

:foo3;

detach

endfork

if (foo4) then

:foo5;

detach

endif

:foo6;

detach

:foo7;

stop

@enduml

33370bfca08c469cb80cedf4efeaaeb0.png

(13)特殊领域语言(SDL)

通过修改活动标签最后的分号分隔符(;),可以为活动设置不同的形状。

|

<

>

/

]

}

@startuml

:Ready;

:next(o)|

:Receiving;

split

:nak(i)<

:ack(o)>

split again

:ack(i)<

:next(o)

on several line|

:i := i + 1]

:ack(o)>

split again

:err(i)<

:nak(o)>

split again

:foo/

split again

:i > 5}

stop

end split

:finish;

@enduml

bc8560f9bb9fe3f42fe909b02fecffa0.png

(14)一个完整的例子

@startuml

start

:ClickServlet.handleRequest();

:new page;

if (Page.onSecurityCheck) then (true)

:Page.onInit();

if (isForward?) then (no)

:Process controls;

if (continue processing?) then (no)

stop

endif

if (isPost?) then (yes)

:Page.onPost();

else (no)

:Page.onGet();

endif

:Page.onRender();

endif

else (false)

endif

if (do redirect?) then (yes)

:redirect process;

else

if (do forward?) then (yes)

:Forward request;

else (no)

:Render page template;

endif

endif

stop

@enduml

fcf88662768f0cc7730883d7df613b90.png

二、超市购物

流程:

顾客:选择自已所要购买的商品,并把选好的商品拿到收银台交给收银员。

收银员:询问顾客是否是会员,如果是会员,索要顾客的会员卡,把会员卡扫描进系统并对会员卡进行验证。然后逐一扫描顾客所 选商品的条形码。扫描完商品信息后,根据收款机上显示的商品金额收货款,售货单和商品交给顾客。

收款机:边接收商品条码,边累加商品金额,打印售货单。

@startuml

|顾客|

start

:选择商品;

:商品交给收银员;

|#AntiqueWhite|顾客|

if (是否是会员) then (yes)

:会员;

|收银员|

:扫描会员卡;

|#AntiqueWhite|收款机|

if (接收会员编号) then (yes)

:提示会员卡有效;

else (no)

:提示会员卡无效;

endif

else (no)

|顾客|

:非会员;

endif

|收银员|

:扫描商品条码;

|收款机|

:接收商品条形码;

:统计商品金额;

|收银员|

while (是否还有商品) is (yes)

|收银员|

:扫描商品条码;

endwhile (no)

|顾客|

:交付货款;

|收银员|

:接收货款;

|收款机|

:打印售货单;

|收银员|

:货单及货品交给顾客;

|顾客|

:接收货单及货品;

stop

@enduml

aea346476466b6c05b934eea1c48d026.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值