|
|
Re: Setting a reference as eOpposite of itself? [message #428201 is a reply to message #428199] |
Fri, 13 March 2009 14:43 |
Patrick Konemann Messages: 116 Registered: July 2009 |
Senior Member |
|
|
Hi Ed,
Thanks for the quick reply.
At least for my case it would not be a big deal adding e.g. boxA to itself, there just needs to be a check that the add opposite is not called if the added element is itself, if I see it correctly.
So I guess I just change my generated code accordingly ;-)
Have a good weekend!
Patrick
On 13-03-2009 15:35, Ed Merks wrote:
> Patrick,
>
> Comments below.
>
>
> Patrick Könemann wrote:
>> Hi all,
>>
>> I wonder if it is possible to set an eReference itself from an eClass
>> to itself as eOpposite.
> No, this discussion has come up a few times before. A bidirectional
> reference in EMOF is a specialization of an association in CMOF and in
> CMOF an association's ends must be two different properties.
>> Huh, this sounds strange; here is a simple example model:
>>
>> EClass Box
>> - reference: Box relates (0..*) (eOpposite cannot be set, but I want
>> it to be 'relates')
>>
>> In the end, I would like to create many Boxes, some of them relating
>> to each other; this relation should be in both directions. I.e. if I
>> have two instances, boxA and boxB:
>>
>> boxA.relates = List []
>> boxB.relates = List []
>>
>> If something like boxA.getRelates().add(boxB) should result in:
>>
>> boxA.relates = List [boxB]
>> boxB.relates = List [boxA]
>>
>> Is that possible automatically or do I have to code it myself?
> It's even very tricky to try to implement it. Especially consider that a
> box might be related to itself...
>>
>> Cheers
>> Patrick
|
|
|
Powered by
FUDForum. Page generated in 0.01871 seconds