Samond Classes Library 1.2.6-STABLE build 219
List of all members
SCStack Class Reference

Stack of objects class. More...

#import <SCStack.h>

+ Inheritance diagram for SCStack:

Creating Stacks

(instancetype) + stackWithCoder:
 
(instancetype) + stackWithContentsOfSerializedFile:
 
(instancetype) + stackWithDataDictionary:
 
(instancetype) + stackWithDataDictionaryFromFile:
 
(instancetype) + stackWithStream:
 
(instancetype) + stackWithFileStream:
 
(instancetype) + stackWithData:
 
(instancetype) + stackWithContentsOfFile:
 
(instancetype) + stackWithContentsOfURL:
 
(instancetype) + stackWithContentsOfURLString:
 
(instancetype) + stackWithName:
 
(instancetype) + stackWithObject:
 
(instancetype) + stackWithObjects:
 
(instancetype) + stackWithCollection:
 
(instancetype) + stackWithArray:
 
(instancetype) + stackWithStack:
 
(instancetype) + stack
 

Initializing Stacks

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

Copying Stacks

(void) - setStack:
 

Comparing Stacks

(BOOL) - isEqualToStack:
 

Deriving New Stacks

(SCStack *) - stackByPushingObject:
 
(SCStack *) - stackByPushingObjects:
 
(SCStack *) - stackByPushingCollection:
 
(SCStack *) - stackByPushingObjectsFromArray:
 
(SCStack *) - stackByPushingArray:
 
(SCStack *) - stackByPushingObjectsFromStack:
 
(SCStack *) - stackByPushingStack:
 

Pushing Objects

(void) - pushObject:
 
(void) - pushObjects:
 
(void) - pushCollection:
 
(void) - pushObjectsFromArray:
 
(void) - pushArray:
 
(void) - pushObjectsFromStack:
 
(void) - pushStack:
 

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:
 
- Instance Methods inherited from SCObject
(instancetype) - initWithContentsOfSerializedFile:
 
(BOOL) - writeContentsToSerializedFile:
 
(instancetype) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(instancetype) - initWithFileStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
(instancetype) - initWithData:
 
(instancetype) - initWithContentsOfFile:
 
(instancetype) - initWithContentsOfURL:
 
(instancetype) - initWithContentsOfURLString:
 
(BOOL) - writeToFile:
 
(BOOL) - writeToURL:
 
(BOOL) - writeToURLString:
 
(NSData *) - data
 
- 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
 
SCIndex count
 
BOOL empty
 
BOOL readOnly
 
id< SCCollectionDelegatedelegate
 
NSString * typeName
 
NSEnumerator * objectEnumerator
 
NSEnumerator * reverseObjectEnumerator
 
SCArrayarray
 
SCSetset
 
SCOrderedSetorderedSet
 
SCDictionarydictionary
 
SCStackstack
 
SCQueuequeue
 
SCUnidirectionalListunidirectionalList
 
SCBidirectionalListbidirectionalList
 
NSArray * foundationArray
 
NSSet * foundationSet
 
NSOrderedSet * foundationOrderedSet
 
NSDictionary * foundationDictionary
 
SCCollectionType collectionType
 
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 SCObject
NSString * className
 
- Properties inherited from <SCCollection>
NSString * name
 
SCIndex count
 
BOOL empty
 
BOOL readOnly
 
id< SCCollectionDelegatedelegate
 
SCArrayarray
 
SCSetset
 
SCOrderedSetorderedSet
 
SCDictionarydictionary
 
SCStackstack
 
SCQueuequeue
 
SCUnidirectionalListunidirectionalList
 
SCBidirectionalListbidirectionalList
 
NSArray * foundationArray
 
NSSet * foundationSet
 
NSOrderedSet * foundationOrderedSet
 
NSDictionary * foundationDictionary
 
NSEnumerator * objectEnumerator
 
NSEnumerator * reverseObjectEnumerator
 
SCCollectionType collectionType
 
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
 

Detailed Description

Stack of objects class.

SDK
macOS 10.6+, iOS 7.0+, GNUstep
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

