winzip icon

clsStackCollection

Email
Submitted on: 1/28/2015 12:16:00 AM
By: Roger Gilchrist (from psc cd)  
Level: Advanced
User Rating: By 8 Users
Compatibility: VB 6.0
Views: 664
 
     Cls StackCollection Use VB's Collections to build stacks and queues. Also included a safety wrapper for collections. To operate as a stack/queue you do not need a separate key, everything is done using the index This class adds new Methods and Properties to VB collections. ArrayFromCollection Put contents of stack into an array ArrayToCollection Load members of an array into the stack Bottom: Returns first value added to stack Clear: Empty stack in one call Exists: Tests if index/Key is in stack. Uses error trap to test Optionally runs silent if error occurs Extract: Remove any member from stack Invert: Reverse order of stack Max: Returns the highest alphanumeric member of stack Middle: Returns Middle member of stack Min: Returns the lowest alphanumeric member of stack. Pop: Use collection as a LIFO (Last In First Out) stack, removes member from stack. Pull: Use collection as a FIFO (First In First Out) stack, removes member from stack. Push: Wrapper for VB standard Add. Push is used by both LIFO & FIFO stacks. QuickSort: Sort stack into alphanumeric order RandomMember: Extract a random member of the stack(Optional RemoveIt as Boolean = False); if True remove from stack Replace: Change the Item for an Index/Key Shuffle: Randomise the contents of the stack Top: Returns last value added to array I have also included a class ClsSafeCollection which wraps the standard collection in a safety net Add: Modified to allow you to cope with the various error conditions that can occur Count: VB standard Collection.Count Item: Modified to allow you to cope with the 'Index/Key does not exist' error Remove: Modified to allow you to cope with the 'Index/Key does not exist' error Please comment and vote. May just have reinvented the wheel for many of you but hope you find some use for it. Feel free to use all or parts of this but leave copyrights in place and let me know about it at rojagilkrist@hotmail.com
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 48 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.