|
|
|
Re: e[All]Contents [message #426681 is a reply to message #426680] |
Sat, 17 January 2009 19:52 |
Ed Merks 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. Is it a good trade-off? Perhaps not.<br>
<br>
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.<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 |
Enrico Schnepel 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
>>>>
>>>>
>>
>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02674 seconds