[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: [Ecore] Does EMF has some utility in ecore to store referred EClass(s)

Wang,

Comments below.


Wang Liang wrote:
I'm sorry for my wrong representation. The following is the correct.

---------------------------------------------------------------------------


Assuming EClass A has a reference to EClass B, this reference is lower bound is 1 and upper bound is unbounded(like *). It looks like A--(1....*)-->B, right?
Yes.

However, if we want to represent it at runtime of a model, we need to represent (1....*), especially ecore model itself. So, my question is whether ecore has some runtime implementation like one referred many?
There's a whole hierarchy of classes for representing any reference whose upper bound is something other that 1. EObjectEList is the root of that hierarchy. Things like the lower bound are not absolutely enforced; clearly a list will start empty and if you want to clear a list so that it's empty again, you're allowed to do that regardless of the lower bound. But if you invoke Diagnostician.INSTANCE.validate, it will complain if the list's size isn't 1 or more.

And of course you can use XyzPackage.Literals.A__B.getUpperBound/getLowerBound to determine at runtime the bounds on the B feature of A...

Thanks.