[ATL] parameters in called rules [message #81558] |
Sun, 18 May 2008 04:22 |
|
Well, i m have a throble with a called rule. For instance, consider the
rules below.
rule MainRule {
from myObj:MyMetamodel!MyModel
using {
sequenceObj : Sequence (String) = Sequence{};
}
to
otherObj:MyMetamodel!MyModel(
mySequence <- sequenceObj
)
do {
self.toyRule(sequenceObj);
}
}
rule toyRule(parameter:Sequence(OclAny)) {
do {
parameter <- parameter->including('name');
}
}
Well, when i execute this transformation the value 'name' is not included
in otherObj.mySequence. And, the list manteins empty. So, i think that the
Sequence is passaed as copy to the called rule, but i wanna that this
Sequence should be passed as reference. Someone knowm how can i do it?
Thanks in advance,
Netuh
|
|
|
Re: [ATL] parameters in called rules [message #81755 is a reply to message #81558] |
Tue, 20 May 2008 15:22 |
Max Bureck Messages: 72 Registered: July 2009 |
Member |
|
|
Hello,
have you tried
parameter->append('name')
instead of
parameter <- parameter->including('name')
I did not try it. I am sorry, if it does not work.
My guess is, that parameter is a local variable in toyRule and the
including function generates a new sequence.
So assigning a new object to the local variable does not change the
passed sequence.
>
> Well, i m have a throble with a called rule. For instance, consider the
> rules below.
>
>
> rule MainRule {
> from myObj:MyMetamodel!MyModel
> using {
> sequenceObj : Sequence (String) = Sequence{};
> }
> to
> otherObj:MyMetamodel!MyModel(
> mySequence <- sequenceObj
> )
> do {
> self.toyRule(sequenceObj);
> }
> }
>
> rule toyRule(parameter:Sequence(OclAny)) {
> do {
> parameter <- parameter->including('name');
> }
> }
>
> Well, when i execute this transformation the value 'name' is not
> included in otherObj.mySequence. And, the list manteins empty. So, i
> think that the Sequence is passaed as copy to the called rule, but i
> wanna that this Sequence should be passed as reference. Someone knowm
> how can i do it?
>
> Thanks in advance,
> Netuh
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02646 seconds