lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Lucene BUG 9454
Date Tue, 04 Jun 2002 23:41:36 GMT
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.j.bomhoff@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:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message