Samond Classes Library 1.2.1-RELEASE build 181
List of all members
SCStack Class Reference

Stack of objects class. More...

#import <SCStack.h>

Inheritance diagram for SCStack:
SCCollection SCObject <SCMutableCollection> <SCCollection>

Creating Stacks

(instancetype) + stackWithCoder:
 
(instancetype) + stackWithContentsOfSerializedFile:
 
(instancetype) + stackWithDataDictionary:
 
(instancetype) + stackWithDataDictionaryFromFile:
 
(instancetype) + stackWithStream:
 
(instancetype) + stackWithFileStream:
 
(instancetype) + stackWithName:
 
(instancetype) + stackWithObject:
 
(instancetype) + stackWithObjects:
 
(instancetype) + stackWithCollection:
 
(instancetype) + stackWithStack:
 
(instancetype) + stack
 

Initializing Stacks

(instancetype) - initWithName:
 
(instancetype) - initWithObject:
 
(instancetype) - initWithObjects:
 
(instancetype) - initWithCollection:
 
(instancetype) - initWithStack:
 
(instancetype) - init
 

Copying Stacks

(void) - setStack:
 

Comparing Stacks

(BOOL) - isEqualToStack:
 
(BOOL) - isEqualToContentsOfStack:
 

Pushing Objects

(void) - pushObject:
 
(void) - pushObjects:
 
(void) - pushCollection:
 

Poping Objects

(void) - pop
 
(id) - popObject
 

Removing Objects

(void) - removeTopObject
 

Copying Objects

(void) - duplicateTopObject
 

Querying a Stack

id topObject
 

Additional Inherited Members

- Instance Methods inherited from SCCollection
(void) - setCollection:
 
(void) - setObject:
 
(void) - setObjects:
 
(BOOL) - isEqualToCollection:
 
(BOOL) - isEqual:
 
(void) - enumerateWithDelegate:
 
(void) - enumerate
 
(void) - reverseEnumerateWithDelegate:
 
(void) - reverseEnumerate
 
(void) - addObjects:
 
(void) - addCollection:
 
(void) - removeObjectsWithClass:
 
(void) - removeObjectsWithClassName:
 
(void) - removeCollection:
 
(void) - removeObject:
 
(void) - removeObjects:
 
(BOOL) - containsObjects:
 
(BOOL) - containsCollection:
 
(BOOL) - containsAnyObject:
 
(BOOL) - containsAnyObjectFromCollection:
 
(BOOL) - isCollection
 
(BOOL) - isLibraryCollection
 
(BOOL) - isFoundationCollection
 
(BOOL) - isArray
 
(BOOL) - isLibraryArray
 
(BOOL) - isFoundationArray
 
(BOOL) - isSet
 
(BOOL) - isLibrarySet
 
(BOOL) - isFoundationSet
 
(BOOL) - isOrderedSet
 
(BOOL) - isLibraryOrderedSet
 
(BOOL) - isFoundationOrderedSet
 
(BOOL) - isDictionary
 
(BOOL) - isLibraryDictionary
 
(BOOL) - isFoundationDictionary
 
(BOOL) - isQueue
 
(BOOL) - isList
 
(BOOL) - isSortable
 
- Instance Methods inherited from SCObject
(instancetype) - initWithContentsOfSerializedFile:
 
(BOOL) - writeContentsToSerializedFile:
 
(instancetype) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(instancetype) - initWithFileStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
- Instance Methods inherited from <SCMutableCollection>
- Instance Methods inherited from <SCCollection>
- Class Methods inherited from SCCollection
(BOOL) + isCollectionClass:
 
(BOOL) + isLibraryCollectionClass:
 
(BOOL) + isFoundationCollectionClass:
 
(BOOL) + isArrayClass:
 
(BOOL) + isLibraryArrayClass:
 
(BOOL) + isFoundationArrayClass:
 
(BOOL) + isSetClass:
 
(BOOL) + isLibrarySetClass:
 
(BOOL) + isFoundationSetClass:
 
(BOOL) + isOrderedSetClass:
 
(BOOL) + isLibraryOrderedSetClass:
 
(BOOL) + isFoundationOrderedSetClass:
 
(BOOL) + isDictionaryClass:
 
