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 07:25 Go to next message
Kelly  arcés is currently offline Kelly arcés
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 15:06 Go to previous message
Frédéric Jouault is currently offline Frédéric Jouault
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: Wed Apr 23 20:51:24 EDT 2014

Powered by FUDForum. Page generated in 0.01525 seconds