Tuesday, 30 January 2024

PlantUML: concurrent state in state diagram

A concurrent state allows multiple state flows to operate at the same time.

Concurrent state is expressed using either -- or ||

 

concurrentState1.txt

@startuml

left to right direction

state init

state processing {
	[*] --> S1
	S1 --> [*]

-- [*] --> S2 S2 --> S3 S3 --> S4 S4 --> S5 S5 --> [*] -- [*] --> S6 S6 --> S7 S7 --> [*] } state terminate [*] --> init init --> processing processing --> terminate processing --> [*] @enduml

 

Above snippet generate below diagram.

 

 

Using ||

 

concurrentState2.txt

@startuml

left to right direction

state init

state processing {
	[*] --> S1
	S1 --> [*]
	--
	[*] --> S2
	S2 --> S3
	S3 --> S4
    S4 --> S5
    S5 --> [*]
	--
	[*] --> S6
	S6 --> S7
	S7 --> [*]
}

state terminate

[*] --> init
init --> processing
processing --> terminate
processing --> [*]

@enduml

Above snippet generate below diagram.


 


Note

I used ‘left to right direction’ to draw image1, you can experiment by removing.

Previous                                                    Next                                                    Home

No comments:

Post a Comment