Release 1.0  Copyright ©1993 by Don Yacktman.  All Rights Reserved.





MiscStack




Inherits From: List
Declared In: misckit/MiscStack.h



Class Description

A MiscStack is a version of the List object that acts like a stack.  That is, it allows you to add objects to the List and subsequently remove the most recently added object first, ie. a last in, first out (LIFO) data structure.  To use the MiscStack, use the - pushObject: method to push objects onto the stack.  To pop the top object from the MiscStack, use the -popObject method.  The -topObject method returns the topmost object on the stack, the object which will be popped next.  You may also use any of the standard List methods to manipulate the objects in the MiscStack, if you wish.  The next item to leave the MiscStack is the item at the end of the MiscStack, and objects with higher position numbers will exit the MiscStack before objects with lower position numbers.  (In other words, the higher the position number of the object, the more recently it was pushed onto the stack.)

Note that the actual implementation of this class favors simplicity and speed.  Perhaps a future version will have more stack manipulation features, such as rolling and swapping objects.



Method Types

Pushing and Popping Objects - popObject
- pushObject:
- topObject:



Instance Methods

popObject
- popObject

Pops one object from the MiscStack.  Returns the popped object.

See also:  -pushObject:




pushObject:
- pushObject:anObject

Pushes anObject onto the MiscStack.  Returns self.

See also:  -popObject




topObject
- topObject

Returns the topmost object on the stack (the one that will be popped next).

See also:  -topObject