#import <ObjectiveLib/Queue.h>
Inheritance diagram for OLQueue:
Public Member Functions | |
(id) | - back |
Return the last item. | |
(int) | - compare: |
Compare this queue to another object. | |
(id) | - copy |
Make a copy of this queue. | |
(BOOL) | - empty |
Test whether the queue is empty. | |
(id) | - front |
Return the least recently added item. | |
(BOOL) | - isEqual: |
Return whether this queue is equal to another one. | |
(void) | - pop |
Remove the item at the front of the queue. | |
(void) | - push: |
Add an item to the back of the queue. | |
(unsigned) | - size |
Return the number of elements in the queue. | |
(void) | - writeSelfToStream: |
Write the object to a stream. | |
Initializers and Deallocators | |
(id) | - free |
Finalize the queue and deallocate any allocated memory. | |
(id) | - init |
Initialize the queue. | |
(id) | - initWithObjectInStream: |
Initialize the object. | |
(id) | - initWithQueue: |
Initialize the queue. | |
Static Public Member Functions | |
(id) | + queue |
Create and return a new queue. | |
(id) | + queueWithQueue: |
Create and return a new queue. | |
Protected Attributes | |
OLDeque * | deque |
The container that provides the underlying data structure. |
Elements may be added to the back of the queue and removed from the front. The element at the back (OLQueue) of the queue is the one added most recently, while the element at the front (OLQueue) is the one added least recently. The queue class just provides a restricted view of the underlying container OLDeque for occasions when only the simple functionality of a FIFO collection is required. It is not a true container because it does not provide iterators, so it cannot be used with generic algorithms.
- (id) back |
Return the last item.
The most recently added element is returned.
- (int) compare: | (id) | other |
Compare this queue to another object.
If the other object is of type OLQueue, the underlying deque of this object will compared to the underlying deque of other using the compare: (OLDeque) method.
other | the object with which to compare this one |
- (id) copy |
Make a copy of this queue.
- (BOOL) empty |
Test whether the queue is empty.
- (id) free |
Finalize the queue and deallocate any allocated memory.
- (id) front |
Return the least recently added item.
The element at the front of the queue is the one that will be removed by the message pop.
- (id) init |
Initialize the queue.
The queue is initially empty.
- (id) initWithObjectInStream: | (OLObjectInStream *) | stream |
Initialize the object.
Each instance variable is read from stream and all other initialization is performed.
stream | the stream from which to read |
Reimplemented from < OLStreamable >.
- (id) initWithQueue: | (OLQueue *) | queue |
Initialize the queue.
All objects are copied from queue into this queue.
queue | the queue that should be copied |
- (BOOL) isEqual: | (id) | object |
Return whether this queue is equal to another one.
Two queues are considered equal if they both contain the same number of objects that all return YES to the message isEqual:
and they are in the same order.
object | the object to test |
- (void) pop |
Remove the item at the front of the queue.
The element returned by the message front is removed from the queue.
- (void) push: | (id) | object |
Add an item to the back of the queue.
The element object will be added to the back of the queue and can be accessed with the message back.
object | the element to add |
+ (id) queue |
Create and return a new queue.
+ (id) queueWithQueue: | (OLQueue *) | right |
Create and return a new queue.
The queue is initialized with the contents of right.
right | the queue to copy into the new one |
- (unsigned) size |
Return the number of elements in the queue.
- (void) writeSelfToStream: | (OLObjectOutStream *) | stream |
Write the object to a stream.
All instance variables are written to stream.
stream | the stream to which to write. |
Reimplemented from < OLStreamable >.
|