[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.emf] containment co-existing with references for a property?

Hi,

Is it possible to have a class, B, have a property 'prop' of type C, that is either contained or referenced (contained in another class A)?

Phrased differently: Is it necessary to have one property for references and another for containment?

For example:

Class A can contain class B and C. Class B can contain class C. Can class B also have the possibility of referencing an instance of Class C contained in class A and contain another instance of Class C.

In some kind of pseudo XML notation:

<A>
 <B prop="//@A//@C.1">
  <C/>
 </B>
 <C/>
</A>

Written in java interfaces it would be something like the following code - with the unclear points marked XXX and YYY:

/** @model */
interface A {
  /** @model containment="true" */
  B getFoo();

  /** @model containment="true" XXX */
  C getSee()
}

/** @model */
interface B {
  /** @model containment=true YYY */
  C getProp();
}

Perhaps it is something to do with opposite="..."? or using both container="..." and contaiment="..."?

I must admit I haven't experimented much with it, but reading the documentation does not make the answer clear to me.

I think it would be a nice thing to be able to do. Imagine class C being, say, Image, and class B being Screen. Then some images would be used on different Screens and some would only belong to a single screen. It would be nice to be able to see that from the tree structure. Class A could then be the container of screens.

Thanks in advance,
/\/ikolaj