Skip to main content



      Home
Home » Modeling » EMF » difference between "eContents" and "eAllContents"
difference between "eContents" and "eAllContents" [message #1739285] Fri, 29 July 2016 07:06 Go to next message
Eclipse UserFriend
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 07:07] by Moderator

Re: difference between "eContents" and "eAllContents" [message #1739360 is a reply to message #1739285] Sat, 30 July 2016 11:00 Go to previous messageGo to next message
Eclipse UserFriend
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 11:01] by Moderator

Re: difference between "eContents" and "eAllContents" [message #1739430 is a reply to message #1739360] Mon, 01 August 2016 05:13 Go to previous message
Eclipse UserFriend
Thank you!
Re: difference between &quot;eContents&quot; and &quot;eAllContents&quot; [message #1739745 is a reply to message #1739285] Fri, 29 July 2016 08:03 Go to previous message
Eclipse UserFriend
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.
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: Sat Jul 05 05:04:13 EDT 2025

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

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

Back to the top