Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Adding Container To Class Diagram
Adding Container To Class Diagram [message #1791763] Thu, 05 July 2018 06:12 Go to next message
Ron Potashnik is currently offline Ron PotashnikFriend
Messages: 7
Registered: May 2018
Junior Member
I am new in papyrus(Eclipse C/C++ on linux) and i want to write a class that have a vector of type double.

So i created a new class, and in properties i add new Owned atrribute.
i find the double type but i cant find out how to add the vector container.
Re: Adding Container To Class Diagram [message #1791766 is a reply to message #1791763] Thu, 05 July 2018 06:41 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Ron,

there is nothing like a vector container in UML.

But you have several choices to express multiplicity

1. you want to completely abstract away the fact multiplicity is provided by using a vector container. In that case you just have to choose "0..*" as multiplicity of the attribute.

2. you want to express multiplicity is somehow provided by using a vector container. In this case I would suggest you to define a "Vector" stereotype and apply that very stereotype to the attribute.

3. you want to express some or all of the the operations of the vector container. In this case I would suggest you to provide the vector container's interface as UML Interface.

/Carsten
Re: Adding Container To Class Diagram [message #1791771 is a reply to message #1791766] Thu, 05 July 2018 07:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6040
Registered: July 2009
Senior Member
Hi

"you just have to choose "0..*" as multiplicity of the attribute"

You should also ensure that the "ordered" and "unique" attributes of the vector attribute correspond to your needs.Probably ordered=true, unique=false.

In UML "container" normally applies containment. However double or rather Real is a primitive DataType which cannot and does not need to be contained; each instance uses a separate area of memory.

Regards

Ed Willink
Re: Adding Container To Class Diagram [message #1791786 is a reply to message #1791771] Thu, 05 July 2018 09:25 Go to previous messageGo to next message
Carsten Pitz is currently offline Carsten PitzFriend
Messages: 137
Registered: May 2015
Location: Germany
Senior Member
Hi Ed,
simply thanks for your comment, I somehow forgot to explicitly state the ordered and unique attributes.
/Carsten
Re: Adding Container To Class Diagram [message #1791935 is a reply to message #1791786] Sun, 08 July 2018 05:22 Go to previous messageGo to next message
Ron Potashnik is currently offline Ron PotashnikFriend
Messages: 7
Registered: May 2018
Junior Member
Ok, Thank's!
Re: Adding Container To Class Diagram [message #1791991 is a reply to message #1791935] Mon, 09 July 2018 11:41 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 159
Registered: March 2011
Location: Paris Saclay, France
Senior Member
There has been a similar thread here. Papyrus SW designer contains a small subset of the C++ STL library, including the vector class. However, the STL model library is just a set of empty classes within a package tagged as "ExternLibrary" which assures that a suitable #include will be produced. You can find this library via "import registered library", if SW designer and C++ support is installed. From a pragmatical viewpoint, you can define bound types such as vector<double> by creating a new empty class with a suitable name (vector<double>) and add a "TemplateBinding" relationship towards the class vector from the STL library. Make sure that the new type is in a package with ExternLibrary as well to assure that no code will be generated for it (il will still be referenced using its name in application classes that use it).
However, this is not very clean as the template binding cannot contain a suitable parameter substitution, since vector in the STL model library has currently no template signature (as it probably should).
Previous Topic:disable textedit after connecting transition
Next Topic:java code generation
Goto Forum:
  


Current Time: Sun Sep 23 11:06:27 GMT 2018

Powered by FUDForum. Page generated in 0.02217 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top