[ATL] Copy sequences in Refining Mode [message #854962] |
Tue, 24 April 2012 11:51 |
st oehm Messages: 79 Registered: October 2009 |
Member |
|
|
Greetings,
I am using the ATL Refining Mode for refactoring operations on UML Class Diagrams.
For one operation, I would need to copy a sequence several times. Unluckily, the Refining Mode doesn't support lazy rules (yet). Consequently, I need another approach.
I tried it with a helper, where I define a new variable 'seqCopy' which should copy the original sequence and be returned by the helper (see code below - UML2 is the meta-model, Operation the context element on which the helper is invoked and the sequence consists of several Parameters).
helper context UML2!Operation def : copyParameterSequence(seq : Sequence(UML2!Parameter)) : Sequence(UML2!Parameter) =
let seqCopy: Sequence(UML2!Parameter) = seq->select(p | not p.oclIsUndefined()) in seqCopy;
Unfortunately, this fails. Either no copy is created, or the references from the Parameters are redirected from the original to the new sequence (I guess this is the case). Anyway, I am not getting several sequences.
I also tried several OCL sequence data type operations, namely append, prepend, excluding and including. Help says, these operations return a copy of self with some other modification depending on the actual operation.
Let's say, I use 'excluding':
rule someRule {
from
someOperation: UML2!Operation (
...
)
to
...,
newOperation: UML2!Operation (
...,
ownedParameter <- someOperation.ownedParameter.excluding(OclUndefined),
...
)
}
I thought, this might result in having a copy of the Parameters of the original Operation in the newly created Operation (according to the help text, it should). But again, if the transformation is executed it looks like some references are redirected from the old to the new Operation.
Does anyone have another idea how to copy sequences? Please keep in mind that I have to use the Refining Mode, so using lazy rules is not an option.
Thank you and best regards,
stoehm
|
|
|
Powered by
FUDForum. Page generated in 0.02398 seconds