How to make method arguments visible in StarUML diagrams - uml

I am trying to display the arguments in a sequence diagram using staruml
Is it possible to display the arguments like this?
1: saveResult(int value)

Go to Toolbox -> Sequence -> Stimulus.
Drag from one object to another to create the stimulus line
On the side you should see the Properties for the call
In Name put the method name, i.e. saveResult
In the Detail section you can specify arguments. Put the arguments there, i.e. int value
If the arguments don't appear then change the properties of the Sequence Diagram. Change MessageSignature to NAMEANDTYPE

Try the sequence diagram user manual.

Related

How to draw the UML diagram which representing invocations between methods in the same class inheritance tree? [duplicate]

I have a child class which wants to add more functionality to a base class function, how can I represent that it also does the base class function not just the newly added functionality?
Interesting question. I tried that with Enterprise Architect. It did let me select the parent's operation but the display in the diagram did not change. It seems like you need to use notes for that:
As you can see Class2 inherits from Class1. The SD shows a call to Class2's operation a(). The call to the super-class's Class1.a() as internal call shows the same signature. A note clarifies the situation.
Maybe there's something else possible with this. But that's what I came up with immediately.
P.S. I've looked up the specs. P. 575 of UML 2.5 says
The message-name appearing in a request-message-label is the name property of the Message. If the Message has a signature, this will be the name of the Operation or Signal referenced by the signature. Otherwise the name is unconstrained.
That would put in the option to specify the operation in question as Class1:a() or the like. Actually Enterprise Architect shows it that way in the properties of the message but shortens it to just the basic name. Just a border case, I'd guess.

How to specify the return type of a method that returns a list of values in StarUML?

I have two classes (say Database and Record). In Database class, I have a method named getRecords() that returns a list of Record objects.
In Java, the above method can be written as:
List<Record> getRecords(){..}
In StarUML, while designing Class diagram, I tried giving
+getRecords() : Record[0..*]
But StarUML refused to create method like above. When I tried with the one below, it works
+getRecords() : ArrayList<Record>
But this is more specific to Java. I want to implement something like Record[0..*] in StarUML. Is it possible to write methods in such format or the Java style of return type is the only solution ?
I don't know why StarUML refuses to parse the text, but you can still create it via model.
Add the operation and call it getRecords()
Right-click on the operation (in diagram or model), and select Add > Parameter
Select parameter in Model Explorer (probably the parameter is already selected when you created it) and set the direction parameter to return. This is how UML represents return types.
(Configure the type, multiplicity, and anything else you need.)
Note that the default collection in UML is Set, so you should check isOrdered, as List is an ordered collection.

Constructor in visual paradigm

How can you take a HashMap of type, for example, <Person,Integer>, as a parameter for the constructor in class diagrams? Every time I try in visual paradigm, it gives an error.
I am not sure what error you were getting, but what you wanted to achieve can be done by performing the steps in Visual Paradigm.
Add a constructor into the class by right clicking on the class and selecting Add > Constructor.
Right click on the constructor and select Open Specification...
Under the Parameters tab, click Add...
Enter the parameter name, enter java.util.HashMap as type and as Type modifier. If you want only a diagram for presentation purpose without the need of code generation, you may enter HashMap without entering 'java.util.HashMap'
Done!
The article below provides you with more information about their Class Diagram support. Hope this helps.
https://circle.visual-paradigm.com/docs/uml-and-sysml/class-diagram/how-to-draw-a-class-diagram-in-uml/
Do you mean something like this?

How I can show an attribute as a two dimensional array(matrix) in UML?

I am doing the UML of my system and I have an attribute boardGame that is a matrix (array[6][6]).
What is the correct way to show it in the UML? I tried this:
Game
-boardGame: array[][]
but the program I am using to do it (SatarUML) does not accept it in that way.
Simply you can show it like this (assuming it's untyped like in your example):
(note that the square bracket pairs [] are rendered with a sub-optimal font from the UML tool)
If it's typed use this format:
where you need to replace type by the one you are actually using.

How i add array attrribute in class diagram UML

am using uml to implement my class diagram.
I have a class diagram named user . I want to add user preferences as an array of string without using table.
I would ask if i can use an array of string as an attribute.
No problem. Simply append the array dimension as shown below:
Defaults can be specified following the equal sign.

Resources