Adding a stereotype to an attribute in Dia - uml

Is there a proper way of adding a stereotype to an attribute (not operation) in Dia? So far I'm inserting stereotypes to attribute names, but it has a slightly different order.
What I have:
+<<val>> count: Int
How (I think) it should look like:
<<val>> +count: Int

It looks like you are typing the stereotype and angle brackets. Instead, look for a way to apply a stereotype in the GUI.

Related

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.

visual paradigm reverse java code, class diagram

Using this tool the classes corresponding to my code were created.
Each class has attributes with its getter and setter methods.
The attributes are created in the diagram but with the label << Property >> Without the corresponding methods, as you can see from the image.
Moreover, lists are not attributed to the type List , even if I change the association into aggregation.
  The label << Property >> tells you precisely an attribute which correspond getter and setter?
I could not find anything about this label in the UML documentation
What you call label is a stereotype. Attributes with a <<Property>> stereotype are usually marked this way to tell a code generator that appropriate getter and setter methods shall be created if the target language supports (or requires) that.
Lists do not depend on the composition symbol but on the multiplicity which is barely readable, but I guess the dots near the associations are asterisks (for any multiplicity). The dots at the end of the associations are isOwned attributes (saying the the dot-marked class owns the association).

OCL Stereotype Constraint: Any association that is coloured all connected classes have the same colour

Quite new to OCL, thanks for the help.
So I have a profile with the stereotypes as shown:
Can someone tell me how to write an invariant constraint that says any association that is Coloured means that all connected classes must have the same colour value in their colour property?
I had this so far:
Context UML::InfrastructureLibrary::Core::Constructs::Association
inv: Association.allInstances() -> forAll(a:Association|a.oclIsTypeOf(Coloured) implies
a.associatedElement.colour = a.colour)
Pretty sure this is wrong because a.associatedElement does not exist.. but I do not understand how to access this 'all connected classes' or what that means. Perhaps I need something like
a.[association].colour ?
Thanks
From the UML spec (2.4.1 Superstructure, Sec. 7.3.3):
memberEnd : Property [2..*] Each end represents participation of instances of the classifier connected to the end in links of the association. This is an ordered association. Subsets Namespace::member.
So, something like this:
(...) -> forAll(a:Association|a.oclIsTypeOf(Coloured))->forAll(memberEnd->colour() = a.colour)
I doubt that's the exact statement, but it should get you started in the right direction.
Your diagram should specify the constraint as well. Just attach a note to your Coloured stereotype saying if the instance is an association both connected class objects have to have the same colour property.

How to make method arguments visible in StarUML diagrams

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.

How to draw a relationship between a property and a class in ArgoUML?

In ArgoUML, I have the ability to put a class Type to any property of a class. For example, I can declare a customer property with a Customer type in the Order class.
I can also easily draw a relationship from class to class:
But I can't figure out how to "draw" the link from the customer property to the Customer class. The link is never really connected to the property, but rather to the entire Order class.
I can move the position of the link manually:
But it's never really "locked" to the customer property, and can be moved automatically by the software at any moment.
Is there a way to do this?
You can not have an association in UML which is not connecting the entire two classes. It is not possible to touch the property inside the class.
Workarounds are:
add a note linked to the property
add an icon to the property which would be designed like an association.
I don't know if this advanced icons customization is available in this free tool but it is in other tools.
I found a flash demo which shows the association attribute with an icon. Look at : http://www.download-omondo.com/show_association_member.swf
If you need to understand what mean an association in UML and code generation in Java then have a look at this demo: http://www.download-omondo.com/association.swf
Hope this help.
ArgoUML follows the UML specification. Associations are drawn from one class to another. Attributes are drawn inside the 2nd compartment of a class.
The association type closest in meaning to an attribute is composition, but they are not equivalent.
You should never portray something AND as an attribute of a class, AND as a separate class associated to it.
E.g. 1. an Order may have a Number, that may be used by the customer to identify his Order. The Number is best portrayed as an attribute (in the 2nd compartment of the class).
E.g. 2. an Order may be associated to the Customer who placed the order. The Customer is best portrayed as a separate class, since it has its own lifespan (behavior), associated with the Order. This allows to show multiplicities and roles at both ends of the association line.

Resources