commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Ralph.Wag...@web.de>
Subject Re: Re: Re: DepthFirstIterator
Date Tue, 06 Nov 2001 15:37:24 GMT
Thank you for reviewing it.

----- Original Message -----
Yes, may notice is wrong.
I found your idea very usefull.

public Object next() {
   if (!hasNext()) { //OK
   throw new NoSuchElementException();
  }

----- Original Message -----
From: <Ralph.Wagner@web.de>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Tuesday, November 06, 2001 2:19 PM
Subject: Re: Re: DepthFirstIterator


> What's wrong with it?
> If hasNext() is called twice without a call of next() inbetween,
> the second time nothing happens,
> because ((Iterator) mStack.peek()).hasNext() is true
> and the body of the while-loop is not executed.
> mStack is private, so the internal state change is not visible outside.
>
>
> ----- Original Message -----
> if is usefull Iterator implementation, but implemented incorrectly, method
> hasNext() in DepthFirstIterator has side effect  :
>
>  public boolean hasNext() {
>   while (!mStack.isEmpty() &&
>            !(((Iterator) mStack.peek()).hasNext())) {
> // this is a bug !!!
>   mStack.pop();
>   }
>   return !mStack.isEmpty();
>  }
>
> ----- Original Message -----
> From: <Ralph.Wagner@web.de>
> To: <commons-dev@jakarta.apache.org>
> Sent: Tuesday, November 06, 2001 11:19 AM
> Subject: DepthFirstIterator
>
>
> > Hi all,
> > I have written a class, two related interfaces and a helper class that I
> find quite useful and wanted to publish somehow. The jakarta commons
> collections seems to me the right place to do so.
> > The depth first iterator is written to traverse a tree-like structure
and
> can be used to perform an action on all nodes of a tree.
> >
> > (See attached file: SingletonIterator.java)(See attached file:
> CompositionView.java)(See attached file: DepthFirstIterator.java)(See
> attached file: Composition.java)
> >
> >
> > What do you think?
> > Ralph
> > ---------------------
> > email: Ralph.Wagner@web.de
> >
> > ________________________________________________________________
> > WEB.DE - das grosse Horoskop Gewinnspiel!
> > http://horoskop.web.de
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>
>
>
>
> ________________________________________________________________
> Lotto online tippen! Egal zu welcher Zeit, egal von welchem Ort.
> Mit dem WEB.DE Lottoservice. http://tippen2.web.de/?x=13
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:commons-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
 


____________________________________________________
Berufsunfähigskeitversicherung von Mamax bei WEB.DE. 
Jetzt informieren! http://bu.web.de


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message