Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » converting nodes
converting nodes [message #415230] Thu, 06 December 2007 10:33 Go to next message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
I have a somewhat rare spec I need to implement.

I have three elements. A, B and C. A is a super class of both A and B.

The user needs to be able to choose an A element, and then convert it to
B or C. Similarly choose B or C and convert it to A.

Is this even possible?


Best Regards,

Tomas Zijdemans
Re: converting nodes [message #415232 is a reply to message #415230] Thu, 06 December 2007 11:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tomas,

I'm sure the A is a super class of A is a typo. Probably you mean "of B
and C". Since a B and a C will be an A, I assume there's no
conversion required. I suppose you might literally mean you want to
create an instance of an A that's a copy of B or C but only with A's
feature set. In any case, I could imagine doing either direction of
the conversion by specializing EcoreUtil.Copier. This utility generally
will make a copy but you could specialize it so that copying A will
create a B or a C instead, and then allow the rest of the logic to
continue as normal. In the other direction, i.e., when copying B or C,
you'd actually create an A, and then you'd need some additional
specialization to ensure that features in B or C but not in A are ignored...


Tomas Zijdemans wrote:
> I have a somewhat rare spec I need to implement.
>
> I have three elements. A, B and C. A is a super class of both A and B.
>
> The user needs to be able to choose an A element, and then convert it
> to B or C. Similarly choose B or C and convert it to A.
>
> Is this even possible?
>
>
> Best Regards,
>
> Tomas Zijdemans


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: converting nodes [message #415235 is a reply to message #415232] Thu, 06 December 2007 13:24 Go to previous message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
Ed Merks wrote:
> Tomas,
>
> I'm sure the A is a super class of A is a typo. Probably you mean "of B
> and C".
Yep :)
Since a B and a C will be an A, I assume there's no
> conversion required. I suppose you might literally mean you want to
> create an instance of an A that's a copy of B or C but only with A's
> feature set.
Yes. The purpose is that after an instance is created (of A, B or C),
the user might change his/hers mind and think something like: "This A
should rather be a B, now that I think about it...".


Thanks for helping,

Tomas
Previous Topic:Should the order of eSuperType entries matter?
Next Topic:Possible noob issue with xsi:type
Goto Forum:
  


Current Time: Fri Apr 26 16:15:57 GMT 2024

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

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

Back to the top