commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <>
Subject RE: [Commons-Avalon:collections] Buffer integration [was: code integration]
Date Thu, 20 Jun 2002 20:08:58 GMT
> From: Jack, Paul [] 
> Okay, thought I'd try to prove my point by actually doing
> it.  Attached is a version of FixedSizeBuffer that implements 
> Collection.  Also attached is a unit test for 
> FixedSizeBuffer. It extends our TestCollection class which is 
> pretty thorough. Operations are confirmed against an 
> ArrayList to make sure that the Buffer still contains the 
> right elements in the right 
> order, so the odds of something biting us in the butt later 
> are greatly reduced.
> Note that the add(Object) and remove() methods haven't 
> changed. (Well, okay, see the PS below).
> It passes all the tests.  See?  Minimal effort, full 
> collections compatibility.  Essentially all I had to do was 
> implement the iterator.  (And I'm pretty sure 
> VariableSizeBuffer can re-use the same iterator, though I'd 
> have to look more closely).

You win.  I loose (the argument).  We all win.

Let's get the stuff moved over...


> Regarding the naming issue, if it'll avoid collisions within 
> Jarkata, I guess I'm okay with Buffer as a name.  But maybe 
> FifoBuffer instead?  Or just Fifo?  Hm.  I'm just looking for 
> something that makes it apparent at a glance what the class is for...

Fifo or FifoBuffer are good names.

I thought Buffer was good enough at the time.

> -Paul
> PS  I made add(Object) return a boolean to be compatible with 
> the Collection interface; also, I used NoSuchElementException 
> and IllegalStateException, but only because it reduced the 
> number of files I had to attach here.  I'm okay with using 
> the Overflow/Underflow exceptions too, I was just trying to 
> make my point quickly...

Cool.  The Overflow/Underflow exceptions are more specific to
the FifoBuffer, so I'd like to keep them--at least in respects
to add()/remove()

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message