Reimplemented from SCCollection.

- (instancetype) initWithArray: (SCArray *)  array

Initializes a newly allocates stack with objects from a given array.

Parameters
array- an array with objects to add to the initialized stack
Returns
A newly initialized stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
- (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.
Designed initializer

Parameters
name- the stack name
Returns
A newly initialized stack

Reimplemented from SCCollection.

- (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) 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) pushArray: (SCArray *)  array

Pushes into the receiving stack objects from a given array.

Parameters
array- an array of objects to add into the receiving stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- pushObjectsFromArray:
- (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) pushObjectsFromArray: (SCArray *)  array

Pushes into the receiving stack objects from a given array.

Parameters
array- an array of objects to add into the receiving stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- pushArray:
- (void) pushObjectsFromStack: (SCStack *)  stack

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

Parameters
stack- a stack of objects to add into the receiving stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- pushStack:
- (void) pushStack: (SCStack *)  stack

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

Parameters
stack- a stack of objects to add into the receiving stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- pushObjectsFromStack:
- (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
- (SCStack *) stackByPushingArray: (SCArray *)  array

Returns a new stack that contains objects from the receiving stack and objects from a given array.

Parameters
array- an array with objects to add into the new stack
Returns
A new stack with objects from the receiving stack and objects from a given array
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- stackByPushingObjectsFromArray:
- (SCStack *) stackByPushingCollection: (id<SCCollection>)  collection

Returns a new stack that contains objects from the receiving stack and objects from a given collection.

Parameters
collection- a collection with objects to add into the new stack
Returns
A new stack with objects from the receiving stack and objects from a given collection
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
- (SCStack *) stackByPushingObject: (id<SCCollectioning>)  object

Returns the new stack that contains objects from the receiving stack and a pushed given object.

Parameters
object- the object to push into the new stack
Returns
A new stack with objects from the receiving stack and a given object
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
- (SCStack *) stackByPushingObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Returns a new stack that contains objects from the receiving stack and objects from the specified list.

Parameters
object- the first object to add into the new stack
...- a comma-separated list of additional objects, ending with nil pointer
NS_REQUIRES_NIL_TERMINATION- a mandatory nil pointer
Returns
A new stack with objects from the receiving stack and objects from the specified list
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
- (SCStack *) stackByPushingObjectsFromArray: (SCArray *)  array

Returns a new stack that contains objects from the receiving stack and objects from a given array.

Parameters
array- an array with objects to add into the new stack
Returns
A new stack with objects from the receiving stack and objects from a given array
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- stackByPushingArray:
- (SCStack *) stackByPushingObjectsFromStack: (SCStack *)  stack

Returns a new stack that contains objects from the receiving stack and objects from a given another stack.

Parameters
stack- a stack with objects to add into the new stack
Returns
A new stack with objects from the receiving stack and objects from a given another stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- stackByPushingStack:
- (SCStack *) stackByPushingStack: (SCStack *)  stack

Returns a new stack that contains objects from the receiving stack and objects from a given another stack.

Parameters
stack- a stack with objects to add into the new stack
Returns
A new stack with objects from the receiving stack and objects from a given another stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
See also
- stackByPushingObjectsFromStack:
+ (instancetype) stackWithArray: (SCArray *)  array

Returns a stack created by using the objects from a given array.

Parameters
array- a source array
Returns
A created stack
Exceptions
SCCollectionException- collection error detected
Since
version 1.2.3
+ (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) stackWithContentsOfFile: (NSString *)  path

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

Parameters
path- the path to the source file
Returns
A created stack
+ (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) stackWithContentsOfURL: (NSURL *)  url

Returns a stack created by using the specified URL.

Parameters
url- the source URL
Returns
A created stack
+ (instancetype) stackWithContentsOfURLString: (NSString *)  urlString

Returns a stack created by using the data from the URL with the specified string.

Parameters
urlString- the string of the source URL
Returns
A created stack
+ (instancetype) stackWithData: (NSData *)  data

Returns a stack created by using the specified data object.

Parameters
data- the source data object
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
readnonatomicassign

The top object of the receiving stack


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