Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » difference between "eContents" and "eAllContents"
difference between "eContents" and "eAllContents" [message #1739285] Fri, 29 July 2016 11:06 Go to next message
aurel pestell is currently offline aurel pestellFriend
Messages: 90
Registered: October 2013
Location: Sweden
Member
Hi,

I looked at the documentation but still wondering how "EObject.eContents()" and "EObject.eAllContents()" compare.
I analyzed a random EObject instance and "EObject.eContents()" return something when "EObject.eAllContents()" returns nothing.

Thanks.

[Updated on: Fri, 29 July 2016 11:07]

Report message to a moderator

Re: difference between "eContents" and "eAllContents" [message #1739360 is a reply to message #1739285] Sat, 30 July 2016 15:00 Go to previous messageGo to next message
Aurélien Mora is currently offline Aurélien MoraFriend
Messages: 38
Registered: July 2014
Member
Hello,

eContents returns an EList of the directly contained EObjects (all "containment" references ).
eAllContents returns a TreeIterator with all contained EObjects, deeply (all contained EObjects in contained EObjects and so on).

You can use eAllContents like this :

TreeIterator<EObject> it = anEObject.eAllContents();
while(it.hasNext())
{
	EObject eo = it.next();
			
	// Do something
}

[Updated on: Sat, 30 July 2016 15:01]

Report message to a moderator

Re: difference between "eContents" and "eAllContents" [message #1739430 is a reply to message #1739360] Mon, 01 August 2016 09:13 Go to previous message
aurel pestell is currently offline aurel pestellFriend
Messages: 90
Registered: October 2013
Location: Sweden
Member
Thank you!
Re: difference between &quot;eContents&quot; and &quot;eAllContents&quot; [message #1739745 is a reply to message #1739285] Fri, 29 July 2016 12:03 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31900
Registered: July 2009
Senior Member
Comments below.


On 29.07.2016 13:06, aurel pestell wrote:
> Hi,
>
> I looked at the documentation but still wondering how
> "EObject.eContents()" and "EObject.eAllContents()" compare.
> I looked in a random EObject and "EObject.eContents()" return
> something when "EObject.eAllContents()" returns nothing.
Well, one returns a list and the other an iterator so I'm not sure you
how concluded "nothingness" in either case because in both cases a
non-null value is definite returned. The eAllContents is basically an
iterator over the containment tree, so it will most definitely return
all the objects that are in eContents, but in addition to that, each
subtree's eContents is visited recursively.
>
> Thanks.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Re: difference between &quot;eContents&quot; and &quot;eAllContents&quot;
Next Topic:Re: difference between &quot;eContents&quot; and &quot;eAllContents&quot;
Goto Forum:
  


Current Time: Mon Jun 14 13:11:44 GMT 2021

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

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

Back to the top