Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] var in imperative block
[ATL] var in imperative block [message #46952] Sat, 16 June 2007 11:25 Go to next message
Kelly  arcés is currently offline Kelly arcésFriend
Messages: 22
Registered: July 2009
Junior Member
Hello,

I am implementing an endpoint rule. is it possible to define local
variables in imperative block?. I defined variables in 'using' block, but
they has OclUndefined value when i used them in imperative block. An
example:

1 endpoint rule main() {
2 using {
3 t : Sequence(mm!T) = thisModule.getT();
4 e : mm2!E = OclUndefined;
5 s : String = '';
6 }
7 do {
8 for(tl in t){
9 ts = tl.ref;
10 e = thisModule.getE(ts);
11 }
12 }
13 }

When i execute 'ts' has values, but 'e' has OclUndefined. If i replace
line 10 by:
e = thisModule.getE(tl.ref);

'e' has values

Thanks in advance.
Re: [ATL] var in imperative block [message #47072 is a reply to message #46952] Sat, 16 June 2007 19:06 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

The = operator is a comparison operator in OCL.

To set the value of a variable, you have to use the <- operator.


Regards,

Frédéric Jouault

Kelly Garcés wrote:
> Hello,
>
> I am implementing an endpoint rule. is it possible to define local
> variables in imperative block?. I defined variables in 'using' block,
> but they has OclUndefined value when i used them in imperative block. An
> example:
>
> 1 endpoint rule main() {
> 2 using {
> 3 t : Sequence(mm!T) = thisModule.getT();
> 4 e : mm2!E = OclUndefined;
> 5 s : String = '';
> 6 }
> 7 do {
> 8 for(tl in t){
> 9 ts = tl.ref;
> 10 e = thisModule.getE(ts);
> 11 }
> 12 }
> 13 }
>
> When i execute 'ts' has values, but 'e' has OclUndefined. If i replace
> line 10 by: e = thisModule.getE(tl.ref);
>
> 'e' has values
>
> Thanks in advance.
>
>
Previous Topic:How to use ATL stand-alone
Next Topic:[ATL]How to do the MT whose source models are Java object instances in memory?
Goto Forum:
  


Current Time: Sat Apr 27 01:10:20 GMT 2024

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

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

Back to the top