Skip to main content



      Home
Home » Modeling » ATL » helper attribute
helper attribute [message #1062899] Tue, 11 June 2013 06:19 Go to next message
Eclipse UserFriend
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 09:41 Go to previous messageGo to next message
Eclipse UserFriend

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 11:53 Go to previous messageGo to next message
Eclipse UserFriend
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 11:55] by Moderator

Re: helper attribute [message #1063159 is a reply to message #1062989] Wed, 12 June 2013 09:54 Go to previous messageGo to next message
Eclipse UserFriend

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 11:14 Go to previous message
Eclipse UserFriend

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: Tue Jul 22 19:28:34 EDT 2025

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

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

Back to the top