Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » e[All]Contents
e[All]Contents [message #426671] Fri, 16 January 2009 21:38 Go to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello,

What could be the reason that a call to eContents() gives a filled list of
the direct child elements but eAllContents() as well as
EcoreUtil.getAll[Proper]Contents() gives an empty list? This is very
mysterious to me. I am using Eclipse Ganymede. Any suggestions?

Thanks a lot

Enrico
Re: e[All]Contents [message #426672 is a reply to message #426671] Fri, 16 January 2009 21:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Enrico,

Comments below.


Enrico Schnepel wrote:
> Hello,
>
> What could be the reason that a call to eContents() gives a filled list of
> the direct child elements but eAllContents() as well as
> EcoreUtil.getAll[Proper]Contents() gives an empty list?
I recall a question like this a while back and the point of confusion
that time was the iterator used to support this is implemented as a list
of iterators.
> This is very
> mysterious to me.
I'm curious how you are determining that it's an empty list? After all,
it's an iterator being returned, not a list so have you called hasNext()
and then next() or are you letting the debugger convince you it's empty...
> I am using Eclipse Ganymede. Any suggestions?
>
Call hasNext on it...
> Thanks a lot
>
> Enrico
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: e[All]Contents [message #426680 is a reply to message #426672] Sat, 17 January 2009 16:26 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Thanks Ed, it works now. But I can't resist to ask why it extends List at
all if it does not behave like a list?

Greetings

Enrico

Ed Merks wrote:

> Enrico,
>
> Comments below.
>
>
> Enrico Schnepel wrote:
>> Hello,
>>
>> What could be the reason that a call to eContents() gives a filled list
>> of the direct child elements but eAllContents() as well as
>> EcoreUtil.getAll[Proper]Contents() gives an empty list?
> I recall a question like this a while back and the point of confusion
> that time was the iterator used to support this is implemented as a list
> of iterators.
>> This is very
>> mysterious to me.
> I'm curious how you are determining that it's an empty list? After all,
> it's an iterator being returned, not a list so have you called hasNext()
> and then next() or are you letting the debugger convince you it's empty...
>> I am using Eclipse Ganymede. Any suggestions?
>>
> Call hasNext on it...
>> Thanks a lot
>>
>> Enrico
>>
Re: e[All]Contents [message #426681 is a reply to message #426680] Sat, 17 January 2009 19:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020407010207050402090501
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Enrico,

I suppose it's an implementation detail that perhaps ought to have been
better hidden, though the alternative would be to have an object that
holds a list (stack actually) of iterators and that would take more
space and induce more garbage collection overhead than does the current
approach. Is it a good trade-off? Perhaps not.

With the advent of good debuggers, people tend to look farther under the
covers than they ought to. An example of this is revealed in how often
I see people doing instanceof AbcImpl or casting to AbcImpl (the
implementation) instead of Abc (the public API). It might seem
innocent enough, but because of multiple inheritance, there's no
guarantee that an Abc instance will necessarily be an AbcImpl instances.


Enrico Schnepel wrote:
> Thanks Ed, it works now. But I can't resist to ask why it extends List at
> all if it does not behave like a list?
>
> Greetings
>
> Enrico
>
> Ed Merks wrote:
>
>
>> Enrico,
>>
>> Comments below.
>>
>>
>> Enrico Schnepel wrote:
>>
>>> Hello,
>>>
>>> What could be the reason that a call to eContents() gives a filled list
>>> of the direct child elements but eAllContents() as well as
>>> EcoreUtil.getAll[Proper]Contents() gives an empty list?
>>>
>> I recall a question like this a while back and the point of confusion
>> that time was the iterator used to support this is implemented as a list
>> of iterators.
>>
>>> This is very
>>> mysterious to me.
>>>
>> I'm curious how you are determining that it's an empty list? After all,
>> it's an iterator being returned, not a list so have you called hasNext()
>> and then next() or are you letting the debugger convince you it's empty...
>>
>>> I am using Eclipse Ganymede. Any suggestions?
>>>
>>>
>> Call hasNext on it...
>>
>>> Thanks a lot
>>>
>>> Enrico
>>>
>>>
>
>

--------------020407010207050402090501
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Enrico,<br>
<br>
I suppose it's an implementation detail that perhaps ought to have been
better hidden, though the alternative would be to have an object that
holds a list (stack actually) of iterators and that would take more
space and induce more garbage collection overhead than does the current
approach.&nbsp; Is it a good trade-off?&nbsp; Perhaps not.<br>
<br>
With the advent of good debuggers, people tend to look farther under
the covers than they ought to.&nbsp; An example of this is revealed in how
often I see people doing instanceof AbcImpl or casting to AbcImpl (the
implementation) instead of Abc (the public API).&nbsp;&nbsp; It might seem
innocent enough, but because of multiple inheritance, there's no
guarantee that an Abc instance will necessarily be an AbcImpl instances.<br>
<br>
<br>
Enrico Schnepel wrote:
<blockquote cite="mid:gkt0re$52u$1@build.eclipse.org" type="cite">
<pre wrap="">Thanks Ed, it works now. But I can't resist to ask why it extends List at
all if it does not behave like a list?

Greetings

Enrico

Ed Merks wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Enrico,

Comments below.


Enrico Schnepel wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hello,

What could be the reason that a call to eContents() gives a filled list
of the direct child elements but eAllContents() as well as
EcoreUtil.getAll[Proper]Contents() gives an empty list?
</pre>
</blockquote>
<pre wrap="">I recall a question like this a while back and the point of confusion
that time was the iterator used to support this is implemented as a list
of iterators.
</pre>
<blockquote type="cite">
<pre wrap="">This is very
mysterious to me.
</pre>
</blockquote>
<pre wrap="">I'm curious how you are determining that it's an empty list? After all,
it's an iterator being returned, not a list so have you called hasNext()
and then next() or are you letting the debugger convince you it's empty...
</pre>
<blockquote type="cite">
<pre wrap="">I am using Eclipse Ganymede. Any suggestions?

</pre>
</blockquote>
<pre wrap="">Call hasNext on it...
</pre>
<blockquote type="cite">
<pre wrap="">Thanks a lot

Enrico

</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>

--------------020407010207050402090501--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: e[All]Contents [message #426682 is a reply to message #426681] Sat, 17 January 2009 20:24 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hi again,

Comments below...

Ed Merks wrote:

> Enrico,
>
> I suppose it's an implementation detail that perhaps ought to have been
> better hidden, though the alternative would be to have an object that
> holds a list (stack actually) of iterators and that would take more
> space and induce more garbage collection overhead than does the current
> approach. Is it a good trade-off? Perhaps not.

In my case I have used oAW to get the contents of a GMFGraph Canvas object.
As Canvas does not extend EObject in the metamodel I have to use a java
extension to call getEAllContents() because oAW doesn't know about the
operation. oAW interprets the return value as a List instead as an
Iterator. For EObject derived EClasses it is possible to call
getEAllContents as operation directly from oAW and the return value is
correctly interpreted. So it seems to be an issue for the oAW project.

Greetings

Enrico

>
> With the advent of good debuggers, people tend to look farther under the
> covers than they ought to. An example of this is revealed in how often
> I see people doing instanceof AbcImpl or casting to AbcImpl (the
> implementation) instead of Abc (the public API). It might seem
> innocent enough, but because of multiple inheritance, there's no
> guarantee that an Abc instance will necessarily be an AbcImpl instances.
>
>
> Enrico Schnepel wrote:
>> Thanks Ed, it works now. But I can't resist to ask why it extends List at
>> all if it does not behave like a list?
>>
>> Greetings
>>
>> Enrico
>>
>> Ed Merks wrote:
>>
>>
>>> Enrico,
>>>
>>> Comments below.
>>>
>>>
>>> Enrico Schnepel wrote:
>>>
>>>> Hello,
>>>>
>>>> What could be the reason that a call to eContents() gives a filled list
>>>> of the direct child elements but eAllContents() as well as
>>>> EcoreUtil.getAll[Proper]Contents() gives an empty list?
>>>>
>>> I recall a question like this a while back and the point of confusion
>>> that time was the iterator used to support this is implemented as a list
>>> of iterators.
>>>
>>>> This is very
>>>> mysterious to me.
>>>>
>>> I'm curious how you are determining that it's an empty list? After all,
>>> it's an iterator being returned, not a list so have you called hasNext()
>>> and then next() or are you letting the debugger convince you it's
>>> empty...
>>>
>>>> I am using Eclipse Ganymede. Any suggestions?
>>>>
>>>>
>>> Call hasNext on it...
>>>
>>>> Thanks a lot
>>>>
>>>> Enrico
>>>>
>>>>
>>
>>
Re: e[All]Contents [message #426771 is a reply to message #426682] Tue, 20 January 2009 11:01 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Enrico,

> In my case I have used oAW to get the contents of a GMFGraph Canvas object.
> As Canvas does not extend EObject in the metamodel I have to use a java
> extension to call getEAllContents() because oAW doesn't know about the
> operation.

In oAW *all* EMF objects extend something called emf::EObject which
provides a feature 'eAllContents : List[emf::EObject]'.

The implementation does nothing else than consuming the iterator
returned from the EMF API and put all the contents into a list.

> oAW interprets the return value as a List instead as an
> Iterator.

Really? I don't think Xpand interprets iterators as lists.

> For EObject derived EClasses it is possible to call
> getEAllContents as operation directly from oAW and the return value is
> correctly interpreted. So it seems to be an issue for the oAW project.

Could you please describe in more detail what you think the issue is?
And it would be nice if you could submit that description into bugzilla
for the M2T Xpand component.

thanks,
Sven
Previous Topic:[CDO] Setting timeout
Next Topic:Zipping and encrypting resource
Goto Forum:
  


Current Time: Sat Apr 27 04:37:24 GMT 2024

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

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

Back to the top