|
|
|
Re: [ATL] EEnum to EClass [message #547406 is a reply to message #547402] |
Fri, 16 July 2010 16:14 |
Izaak van Niekerk Messages: 35 Registered: June 2010 |
Member |
|
|
Hi Vincent,
Would this rule also create one instance of "B" then so that it can be referenced every time "B" is encountered?
@Freddy
> Could you please give us more details (e.g. about your
> metamodels)?
Version 1:
--------------
Class "RoleSpec" has a feature "conformanceType" that is of type "RoleSpecTypeExplorer".
"RoleSpecTypeExplorer" is an Enumrator with values:
Party = 0, Account = 1, Place=2, Agreement=3
Version 2:
--------------
Class "RoleSpec" has a feature "conformanceType" that is of type "Type".
"Type" is a class with a feature "name" of type String.
So when Version1 is transformed to Version2, RoleSpec's feature comformanceType must be transformed from an enumeration to a class, and an instance of Type must be created with name set to "Party" or "Account" or "Place" etc.
One instance of each enumeration must be created and every RoleSpec that for instance have a conformanceType with enumeration value of "Party" must reference that same instance of Type with name "Party".
Hope this is more clear?
[Updated on: Fri, 16 July 2010 19:28] Report message to a moderator
|
|
|
|
|
Re: [ATL] EEnum to EClass [message #547912 is a reply to message #546793] |
Tue, 20 July 2010 07:41 |
Sylvain EVEILLARD Messages: 556 Registered: July 2009 |
Senior Member |
|
|
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 07:42] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04916 seconds