[ATL] EEnum to EClass [message #546793] |
Wed, 14 July 2010 05:00  |
Eclipse User |
|
|
|
I need to transform a class X with an EEnum attribute called Y of value "B" into the next model where class X will have a reference to EClass Y that has a String description attribute with the value "B".
And all other class X transformations that point to the same EEnum will also have to reference that same new EClass Y when transformed.
In otherwords EEnum Y needs to be transformed into EClass Y and all the objects that were referencing this enumeration value will now have a reference to this newly created EClass Y.
Can somebody please help me with how I would go about constructing these rules? I don't want to create a new instance of EClass with a value "B" everytime I find the value, so I probably need some way of pre-transforming all the enumeration values into instances of EClass Y before hand and then somehow find a reference to them during transformation of class X?
|
|
|
|
|
|
|
|
Re: [ATL] EEnum to EClass [message #547912 is a reply to message #546793] |
Tue, 20 July 2010 03:41  |
Eclipse User |
|
|
|
Using the keyword unique you can simplify that to :
helper def: enumMap : Map(PMWV1!Location, String) =
Map {(#IL, 'IL'), (#AZ, 'AZ'), (#AK, 'AK')};
unique lazy rule enum{
from s : PMWV1!Location
to
t : PMWV2!CriteriaAllowedValue(
description <- thisModule.enumMap.get(s)
)
}
Though it's a lazy rule, the call to it is the same as with the called rule.
[Updated on: Tue, 20 July 2010 03:42] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05128 seconds