Stack of objects class.
More...
#import <SCStack.h>
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:
- (void) duplicateTopObject |
|
|
|
Duplicates the top object within the receiving stack.
- Exceptions
-
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
-
- 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
-
Reimplemented from SCCollection.
- (instancetype) initWithName: |
|
(NSString *) |
name |
|
Initializes an empty stack using the specified stack name.
Designed initializer
- Parameters
-
- Returns
- A newly initialized stack
Reimplemented from SCCollection.
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
-
- (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
Removes from the receiving stack the top object without returning it.
- Exceptions
-
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
-
- (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
-
- Since
- version 1.2.3
- See also
- - pushObjectsFromArray:
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
-
Pushes into the receiving stack the specified object.
- Parameters
-
object | - the pushed object |
- Exceptions
-
- (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
-
- (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
-
- 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
-
- 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
-
- Since
- version 1.2.3
- See also
- - pushObjectsFromStack:
Removes the top object from the receiving stack.
- Exceptions
-
- (void) setStack: |
|
(SCStack *) |
stack |
|
Sets the settings and contents of the receiving stack to settings and objects in a given stack.
- Parameters
-
- Exceptions
-
Creates and returns an unnamed empty stack.
- Returns
- A created stack
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
-
- Since
- version 1.2.3
- See also
- - stackByPushingObjectsFromArray:
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
-
- Since
- version 1.2.3
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
-
- Since
- version 1.2.3
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
-
- Since
- version 1.2.3
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
-
- Since
- version 1.2.3
- See also
- - stackByPushingArray:
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
-
- Since
- version 1.2.3
- See also
- - stackByPushingStack:
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
-
- 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
-
- Returns
- A created stack
- Exceptions
-
- Since
- version 1.2.3
+ (instancetype) stackWithCoder: |
|
(NSCoder *) |
coder |
|
Returns a stack created by using the specified coder.
- Parameters
-
- 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
-
+ (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
-
- 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
-
+ (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
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
-
+ (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
-
The top object of the receiving stack
The documentation for this class was generated from the following files: