Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Can I do a helper that return a enumeration?
Can I do a helper that return a enumeration? [message #88882] Mon, 25 August 2008 07:08 Go to next message
Amalia Garcia is currently offline Amalia GarciaFriend
Messages: 9
Registered: July 2009
Junior Member
Hello,

I want to do a helper that return a enumeration.

Can you help me, please?.

Thanks
[ATL] Re: Can I do a helper that return a enumeration? [message #89017 is a reply to message #88882] Tue, 26 August 2008 08:36 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
Hello,

Can you please remember to prefix the subject of your ATL-related posts
with [ATL] as I just did in this reply? Thanks.

If you mean that you want to return an enumeration literal, here is a
sample :
Consider that "MM" (a metamodel) defines an enumeration called
"EnumTest" and containing the value "SOME_LITERAL".

helper context <some metaclass> def: getSomeEnumLiteral() :
MM!EnumTest = #SOME_LITERAL;

Otherwise if you want to return an enumeration (so your metamodel
defines the enumeration data type), the helper should be like this :

helper context <some metaclass> def: getSomeEnumeration() :
UML!Enumeration = <helper code>;

Best regards,

William

Amalia Garcia a écrit :
> Hello,
>
> I want to do a helper that return a enumeration.
>
> Can you help me, please?.
>
> Thanks
>
Re: [ATL] Re: Can I do a helper that return a enumeration? [message #89064 is a reply to message #89017] Tue, 26 August 2008 09:17 Go to previous messageGo to next message
Amalia Garcia is currently offline Amalia GarciaFriend
Messages: 9
Registered: July 2009
Junior Member
William Piers wrote:

> Hello,

> Can you please remember to prefix the subject of your ATL-related posts
> with [ATL] as I just did in this reply? Thanks.

> If you mean that you want to return an enumeration literal, here is a
> sample :
> Consider that "MM" (a metamodel) defines an enumeration called
> "EnumTest" and containing the value "SOME_LITERAL".

> helper context <some metaclass> def: getSomeEnumLiteral() :
> MM!EnumTest = #SOME_LITERAL;

> Otherwise if you want to return an enumeration (so your metamodel
> defines the enumeration data type), the helper should be like this :

> helper context <some metaclass> def: getSomeEnumeration() :
> UML!Enumeration = <helper code>;

> Best regards,

> William

> Amalia Garcia a écrit :
>> Hello,
>>
>> I want to do a helper that return a enumeration.
>>
>> Can you help me, please?.
>>
>> Thanks
>>
Hello Willian,

I want to do the second option, that it is:
helper context <some metaclass> def: getSomeEnumeration() :
UML!Enumeration = <helper code>;

But my doubt is : how I create and return a enumeration.

Example:
I have a enumeration that its name is MCD_MetaModel!TipoCardinalidad and
it has the following values: #Cero_a_uno, #Cero_a_muchos, #Uno and
#Uno_a_muchos.

I want to create a enumeration of this type that its value will be #Uno.
How do I do this helper?
helper def :getCardinality (cardinality: Logical!CardinaltyType) :
MCD_MetaModel!TipoCardinalidad = ?¿?¿?¿?¿?

The parte has ?¿?¿? I don't to do.

Thank you.
Re: [ATL] Re: Can I do a helper that return a enumeration? [message #89079 is a reply to message #89064] Tue, 26 August 2008 09:44 Go to previous message
Amalia Garcia is currently offline Amalia GarciaFriend
Messages: 9
Registered: July 2009
Junior Member
Amalia Garcia wrote:

> William Piers wrote:

>> Hello,

>> Can you please remember to prefix the subject of your ATL-related posts
>> with [ATL] as I just did in this reply? Thanks.

>> If you mean that you want to return an enumeration literal, here is a
>> sample :
>> Consider that "MM" (a metamodel) defines an enumeration called
>> "EnumTest" and containing the value "SOME_LITERAL".

>> helper context <some metaclass> def: getSomeEnumLiteral() :
>> MM!EnumTest = #SOME_LITERAL;

>> Otherwise if you want to return an enumeration (so your metamodel
>> defines the enumeration data type), the helper should be like this :

>> helper context <some metaclass> def: getSomeEnumeration() :
>> UML!Enumeration = <helper code>;

>> Best regards,

>> William

>> Amalia Garcia a écrit :
>>> Hello,
>>>
>>> I want to do a helper that return a enumeration.
>>>
>>> Can you help me, please?.
>>>
>>> Thanks
>>>
> Hello Willian,

> I want to do the second option, that it is:
> helper context <some metaclass> def: getSomeEnumeration() :
> UML!Enumeration = <helper code>;

> But my doubt is : how I create and return a enumeration.

> Example:
> I have a enumeration that its name is MCD_MetaModel!TipoCardinalidad and
> it has the following values: #Cero_a_uno, #Cero_a_muchos, #Uno and
> #Uno_a_muchos.

> I want to create a enumeration of this type that its value will be #Uno.
> How do I do this helper?
> helper def :getCardinality (cardinality: Logical!CardinaltyType) :
> MCD_MetaModel!TipoCardinalidad = ?¿?¿?¿?¿?

> The parte has ?¿?¿? I don't to do.

> Thank you.
Hello Wllians,

I have de following helpers:
helper def :getCardinality (cardinality: Logical!CardinaltyType) :
MCD_MetaModel!TipoCardinalidad =
if (cardinality=#ZERO_TO_MANY) then
#cero_a_muchos
else
#cero_a_uno
endif;

When I execute the helper, this produces next exception, do you know which
is my problem:
java.lang.RuntimeException
at org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(Unk nown
Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(Unknown Source)
at org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(Unknown Source)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(Unknown Source)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(Unknown Source)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(Unknown Source)
at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(Unknown
Source)
at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(Unknown
Source)
at org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(Unknow n Source)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(Unknown
Source)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(U nknown
Source)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(U nknown
Source)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(U nknown
Source)
at org.eclipse.debug.internal.ui.DebugUIPlugin$6.run(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.asm2E MF(Unknown
Source)
at org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(U nknown
Source)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(Unknown Source)
... 23 more

Thank you
Previous Topic:Question about EMFVM
Next Topic:[ATL] Rule inheritance
Goto Forum:
  


Current Time: Fri Apr 19 07:48:29 GMT 2024

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

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

Back to the top