View previous topic :: View next topic |
Author |
Message |
csauls
Joined: 27 Mar 2004 Posts: 278
|
Posted: Wed Oct 25, 2006 4:09 pm Post subject: Falloff Stack (or Silent Overflow Stack) |
|
|
This would be easily enough achieved either as a new subclass or as just an optional behavior of Stack, activated by calling an appropriate method (and/or perhaps in the ctor). Basically what it is: a stack created with a given size (which could be modified later, of course) which silently accepts new push's whenever it is full. To make room, the bottom of the stack silently "falls off" hence the name.
These would be nifty for undo buffers, user input memory (a la 'doskey'), and I'm sure a host of other things.
(Forgive me if this functionality is already present and I simply overlooked it.) _________________ Chris Nicholson-Sauls |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Wed Nov 01, 2006 3:43 pm Post subject: Re: Falloff Stack (or Silent Overflow Stack) |
|
|
csauls wrote: | This would be easily enough achieved either as a new subclass or as just an optional behavior of Stack, activated by calling an appropriate method (and/or perhaps in the ctor). Basically what it is: a stack created with a given size (which could be modified later, of course) which silently accepts new push's whenever it is full. To make room, the bottom of the stack silently "falls off" hence the name.
These would be nifty for undo buffers, user input memory (a la 'doskey'), and I'm sure a host of other things.
(Forgive me if this functionality is already present and I simply overlooked it.) |
You have not overlooked any existing functionality. Forgive me for taking so long to respond- I didn't see your message.
I'm right now mucking around with mango.containers (thanks to your last message) and while I'm in there- if I remember- I'll add this to the existing stack. Will let you know when it's in SVN.
~John |
|
Back to top |
|
|
teqdruid
Joined: 11 May 2004 Posts: 390 Location: UMD
|
Posted: Wed Nov 01, 2006 7:19 pm Post subject: Re: Falloff Stack (or Silent Overflow Stack) |
|
|
teqdruid wrote: | I'm right now mucking around with mango.containers (thanks to your last message) and while I'm in there- if I remember- I'll add this to the existing stack. Will let you know when it's in SVN. |
It's in SVN. Please take a look and let me know if it's what you expected- it's a new class- FalloffStack.
Question: is it worth breaking API and making "Stack" an interface with two implementations? I'm thinking I should either do that, or have FalloffStack inherit from Stack. I'm more inclined to make Stack an interface, since keeping Stack a class would basically force everyone to use the linked list based stack that's there now.
~John |
|
Back to top |
|
|
|