avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Stansbury" <stansbu...@earthlink.net>
Subject Re: [Excalibur] PriorityQueue & BinaryHeap proposal
Date Wed, 07 Nov 2001 14:59:59 GMT
Ah, that's good to see.  I omitted the 'break backwards-compatibility'
option because I simply don't know who this might impact.  Like you mention,
by having the PriorityQueue interface constrain the contents of the queue to
Comparables, it's limiting the implementation possibilities.

Anyhoo, I will go ahead and implement #2 for backwards compatibility
purposes, and also implement a non-backwards compatible version that accepts
and returns Objects.  I will then hand these off to you and let you deal
with it.

Thanks, Chad

----- Original Message -----
From: "Peter Donald" <donaldp@apache.org>
To: "Avalon Developers List" <avalon-dev@jakarta.apache.org>
Sent: Wednesday, November 07, 2001 7:49 AM
Subject: Re: [Excalibur] PriorityQueue & BinaryHeap proposal

> On Thu, 8 Nov 2001 01:04, Chad Stansbury wrote:
> > Okay - here's the problem.  The current BinaryHeap interface expects a
> > Comparable for it's public interface.  In order to maintain backwards
> > compatibility I must either:
> >
> > 1. Add new public methods to the BinaryHeap class (e.g., insertObject,
> > peekObject, popObject) and change the insert, peek, and pop methods to
> > invoke these new methods, or
> > 2. I can create a new BinaryObjectHeap class and have the BinaryHeap
> > act as a wrapper class.
> >
> > I am also wondering how I would modify the PriorityQueue interface w/o
> > breaking backwards compatibility...
> >
> > Any suggestions would be appreciated.
> I am not sure we need to maintain 100% backwards compatability in this
> peek() and pop() methods in al cases that I use them and have seen them
> will actually need to be cast to something else anyways. Retrieving a
> Comparable from heap is rarely the aim and come to think of it I think it
> probably a mistake to return Comparables rather than Objects ;)
> For insert there will need to be backwards compatability because people
> use that to pass in comparables. However you should be ab;le to get
> compatability with this by just checking the type passed in (if Comparable
> X, else do Y) and converting parameter to Object.
> --
> Cheers,
> Pete
> --------------------------------------------------------------
> "Science is like sex: sometimes something useful comes out,
> but that is not the reason we are doing it" -- Richard Feynman
> --------------------------------------------------------------
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message