You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Otis Gospodnetic <ot...@yahoo.com> on 2002/06/05 01:41:36 UTC

Re: Lucene BUG 9454

I just wrote a little test and I think you are correct.
I'll look at it a little more and commit the fix if needed.

Thanks!
Otis


--- "M.J. Bomhoff" <m....@student.utwente.nl> wrote:
> Hello,
> 
> You commented on my bug as follows:
>  > Are you sure about that?
>  > This is what the code looks like.  As far as I can tell this
> should 
> take care of
>  > the last element, as well, no?
> 
> 
>  >  public final void clear() {
>  >    for (int i = 0; i < size; i++)
>  >      heap[i] = null;
>  >    size = 0;
>  >  }
> 
> imagine adding one element:
> 
> you call put(element);
> the element gets put at heap[1], because size is incremented before
> the 
> heap[size] = element gets called.
> then we call upheap(). This changes nothing, because we only have one
> 
> element.
> so we have:
> 
> heap[0] == null
> heap[1] == element
> ...
> 
> now we call clear() and heap[0] gets set to null, but heap[1] remains
> 
> the same...
> 
> Or did I miss something? In that case I'm really sorry I bothered
> you...
> 
> greetings,
> 
> Matthijs Bomhoff
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>