Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » ordering of eContents
ordering of eContents [message #415993] Tue, 15 January 2008 14:42 Go to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
I'm sure this has been asked before, but i couldn't find it. So here I go:

Does the ordering of the list returned by eContents() depend on the
order in which the elements have been added?

For example, if I have an EClass 'Model' with two containment refs
'imports' and 'types'
and I add elements to it like so:

model.getImports().add(impA);
model.getTypes().add(typeX);
model.getImports().add(impB);

Should I always get a list ordered like {impA, typeX, impB} when
invoking eContents() afterwards?
I do not, but I want to make sure that this is intended.

thanks,
Sven
Re: ordering of eContents [message #415996 is a reply to message #415993] Tue, 15 January 2008 16:17 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Sven,

No, there's nothing in EMF that keeps a temporal order. The order in
features is the order in which they are inserted in the list. The
overall eContents() order across features is controlled by the order of
the features in the EClass and then within features, the order in which
they appear in their list. If you define a type with mixed content,
then all the features would defer to the mixed content feature and in
that case you'd get things in a mixed order (which might not actually
conform to the schema).


Sven Efftinge wrote:
> I'm sure this has been asked before, but i couldn't find it. So here I
> go:
>
> Does the ordering of the list returned by eContents() depend on the
> order in which the elements have been added?
>
> For example, if I have an EClass 'Model' with two containment refs
> 'imports' and 'types'
> and I add elements to it like so:
>
> model.getImports().add(impA);
> model.getTypes().add(typeX);
> model.getImports().add(impB);
>
> Should I always get a list ordered like {impA, typeX, impB} when
> invoking eContents() afterwards?
> I do not, but I want to make sure that this is intended.
>
> thanks,
> Sven


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to assign the nodes with the link mapping in GMF
Next Topic:Memory-saving strategies (e.g. Partial XMI loading)?
Goto Forum:
  


Current Time: Thu Apr 25 13:14:26 GMT 2024

Powered by FUDForum. Page generated in 0.03340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top