Sixth uml

UML sixth operation: analysis system, FIG draw order

First, the operational requirements and procedures

step1: Learning sequence mapping method PlantUML

step2: the "factory procurement" system, for example, analysis of objects in the system message.

step3: Referring to FIG materials P148 8.5 page analysis of the interactive objects;

step4: use PlantUML "factory sourcing" object interaction script systems;

step5: online draw UML diagrams

First, the activity diagram syntax

Activities tab (activity label) begins with a colon, a semicolon ends the text format support creole wiki syntax. Default installation of the sequence of activities that define the line connection.

@startuml
:Hello world;
:This is on defined on
several **lines**;
@enduml

start end

You can use keywords startand stopstart and end indicate shown.

@startuml
start
:Hello world;
:This is on defined on
several **lines**;
stop
@enduml

You can also use  end keywords.

@startuml
start
:Hello world;
:This is on defined on
several **lines**;
end
@enduml

Conditional statements

In the illustration you can use keywords if, thenand elsesetting the test branch. The dimension text in parentheses.

@startuml

start

if (Graphviz installed?) then (yes)
  :process all\ndiagrams;
else (no)
  :process only
  __sequence__ and __activity__ diagrams;
endif

stop

@enduml

You can also use the keyword elseifset up multiple branches tests.

@startuml
start
if (condition A) then (yes)
  :Text 1;
elseif (condition B) then (yes)
  :Text 2;
  stop
elseif (condition C) then (yes)
  :Text 3;
elseif (condition D) then (yes)
  :Text 4;
else (nothing)
  :Text else;
endif
stop
@enduml

 

Repeat cycle

You can use keywords repeatand repeatwhilerepeat the cycle.

@startuml

start

repeat
  :read data;
  :generate diagrams;
repeat while (more data?)

stop

@enduml
while循环

可以使用关键字whileend while进行while循环。

@startuml

start

while (data available?)
  :read data;
  :generate diagrams;
endwhile

stop

@enduml

还可以在关键字endwhile后添加标注,还有一种方式是使用关键字is

@startuml
while (check filesize ?) is (not empty)
  :read file;
endwhile (empty)
:close file;
@enduml

并行处理

可以使用关键字forkfork againend fork表示并行处理。

@startuml

start

if (multiprocessor?) then (yes)
  fork
	:Treatment 1;
  fork again
	:Treatment 2;
  end fork
else (monoproc)
  :Treatment 1;
  :Treatment 2;
endif

@enduml

注释

文本格式支持creole wiki语法。

A note can be floating, using floating keyword.

@startuml

start
:foo1;
floating note left: This is a note
:foo2;
note right
  This note is on several
  //lines// and can
  contain <b>HTML</b>
  ====
  * Calling the method ""foo()"" is prohibited
end note
stop

@enduml

 颜色

可以为活动(activity)指定一种颜色。

@startuml

start
:starting progress;
#HotPink:reading configuration files
These files should edited at this point!;
#AAAAAA:ending of the process;

@enduml

箭头

使用->标记,可以给箭头添加文字或者修改箭头颜色。

同时,也可以选择点状 (dotted),条状(dashed),加粗或者是隐式箭头

@startuml
:foo1;
-> You can put text on arrows;
if (test) then
  -[#blue]->
  :foo2;
  -[#green,dashed]-> The text can
  also be on several lines
  and **very** long...;
  :foo3;
else
  -[#black,dotted]->
  :foo4;
endif
-[#gray,bold]->
:foo5;
@enduml

连接器(Connector)

可以使用括号定义连接器。

@startuml
start
:Some activity;
(A)
detach
(A)
:Other activity;
@enduml

组合(grouping)

通过定义分区(partition),你可以把多个活动组合(group)在一起。

@startuml
start
partition Initialization {
	:read config file;
	:init internal variable;
}
partition Running {
	:wait for user interaction;
	:print information;
}

stop
@enduml

泳道(Swimlanes)

你可以使用管道符|来定义泳道。

还可以改变泳道的颜色。

@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml

分离(detach)

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

@startuml
 :start;
 fork
   :foo1;
   :foo2;
 fork again
   :foo3;
   detach
 endfork
 if (foo4) then
   :foo5;
   detach
 endif
 :foo6;
 detach
 :foo7;
 stop
@enduml

特殊领域语言(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
二、分析《工厂采购》系统
1、采购员选择采购货品

2、到订货界面,接收客户信息,接收货品信息,显示货品信息

3、到订货管理器,创建客户,取货品信息,创建订单

4、创建客户到客户区,取货品信息到货品区,创建订单到订单区

三、《工厂采购》的系统脚本
@startuml
actor 采购员
  participant "订货界面" as A
  participant "订货管理器" as B
  participant "客户" as C
  participant "货品" as D
  participant "订单" as E
 
 采购员 -> A: 客户信息()
 activate A
 采购员 -> A: 选择订货货品()
 activate A
 
 A -> B:接收客户信息()
 activate B
 A -> B:接收货品信息()
 activate B
 B --> A: 显示货品信息()
 deactivate B
 
 B -> C: 创建客户()<<create>>
 activate C
 B -> D: 取货品信息()
 activate D
 D --> B: 货品信息()
 activate D
 B -> E: 创建订单()<<create>>
 activate E
@enduml
Fourth, the "factory sourcing" UML diagram of the system

Guess you like

Origin www.cnblogs.com/sundasheng223/p/10954153.html