On Mon, 18 Mar 2002, otisg wrote:
> - I don't know much about PriorityQueues, but somebody who seems to know
> more described the implementation in Lucene distribution as a clever
> one, so I thought that somebody who knows about it, such as you, may be
> able to take a quick look at Lucene's impl. and see if there is
> something clever in it and use it in Commons' PriorityQueue impl, or
> perhaps disagree with that statement.

I'll add it to my list.  :)

On quick review the algorithms are very similar (slight difference in
implementation detail like using bit shifts intead of multiplication and
division).  The "programming practices" that were supposedly better are
also very similar to the one found in commons, except the one in commons
is now even more flexible in that it takes objects that don't implement
Comparable (it also can be a minimum or maximim heap)

The biggest difference I see (in my very brief review) is the ability to
set a maximum size for the heap.  But I disagree within having the minimum
value removed and returned from push (in the commons PriortyQueue, this
would be equivalent to having the value returned from insert).  Push, in 
that case, has more functionality than just "pushing" a new value into the 
priority queue and may be confusing to some users.

> in any case, I'm going to commit my changes. If anyone has an objection,
> just -1 my commit, and I'll back out the changes.
> 
> - I have no Commons karma, I was just trying to help, hoping that
> multiple implementations of the same ADT can be eliminated and merged in
> a single impl.

Understood and agreed.  Feel free to encourage the lucene developers to
look at the commons' BinaryHeap in more detail.  I would hope they'll find
it meets their needs.  I have a feeling that Lucene is trying to stay 1.1
compatible, in which case using commons collections may be difficult as we
have standardized on 1.2.   Then again, the "improved" version of the 
lucene priority queue uses 1.2 specific API as well (Comparable was 
introduced in 1.2).  Maybe that might be a reason the new PriorityQueue 
implementation has not been committed to Lucene yet?

regards,
michael


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to