Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Cloning intermediate class objects
[QVTO] Cloning intermediate class objects [message #859013] Fri, 27 April 2012 12:09 Go to next message
Christopher Gerking is currently offline Christopher GerkingFriend
Messages: 115
Registered: April 2011
Senior Member
I have an intermediate class within my transformation. Instances of that class refer to an OrderedSet of another type. Now, I need to perform a deepclone on such an intermediate class object.

I think that in general, intermediate classes lack a concept for cloning since their references do not distinguish between containments and non-containments. At runtime, all references seem to be treated as non-containments, which IMO implies that 'clone' and 'deepclone' have an equivalent behavior for intermediate classes.

Albeit, when I call clone or deepclone on an instance of my intermediate class, the cloned object refers to the same(!) OrderedSet as the original. Hence, modifying the OrderedSet within the original affects the clone and vice versa.

Normally, cloning objects with 0..* non-containments involves a new individual(!) sequence (OrderedSet in my case) that refers to the same objects as the original one. Why does my clone refer to the same OrderedSet?
Re: [QVTO] Cloning intermediate class objects [message #859059 is a reply to message #859013] Fri, 27 April 2012 12:35 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The weasel answer: The OMG specification is informal and uses vague
terminology such as sub-objects. In OCL 2.0, upon which QVT 1.0 and 1.1
is based, collections are not objects, so it could be argued that they
do not need copying. In OCL 2.2 Collections are Objects but collections
do not contain their content.

Pragmatically, intuitively sensible behaviour does not seem to be
satisfied. Please raise a QVTo bug.

Regards

Ed Willink


On 27/04/2012 13:09, Christopher G. wrote:
> I have an intermediate class within my transformation. Instances of
> that class refer to an OrderedSet of another type. Now, I need to
> perform a deepclone on such an intermediate class object.
>
> I think that in general, intermediate classes lack a concept for
> cloning since their references do not distinguish between containments
> and non-containments. At runtime, all references seem to be treated as
> non-containments, which IMO implies that 'clone' and 'deepclone' have
> an equivalent behavior for intermediate classes.
>
> Albeit, when I call clone or deepclone on an instance of my
> intermediate class, the cloned object refers to the same(!) OrderedSet
> as the original. Hence, modifying the OrderedSet within the original
> affects the clone and vice versa.
>
> Normally, cloning objects with 0..* non-containments involves a new
> individual(!) sequence (OrderedSet in my case) that refers to the same
> objects as the original one. Why does my clone refer to the same
> OrderedSet?
Previous Topic:[QVTO] Resolve on disjunctive mapping
Next Topic:ATL basic configuration problem. Please help !
Goto Forum:
  


Current Time: Fri Apr 26 14:20:54 GMT 2024

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

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

Back to the top