Book a Demo

Author Topic: Evaluation Questions - running topic  (Read 4812 times)

Drool Rockworm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Evaluation Questions - running topic
« on: April 10, 2014, 11:47:44 pm »
I'm a long term Rhapsody user, as such I'll be trying to understand how to do things I am used to doing in this new tool.

1st round of questions:

associations/relatrionships between classes.

I am used to drawing relationships, be there 1,*, 1,n, 1,1 etc and having the code generator create a container on the many side, and giving me options about that container.

For example,  If I have two classes, doctor and patient, and formalize that relationship on my class diagram, I expect the class doctor to have a container of some sort, perhaps an iterator, hash table, etc based on the type of relationship.

Does EA code generate for associations/relationships beyond a pointer?

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Evaluation Questions - running topic
« Reply #1 on: April 11, 2014, 05:02:13 pm »
You can achieve this using 'Collection Classes',
Please refer to http://www.sparxsystems.com/enterprise_architect_user_guide/10/software_engineering/settingcollectionclasses.html
to know more

Drool Rockworm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Evaluation Questions - running topic
« Reply #2 on: April 11, 2014, 10:17:34 pm »
I've been trying this with very little success.

Maybe I'm just clumbsy with the tool since I am new to it.

If I setup my default container class as a map, what is the expected result for the class on the many side of the 1..*?

In a new test I just did, the many side did get a m_patient attribute which was of the container class type.

It also generated a get/set that don't make sense to me.  Maybe this tool just needs me to be very specific and do the work myself in properties somewhere?

I'm used to a default container and the tool giving me get/set that make sense for the container type.   Is there a default container that will generate get/set accessors that make sense?  I set my default container to a map, and the get returns the whole map, and the set takes a whole map as input.

That normal and we just have to use the container mechanism after that?

Sorry, I went right from C -> MDD C++ yeras ago and was spoiled by a lot of builtin framework, I almnost never had to customize transformations.
« Last Edit: April 11, 2014, 10:45:05 pm by drool »

Drool Rockworm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Evaluation Questions - running topic
« Reply #3 on: April 12, 2014, 12:26:44 am »
A 1 to * from Deck(1) to Card(*) using composition and a collection class of array<#TYPE#, int> yields the below code in Deck.cpp.

So I get a pointer to a collection (I think I'd want the actually collection) as a member.  Then my get and set seem useless.   Can you send me an example project with settings for this simple association?

array<Card, int> *m_Card;

array<Card, int> Deck::GetCard(){

      return m_Card;
}

void Deck::SetCard(array<Card, int> newVal){

      m_Card = newVal;
}

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Evaluation Questions - running topic
« Reply #4 on: April 12, 2014, 03:00:55 pm »
Please Set the target containment to value. (Connector Properties-> Target Role-> Containment -> Value )

This will avoid pointers.

Drool Rockworm

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Evaluation Questions - running topic
« Reply #5 on: April 14, 2014, 10:43:58 pm »
That is the setting for the code generated.