[ATL] var in imperative block [message #46952] |
Sat, 16 June 2007 07:25  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.49754 seconds