Book a Demo

Author Topic: Logic view - aggregations?  (Read 5997 times)

Roggan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Logic view - aggregations?
« on: December 05, 2004, 04:41:35 am »
Im trying to learn UML right now , and im currently trying EA.

If i understand things correctly , an aggregation line is there to describe that one class has one or more references to objects of some other class.

which seems all ok when i generate code to.

however , if i reverseengineer some code that has one or more member vars referencing to another class , EA dont show aggregation lines , just normal association lines with the member vars names on them.

what does that mean? is that equal to aggregation?
which is the correct one to use?

also , if i have an aggregation line with multiplicity 1 on the source and 2 on the target , shouldnt that mean that each of the parent class has two references to the target?

if so , how does one generate code for that? does a 1 to 2+ relation always require that the parent has a array/list/collection of its references or could it just mean that you have two separate member variables?

//Roger

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Logic view - aggregations?
« Reply #1 on: December 05, 2004, 03:17:40 pm »
Quote
If i understand things correctly , an aggregation line is there to describe that one class has one or more references to objects of some other class.

No, that's an association. Aggregate and composite associations are specialised kinds of association that give extra information about the lifecycle of the contained element. The reverse engineering process can't deduce that lifecycle information so creates a generic association connector.

Quote
also , if i have an aggregation line with multiplicity 1 on the source and 2 on the target , shouldnt that mean that each of the parent class has two references to the target?

A multiplicity of 2 would normally mean an array of 2 items. If you want two attributes, you need two associations.

Quote
does a 1 to 2+ relation always require that the parent has a array/list/collection of its references or could it just mean that you have two separate member variables?

Go to the "Tools | Options" dialog and find the page with codegen options for your chosen language. There you will see a button "Collection Classes" which allows you to define how 1..* multiplicities are implemented in code. I hope this helps.
The Sparx Team
[email protected]