PlantUML copipe 샘플

3346 단어 plantumluml

도입 방법



시퀀스 다이어그램





sequence.pu
/'
PlantUML sample
'/
@startuml
title SequenceA

'Replace name
participant "モジュールA" as ModuleA
participant "モジュールB" as ModuleB

== Sync Call ==
[-> ModuleA : start sync
activate ModuleA
ModuleA -> ModuleB : sendMsgSync(10, "a")
activate ModuleB
ModuleB -> ModuleB : do something()
ModuleA <-- ModuleB : response(OK)
deactivate ModuleB
ModuleA -> ModuleA : do something()
deactivate ModuleA

'space
||| 

== Async Call ==
[-> ModuleA : start async
activate ModuleA
ModuleA ->> ModuleB : sendMsgAsync(10, "a")
activate ModuleB
ModuleB -> ModuleB : do something()
ModuleA -> ModuleA : do something()
ModuleA <-- ModuleB : response(OK)
deactivate ModuleB
deactivate ModuleA

== Other sample ==
[-> ModuleA : Note, color
activate ModuleA
ModuleA -> ModuleB : sendMsgSync(<s:#FF0000>10</s><color:red> 20</color>, "a")
note left #FF0000 : 引数変更 (ver 1.3)
activate ModuleB #00FF00
ModuleB -> ModuleB: do something()
ModuleA <-- ModuleB : response(OK)
note right
常にOKを返す
end note
note over ModuleB: 無限待ち
deactivate ModuleB
deactivate ModuleA

[-> ModuleA : loop
activate ModuleA
loop for each item
    ModuleA -> ModuleA : do something()
    break item = error
        ModuleA -> ModuleA : treatError()
    end
end
deactivate ModuleA

[-> ModuleA : ifelse
activate ModuleA
alt data < 50
    ModuleA -> ModuleA : do something()
else data < 100
    ModuleA -> ModuleA : do something()
else other
    ModuleA -> ModuleA : do something()
end
deactivate ModuleA

[-> ModuleA : opt
activate ModuleA
opt data == 100
    ModuleA -> ModuleA : do something()
end
deactivate ModuleA

[-> ModuleA : create
activate ModuleA
create ModuleC
ModuleA -> ModuleC : <create>>
ModuleC -> ModuleC : do something()
destroy ModuleC
deactivate ModuleA

[-> ModuleA : reference
ref over ModuleA, ModuleB
    Refer to
    SequenceY
end ref
deactivate ModuleA

@enduml

상태 천이도





stateMachin.pu
/'
PlantUML sample
'/
@startuml
title StateMachine_CancelChattering

[*] -down-> StateOff
StateOff -down-> StateOff2On : button pushed / cnt_on = 0

StateOff2On: entry / 
StateOff2On: do / Check button status every 10msec
StateOff2On: exit / 
StateOff2On -> StateOff2On : button pushed [cnt_on < 5] / cnt_on++
StateOff2On -up-> StateOff : button released / cnt_on = 0
StateOff2On -down-> StateOn:  button pushed [cnt_on == 5] / 

StateOn -up-> StateOn2Off : button released / cnt_off = 0
StateOn2Off: entry / 
StateOn2Off: do / Check button status every 10msec
StateOn2Off: exit / 
StateOn2Off -> StateOn2Off : button released [cnt_off < 5] / cnt_off++
StateOn2Off -down-> StateOn : button pushed / cnt_off = 0
StateOn2Off -up-> StateOff:  button released [cnt_on == 5] /

@enduml

좋은 웹페이지 즐겨찾기