(BOOL) + isLibraryDictionaryClass:
 
(BOOL) + isFoundationDictionaryClass:
 
(BOOL) + isStackClass:
 
(BOOL) + isQueueClass:
 
(BOOL) + isListClass:
 
(BOOL) + isSortableClass:
 
(BOOL) + isCollection:
 
(BOOL) + isLibraryCollection:
 
(BOOL) + isFoundationCollection:
 
(BOOL) + isArray:
 
(BOOL) + isLibraryArray:
 
(BOOL) + isFoundationArray:
 
(BOOL) + isSet:
 
(BOOL) + isLibrarySet:
 
(BOOL) + isFoundationSet:
 
(BOOL) + isOrderedSet:
 
(BOOL) + isLibraryOrderedSet:
 
(BOOL) + isFoundationOrderedSet:
 
(BOOL) + isDictionary:
 
(BOOL) + isLibraryDictionary:
 
(BOOL) + isFoundationDictionary:
 
(BOOL) + isStack:
 
(BOOL) + isQueue:
 
(BOOL) + isList:
 
(BOOL) + isSortable:
 
- Properties inherited from SCCollection
NSString * name
 
BOOL readOnly
 
id< SCCollectionDelegatedelegate
 
SCIndex count
 
BOOL empty
 
NSString * typeName
 
NSString * description
 
NSEnumerator * objectEnumerator
 
NSEnumerator * reverseObjectEnumerator
 
- Properties inherited from <SCCollection>
NSString * name
 
SCIndex count
 
BOOL empty
 
NSString * description
 
SCArrayarray
 
SCSetset
 
SCOrderedSetorderedSet
 
SCDictionarydictionary
 
SCStackstack
 
SCQueuequeue
 
SCUnidirectionalListunidirectionalList
 
SCBidirectionalListbidirectionalList
 
NSArray * foundationArray
 
NSSet * foundationSet
 
NSOrderedSet * foundationOrderedSet
 
NSDictionary * foundationDictionary
 
NSEnumerator * objectEnumerator
 

Detailed Description

Stack of objects class.

SDK
macOS 10.6+, iOS 7.0+
Since
version 1.1.3

Class implements the stack - a collection of objects with two principal operations: push, which adds an object to the stack, and pop, which removes the most recently added object that was not yet removed. The order in which objects come off a stack gives rise to its alternate name, LIFO (for last in, first out). Additionally, a get (peek) operation may give access to the top object without modifying the stack.

Class instances can thrown the following exceptions:

Method Documentation

- (void) duplicateTopObject

Duplicates the top object within the receiving stack.

Exceptions
SCCollectionException- collection error detected
- (instancetype) init

Initializes an empty unnamed stack.

Returns
A newly initialized stack
- (instancetype) initWithCollection: (id<SCCollection>)  collection

Initializes a newly allocated stack with objects from the specified collection of any supported type.

Parameters
collection- a collection with objects to add to the initialized stack
Returns
An initialized stack with the objects from a given collection
Exceptions
SCCollectionException- collection error detected

Reimplemented from SCCollection.

- (instancetype) initWithName: (NSString *)  name

Initializes an empty stack using the specified stack name.

Attention
Designed initializer
Parameters
name- the stack name
Returns
A newly initialized stack
- (instancetype) initWithObject: (id<SCCollectioning>)  object

Initializes a newly allocated stack containing a given object.

Parameters
object- the object to adding into the stack
Returns
An initialized stack containing a single object
- (instancetype) initWithObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Initializes a newly allocated stack containing objects from the specified list.

Parameters
object- the first object to add into the initialized stack
...- a null-terminated list of alternating objects to add into the initialized stack
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
An initialized stack containing the specified objects
- (instancetype) initWithStack: (SCStack *)  stack

Initializes a newly allocated stack by placing in it the objects contained in another given stack.

Attention
Designed initializer
Parameters
stack- a stack containing the objects with which to initialize the new stack
Returns
An initialized stack containing the objects found in the specified source stack
Exceptions
SCCollectionException- collection error detected
- (BOOL) isEqualToContentsOfStack: (SCStack *)  stack

Returns a boolean value that indicates whether the contents of the receiving stack are equal to the contents of another given stack.

