序列图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
title: 序列图sequence(示例)
participant A
participant B
participant C

note left of A: A左侧说明
note over B: 覆盖B的说明
note right of C: C右侧说明

A->A:自己到自己
A->B:实线实箭头
A-->C:虚线实箭头
B->>C:实线虚箭头
B-->>A:虚线虚箭头

关键词:

  1. title, 定义该序列图的标题
  2. participant, 定义时序图中的对象
  3. note, 定义对时序图中的部分说明
  4. {actor}, 表示时序图中的具体对象(名称自定义)

针对note的方位控制主要包含以下几种关键词:

  1. left of, 表示当前对象的左侧
  2. right of, 表示当前对象的右侧
  3. over, 表示覆盖在当前对象(们)的上面

针对{actor}的箭头分为以下几种:

  1. -> 表示实线实箭头
  2. –> 表示虚线实箭头
  3. ->> 表示实线虚箭头
  4. –>> 表示虚线虚箭头

流程图

1
2
3
4
5
6
7
8
9
10
st=>start: 开始
e=>end: 结束
op=>operation: 操作
sub=>subroutine: 子程序
cond=>condition: 是或者不是?
io=>inputoutput: 输出

st(right)->op->cond
cond(yes)->io(right)->e
cond(no)->sub(right)->op
  • start,end, 表示程序的开始与结束
  • operation, 表示程序的处理块
  • subroutine, 表示子程序块
  • condition, 表示程序的条件判断
  • inputoutput, 表示程序的出入输出
  • right,left, 表示箭头在当前模块上的起点(默认箭头从下端开始)
  • yes,no, 表示condition判断的分支(其可以和right,left同时使用)

模块定义(模块标识与模块名称可以任意定义名称,关键词不可随意取名)如下:

1
模块标识=>模块关键词: 模块名称

连接定义如下:

1
2
3
模块标识1->模块标识2
模块标识1->模块标识2->模块标识3
... ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
st=>start: Start
e=>end: End
op1=>operation: My Operation
op2=>operation: Stuff
sub1=>subroutine: My Subroutine
cond=>condition: Yes
or No?
c2=>condition: Good idea
io=>inputoutput: catch something...

st->op1(right)->cond
cond(yes, right)->c2
cond(no)->sub1(left)->op1
c2(yes)->io->e
c2(no)->op2->e

Alt text