How to add <<input>> to this puml code like in the attach image?

91 Views Asked by At

enter image description here

I added a sketch of what I want

I want to add <<input>> to this code I added :HW type\n detected; <> but I don't know how to attach it with 'HW type detected' element



@startuml Type Initialization

start
:Read default type\n ;
:HW type detected;
if (Compare types) is (matches) then
:Continue;

stop
else (doesn't match)
:Store detected\n type ;
end

:HW type\n detected; <<input>>
@enduml
2

There are 2 best solutions below

3
JohnXF On

Do you mean like this?

@startuml Type Initialization

start
:Read default type\n ;
:HW type detected<
if (Compare types) is (matches) then
:Continue;

stop
else (doesn't match)
:Store detected\n type ;
end

@enduml

UML Activity

Using the new syntax of :HW type detected; <<input>> gives the same effect.

@startuml Type Initialization

start
:Read default type\n ;
:HW type detected; <<input>>
if (Compare types) is (matches) then
:Continue;

stop
else (doesn't match)
:Store detected\n type ;
end

:HW type\n detected; <<input>>
@enduml

I am testing with the online tool at http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

1
Fuhrmanator On

The input box you want to use is part of the SDL. It has a particular meaning -- it's not really part of just drawing a flow chart, at least not in the context of PlantUML.

Input is used to show a match of a particular type of message that is received (input).

Here's a possible solution to your question, assuming the step of Read default type is where you allow input. I added another input box, Other type detected, to show how it could work in the context of split (alternate flows, depending on the input received).

@startuml Type Initialization

start
:Read default type\n ;
split
:HW type detected; <<input>>
if (Compare types) is (matches) then
  :Continue;
else (doesn't match)
  :Store detected\n type ;
end if
split again
:other type\n detected; <<input>>
end split
stop
@enduml

PlantUML SDL diagram with Inputs