Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » helper attribute
helper attribute [message #1062899] Tue, 11 June 2013 10:19 Go to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
Hello,

I use a helper attribute defined as follows:

helper def: resolved: Set(MM!Element) = Set{};


I add some elements to this set in the "do" section of a rule, to be used in the "using" section of another rule.
But I found that the set is empty in the "using" section, although it prints the contained values in the "do" section of both rules.

Anyone have a clue?
Re: helper attribute [message #1062941 is a reply to message #1062899] Tue, 11 June 2013 13:41 Go to previous messageGo to next message
Burak Karaboga is currently offline Burak Karaboga
Messages: 9
Registered: June 2013
Junior Member

Hi Basma,

How are you adding elements to your helper attribute in the do section?

Just adding the elements is not enough, you should also assign the new Set to your attribute. Example below;

thisModule.resolved <- thisModule.resolved.union(anotherCollection);


Cheers
Re: helper attribute [message #1062989 is a reply to message #1062941] Tue, 11 June 2013 15:53 Go to previous messageGo to next message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member
I do this ?!!

And the added elements appear in the do section of this rule and in the other rule.
But they don't appear in the using section.
Is this normal, or am I doing something wrong?

[Updated on: Tue, 11 June 2013 15:55]

Report message to a moderator

Re: helper attribute [message #1063159 is a reply to message #1062989] Wed, 12 June 2013 13:54 Go to previous messageGo to next message
Burak Karaboga is currently offline Burak Karaboga
Messages: 9
Registered: June 2013
Junior Member

I did a quick test and it seems that using sections are executed before rules and do sections no matter what.

I think more experienced ATL people would better explain why this is the case but I think you should find another way to achieve what you are trying to do.

If I understood what you are trying to do correctly, by copying your global attribute to another one and only using/modifying it in that specific rule, you might use it as if it is a local attribute.

Cheers
Re: helper attribute [message #1063193 is a reply to message #1063159] Wed, 12 June 2013 15:14 Go to previous message
Basma Moukhtar is currently offline Basma Moukhtar
Messages: 27
Registered: June 2010
Junior Member

Thanks a lot for your help.
I made a work around and it worked.
Previous Topic:Performance
Next Topic:[ATL] Rule inheritance with several 'from' elements
Goto Forum:
  


Current Time: Wed Sep 03 00:06:01 GMT 2014

Powered by FUDForum. Page generated in 0.01715 seconds