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:

@startuml

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

@enduml

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?

Thanks,

Steve.

1 Answer

0 votes
answered Mar 13, 2013 by plantuml (235,460 points)

Hello,

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

Something like:

@startuml
[*] --> <> diamond
diamond --> foo1
diamond --> foo2
@enduml

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)
Hi,

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 :-).

Regards,
Steve.
commented Mar 25, 2013 by plantuml (235,460 points)
As beta version, you can download this http://dl.dropbox.com/u/13064071/plantuml.jar
and test the following diagram:

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

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

Regards,
Arnaud
...