Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Using a Generic MetaClass Name ?!
Using a Generic MetaClass Name ?! [message #90566] Fri, 26 September 2008 09:51 Go to next message
Skander TURKI is currently offline Skander TURKIFriend
Messages: 130
Registered: July 2009
Senior Member
Hi,
I would like to write a generic rule that calls a helper that computer the
type of the metaclass that will be generated, i wrote this code (that
doesn't work):

helper context UML2!Class def : GenericComponentName () :
AAXL!ComponentClassifier =
if self.isStereotypeApplied('MemoryPartition') then
AAXL!MemoryType
else if self.isStereotypeApplied('SwSchedulableResource') then
AAXL!ProcessType
else
AAXL!ComponentClassifier
endif
endif ;

rule ClassGeneric {
from a: UML2!Class (a.isAbstract())
--ERROR HERE-- to p: oclType(a.GenericComponentName())(name <- a.name)}

It seems that this is impossible to do this way because of the way ATL
computes the atl transformation file, does anybody have an idea of how to
do this?
[ATL] Re: Using a Generic MetaClass Name ?! [message #90834 is a reply to message #90566] Wed, 01 October 2008 09:35 Go to previous message
William Piers is currently offline William PiersFriend
Messages: 301
Registered: July 2009
Senior Member
Hello,

The "to" part of the rule can't be parametrized, you need to do that in
another way. For instance :

rule Class2MemoryType {
from a: UML2!Class (
a.isAbstract() and a.isStereotypeApplied('MemoryPartition'))
to p: AAXL!MemoryType ()
}

rule ClassGeneric {
from a: UML2!Class (
a.isAbstract() and a.isStereotypeApplied('
etc...

Best regards,

William

Skander a écrit :
> Hi,
> I would like to write a generic rule that calls a helper that computer
> the type of the metaclass that will be generated, i wrote this code
> (that doesn't work):
>
> helper context UML2!Class def : GenericComponentName () :
> AAXL!ComponentClassifier =
> if self.isStereotypeApplied('MemoryPartition') then
> AAXL!MemoryType
> else if self.isStereotypeApplied('SwSchedulableResource') then
> AAXL!ProcessType
> else
> AAXL!ComponentClassifier
> endif
> endif ;
>
> rule ClassGeneric {
> from a: UML2!Class (a.isAbstract())
> --ERROR HERE-- to p: oclType(a.GenericComponentName())(name <- a.name)}
>
> It seems that this is impossible to do this way because of the way ATL
> computes the atl transformation file, does anybody have an idea of how
> to do this?
>
>
Previous Topic:MARTE in km3
Next Topic:[QVTO] Input model parameter '...' is read-only!
Goto Forum:
  


Current Time: Fri Apr 26 07:48:36 GMT 2024

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

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

Back to the top