| EOpposite for multiple children [message #415520] |
Wed, 19 December 2007 11:09  |
Eclipse User |
|
|
|
Hi there,
maybe I didn't get the EOpposite right, because I can't figure this out:
I have a "Man" and a "Girl" and a "Boy" class, where the two latter
inherit from "Child".
The "Man" aggregates "daughters" and "sons" directly but not
additionally "children" to explicitly separate them.
Vice versa the "Child" is associated to its "father", and as "Girl" and
"Boy" inherit from "Child", each also has a "father".
Now I want to set "daughters" to EOpposite of "father". And for "sons"
respectively. This is not possible... why?
Cheers,
Hauke
|
|
|
|
| Re: EOpposite for multiple children [message #415526 is a reply to message #415520] |
Wed, 19 December 2007 13:52   |
Eclipse User |
|
|
|
Hauke,
We expect the opposite of the opposite to be the original feature. You
can define separate "father" features in Girl and Boy and define
EOperations on Child that match the signature of the "father" accessor
methods generated in the derived classes. As to why, well, an eOpposite
is a single valued feature so the "father" feature of the "Child" class
cannot have two different opposites...
Hauke Fuhrmann wrote:
> Hi there,
>
> maybe I didn't get the EOpposite right, because I can't figure this out:
>
> I have a "Man" and a "Girl" and a "Boy" class, where the two latter
> inherit from "Child".
> The "Man" aggregates "daughters" and "sons" directly but not
> additionally "children" to explicitly separate them.
> Vice versa the "Child" is associated to its "father", and as "Girl" and
> "Boy" inherit from "Child", each also has a "father".
>
> Now I want to set "daughters" to EOpposite of "father". And for "sons"
> respectively. This is not possible... why?
>
> Cheers,
> Hauke
>
|
|
|
| Re: EOpposite for multiple children [message #415527 is a reply to message #415524] |
Wed, 19 December 2007 13:54  |
Eclipse User |
|
|
|
Rich,
Sorry, I was on a call when I has already drafted my answer so I didn't
see that you'd already answered it well before I hit send after the
call. Thanks!
Rich Kulp wrote:
> This is because the relationship must be uniquely bi-directional and
> you can only have one EOpposite. For example for "father" the
> EOpposite is "children", while for "children" the EOpposite is
> "father". Because of this you can't have both "daughters" and "sons"
> to have the same EOpposite of "father". Then "father" would have two
> EOpposites.
>
> Hauke Fuhrmann wrote:
>> Hi there,
>>
>> maybe I didn't get the EOpposite right, because I can't figure this out:
>>
>> I have a "Man" and a "Girl" and a "Boy" class, where the two latter
>> inherit from "Child".
>> The "Man" aggregates "daughters" and "sons" directly but not
>> additionally "children" to explicitly separate them.
>> Vice versa the "Child" is associated to its "father", and as "Girl" and
>> "Boy" inherit from "Child", each also has a "father".
>>
>> Now I want to set "daughters" to EOpposite of "father". And for "sons"
>> respectively. This is not possible... why?
>>
>> Cheers,
>> Hauke
>
|
|
|
Powered by
FUDForum. Page generated in 0.04504 seconds