The several same names can be dealed as only one activity in Activity Diagram?

0 votes
asked May 21, 2021 in Wanted features by philcage (160 points)
As sayed in title.

The example as below (it is hard to be with repeat ... repeat while) :

@startuml
skinparam conditionStyle InsideDiamond

start
:foo as starting label;      //same name 1
:read data;                       //same name 2
:generate diagrams;
if (more data?) then (yes)
  :This is backward1;
  :foo as starting label;    //sanme name 1
else (no)
  if (condition two?) then (no)
    :This is backward2;
    :read data;                  //same name 2
  else (yes)
    stop
  endif
endif
stop

@enduml
commented May 21, 2021 by Martin (8,360 points)
moved May 22, 2021 by Martin

Actually the only problem with your code is your "comments".  The comment symbol in Plantuml is ' not //.

However, that said, you can't append such comments to code lines like you have tried to do - which surprised me.  But you can use the enclosed comment format:  /' comment '/ at the end of lines.

So, delete all your comments and it works fine - it doesn't care about repeated text.  Put any comments on a line of their own prefixed with ' or embedded in /' and '/.

commented May 22, 2021 by philcage (160 points)
You are right, my comments cannot be like that.

But I means that I want that the first "foo as starting label" & the second "foo as starting label" can be merged as the first one and at the first place; The first "read data" & the second "read data" should be merge as the first one and at the first place.
commented May 22, 2021 by Martin (8,360 points)
edited May 22, 2021 by Martin

OK, sorry, I misunderstood.  I'm afraid Plantuml is not very good at backwards paths on activity diagrams.  I tried 'label & goto' but the result is so poor it is not worth sharing.

The best I can offer is:

commented May 23, 2021 by philcage (160 points)

Emm, this diagram still can not reach my aim.

Another way, can we add "diamond" shape in  component diagram, then I can using it to draw conditions ? If do this,  I can just draw this activity diagram.

commented May 23, 2021 by Martin (8,360 points)
Hexagon is the closest shape Plantuml has to a diamond.  You could put in a Wanted Feature for a diamond shape; given they recently added hexagon I can't imagine adding a diamond would be too difficult.
commented May 23, 2021 by philcage (160 points)
Okay, thanks a lot.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...