Choice Pseudostate

+6 votes
asked Mar 13, 2013 in Closed question / help by anonymous

I found an old thread on SourceForge regarding pseudostates and it seems exit and entry points work nicely:


state Stopped {

    state exS1 <<exitpoint>>

    state exS2 <<exitpoint>>

    [*] --> choice

    choice --> Closed : [Position==Closed]

    choice --> PartClosed : [Position==PartClosed]

    choice --> Open : [Position==Open]

    Closed --> exS1 : OpenDoor

    PartClosed --> exS1 : OpenDoor

    PartClosed --> exS2 : CloseDoor

    Open --> exS2 : CloseDoor

    Closed: ResetPosition / NullEncoders()


state Moving {

      Moving : Entry / SetLed()

      Moving : Exit / StopMotor(); UnsetLed()

      Opening: Entry / MotorForward()

      Closing: Entry / MotorBackward()


[*] --> Stopped

exS1 --> Opening

exS2 --> Closing

Moving --> Stopped : StopMotion


However, I can't seem to find the keyword for a choice pseudostate. It should look like a branch in an Activity diagram i.e, a diamond.

Has this been implented yet?



1 Answer

0 votes
answered Mar 13, 2013 by plantuml (295,000 points)


We are thinking about allowing to define diamond in state diagrams.

Something like:

[*] --> <> diamond
diamond --> foo1
diamond --> foo2

Or maybe :

state choice1 <<choice>>

Not sure to know which one is better/more logical ?

Any idea ?

commented Mar 13, 2013 by st3ve (120 points)

I would suggest that:
state choice1 <<choice>>
would be more consistent with the current treatment of entry and exit points.

Other pesudostates such as Terminate, Fork, Join, could be implemented in a similar manner and would also be useful :-).

commented Mar 25, 2013 by plantuml (295,000 points)
As beta version, you can download this
and test the following diagram:

state choice1 <<choice>>
state foo1 <<fork>>
state foo2 <<join>>
state foo3 <<end>>
[*] --> choice1
choice1 --> foo1
choice1 --> foo2
choice1 --> foo3

I am not 100% satisfied by the syntax...
So any feedback welcome!