Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » local variables: self=IN!<unnamed>
local variables: self=IN!<unnamed> [message #1725463] Thu, 03 March 2016 16:30 Go to next message
Yi Zhu is currently offline Yi ZhuFriend
Messages: 9
Registered: March 2016
Location: Boston
Junior Member
Hi

I am working on a project for model transformation. I want to use the attribute of one class that is referenced by another
class. Among them, Datatype is a class that includes an attribute (name) and a refference (datatypep), Pattern is another class that
includes two attributes (pattern, constructor) and a refference (patternd), datatypep is the opposite reference for patternd.
but the compiler always show bug. Please help me. Thanks.

The bug:

org.eclipse.m2m.atl.engine.emfvm.VMException
at __initexpressions#125(Enumerative2Function.atl[64:51-64:84])
local variables: self=IN!<unnamed>

The ATL code:

helper context Enumeratives!Pattern def: DatatypeName : String =
if not self.datatypep.oclIsUndefined()
then
self.datatypep.name
else
''
endif;

helper def: FunctionNameProfix : String = 'eval_';

helper context Enumeratives!Pattern def: patterns : String =
if not self.pattern.oclIsUndefined()
then
if self.pattern = 'int'
then 'n'
else if self.pattern = '(' + thisModule.DatatypeName + ')'
then '(e)'
else if self.pattern = '(' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
then '(e1, e2)'
else if self.pattern = '(' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
then '(e1, e2, e3)'
else ''
endif
endif
endif
endif
else
''
endif;


rule P2C {
from
s : Enumeratives!Pattern
to
t : Functions!Clause (
clause <- s.constructor,
pattern <- s.patterns,
expression <- s.expressions
)
}

Best,

Yi


YI ZHU
Re: local variables: self=IN!&lt;unnamed&gt; [message #1725479 is a reply to message #1725463] Thu, 03 March 2016 18:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5622
Registered: July 2009
Senior Member
Hi

Maybe someone on the ATL newsgroup can help.

Regards

Ed Willink


On 03/03/2016 17:15, Yi Zhu wrote:
> Hi
>
> I am working on a project for model transformation. I want to use the
> attribute of one class that is referenced by another
> class. Among them, Datatype is a class that includes an attribute
> (name) and a refference (datatypep), Pattern is another class that
> includes two attributes (pattern, constructor) and a refference
> (patternd), datatypep is the opposite reference for patternd.
> but the compiler always show bug. Please help me. Thanks.
>
> The bug:
>
> org.eclipse.m2m.atl.engine.emfvm.VMException
> at __initexpressions#125(Enumerative2Function.atl[64:51-64:84])
> local variables: self=IN!<unnamed>
>
> The ATL code:
>
> helper context Enumeratives!Pattern def: DatatypeName : String =
> if not self.datatypep.oclIsUndefined()
> then self.datatypep.name
> else
> ''
> endif;
> helper def: FunctionNameProfix : String = 'eval_';
>
> helper context Enumeratives!Pattern def: patterns : String =
> if not self.pattern.oclIsUndefined()
> then
> if self.pattern = 'int'
> then 'n'
> else if self.pattern = '(' + thisModule.DatatypeName + ')'
> then '(e)'
> else if self.pattern = '(' + thisModule.DatatypeName + ',
> ' + thisModule.DatatypeName + ')'
> then '(e1, e2)'
> else if self.pattern = '(' + thisModule.DatatypeName
> + ', ' + thisModule.DatatypeName + ', ' + thisModule.DatatypeName + ')'
> then '(e1, e2, e3)'
> else ''
> endif
> endif
> endif
> endif
> else
> ''
> endif;
>
>
> rule P2C {
> from s : Enumeratives!Pattern
> to t : Functions!Clause (
> clause <- s.constructor,
> pattern <- s.patterns,
> expression <- s.expressions
> )
> }
>
> Best,
>
> Yi
Re: local variables: self=IN!&lt;unnamed&gt; [message #1725585 is a reply to message #1725479] Fri, 04 March 2016 14:59 Go to previous message
Yi Zhu is currently offline Yi ZhuFriend
Messages: 9
Registered: March 2016
Location: Boston
Junior Member
Thanks! I'll use the newsgroup to post my questions.

Best,

Yi


YI ZHU
Previous Topic:[QVTo] Java program->Model->QVTo Transformation->Model->Java program
Next Topic:When is a transformation declarative or imperative?
Goto Forum:
  


Current Time: Sun Feb 18 03:36:21 GMT 2018

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

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