[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: fastest way of accessing position, predecessor, successor of EMf list elements

Philipp,

This sounds little more like eObject.eContainer().eContents().indexOf(eObject) but I don't know OCL...


Philipp W. Kutter wrote:
Yes, exactly. I use OCL for it:

parent.elements->indexOf(self)


I somehow feel, this is not the optimal way...

Best, Philipp


Ed Merks wrote:
Philipp,

So you're doing something like this?

    List<?> values =
    (List<?>)eObject.eContainer().eGet(eObject.eContainmentFeature());
    int index = values.indexOf(eObject);

And then incrementing or decrementing index and checking it abounds the 0 or value.size()?


Philipp W. Kutter wrote:
Hi, Everybody.
I tried several ways to derive position, predecessor, and successor of
lists in earlier projects.

What is the best way doing this?

I remember starting with the EObject, finding its containing feature, geting the EList like this, and then looking it through.


Is there a faster, easier way?

Best, Philipp