Parameters
stack- the stack with which to compate the receiving stack
Returns
YES if the contents of the specified stack are equal to the contents of the receiving stack, otherwise NO
- (BOOL) isEqualToStack: (SCStack *)  stack

Returns a boolean value that indicates whether the settings and contents of the receiving stack are equal to the settings and contents of another given stack.

Parameters
stack- the stack with which to compare the receiving stack
Returns
YES if the settings and contents of the specified stack are equal to the settings and contents of the receiving stack, otherwise NO
- (void) pop

Removes from the receiving stack the top object without returning it.

Exceptions
SCCollectionException- collection error detected
- (id) popObject

Returns and removes the top object from the receiving stack.

Returns
A top object of the receiving stack or nil if the stack is empty
Exceptions
SCCollectionException- collection error detected
- (void) pushCollection: (id<SCCollection>)  collection

Pushes into the receiving stack the objects from a given collection of any supported type.

Parameters
collection- a collection of objects to add into the receiving stack
Exceptions
SCCollectionException- collection error detected
- (void) pushObject: (id<SCCollectioning>)  object

Pushes into the receiving stack the specified object.

Parameters
object- the pushed object
Exceptions
SCCollectionException- collection error detected
- (void) pushObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Pushes into the receiving stack the objects from a given list.

Parameters
object- the first object to push to the receiving stack
...- other objects from the null-terminated list to add to the receiving stack
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Exceptions
SCCollectionException- collection error detected
- (void) removeTopObject

Removes the top object from the receiving stack.

Exceptions
SCCollectionException- collection error detected
- (void) setStack: (SCStack *)  stack

Sets the settings and contents of the receiving stack to settings and objects in a given stack.

Parameters
stack- the source stack
Exceptions
SCCollectionException- collection error detected
+ (instancetype) stack

Creates and returns an unnamed empty stack.

Returns
A created stack

Reimplemented from SCCollection.

+ (instancetype) stackWithCoder: (NSCoder *)  coder

Returns a stack created by using the specified coder.

Parameters
coder- the source coder
Returns
A created stack
+ (instancetype) stackWithCollection: (id<SCCollection>)  collection

Returns a stack created by using the objects from the specified collection of any supported type.

Parameters
collection- the existing source collection
Returns
A created stack
Exceptions
SCCollectionException- collection error detected
+ (instancetype) stackWithContentsOfSerializedFile: (NSString *)  path

Returns a stack created by using the content of the serialized file with the specified path.

Parameters
path- the path of the source serialized file
Returns
A created stack
+ (instancetype) stackWithDataDictionary: (NSDictionary *)  dictionary

Returns a stack created by using the specified data dictionary.

Parameters
dictionary- the source data dictionary
Returns
A created stack
+ (instancetype) stackWithDataDictionaryFromFile: (NSString *)  path

Returns a stack created by using the data dictionary from the specified file.

Parameters
path- the path of the source data dictionary file
Returns
A created stack
+ (instancetype) stackWithFileStream: (NSString *)  path

Returns a stack created by using the data from the file stream with the specified path.

Parameters
path- the path of the source file stream
Returns
A created stack
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (instancetype) stackWithName: (NSString *)  name

Returns an empty stack created by using the specified stack name.

Parameters
name- the name of the new stack
Returns
A created stack
+ (instancetype) stackWithObject: (id<SCCollectioning>)  object

Creates and returns a stack containing a given object.

Parameters
object- the object to adding into the stack
Returns
A new stack containing a single object
+ (instancetype) stackWithObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Creates and returns a stack containing the objects from the specified list.

Parameters
object- the first object to add into the new stack
...- a null-terminated list of alternating objects to add into the new stack
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
A new stack containing the specified objects
+ (instancetype) stackWithStack: (SCStack *)  stack

Creates and returns a stack containing objects from another given stack.

Parameters
stack- a stack containing the objects with which to initialize the new stack
Returns
A new stack containing the objects found in the specified stack
Exceptions
SCCollectionException- collection error detected
+ (instancetype) stackWithStream: (SCStream *)  stream

Returns a stack created by using the data from the specified stream.

Parameters
stream- the source stream
Returns
A created stack
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected

Property Documentation

- (id) topObject
readnonatomicretain

The top object of the receiving stack


The documentation for this class was generated from the following files: