FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Falloff Stack (or Silent Overflow Stack)

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
csauls



Joined: 27 Mar 2004
Posts: 278

PostPosted: Wed Oct 25, 2006 4:09 pm    Post subject: Falloff Stack (or Silent Overflow Stack) Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Wed Nov 01, 2006 3:43 pm    Post subject: Re: Falloff Stack (or Silent Overflow Stack) Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
teqdruid



Joined: 11 May 2004
Posts: 390
Location: UMD

PostPosted: Wed Nov 01, 2006 7:19 pm    Post subject: Re: Falloff Stack (or Silent Overflow Stack) Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group