Version 1.0, Copyright ã1994 by Doug McClure.  All Rights Reserved.

MiscStorageCursorPositioning

Adopted By:	MiscStorage

Declared In:	MiscProtocols.h

Protocol Description

The MiscStorageCursorPositioning protocol is a set of calls for a Storage class for moving through.  These methods let you set a cursor which keeps track of the current positiong in a StorageStorage class.  The rest of the methods allow a program to move forward, backward, and to determine the current position.  This protocol is designed for loop constructs.

Method Types

Setting the position	- setFirstElement
- setLastElement
- setNextElement
- setPreviousElement
- setTo:

Querying the position	- currentPosition

Instance Methods

currentPosition
- (unsigned int)currentPosition

Returns the index of the record to which the cursor is currently pointing.

setFirstElement
- (void *)setFirstElement

Sets the cursor to point to the first record in the container and returns that record.  Returns nil if the container holds no records. 

setLastElement
- (void *)setLastElement

Sets the cursor to point to the last record in the container and returns that record.  Returns nil if the container holds no records. 

setNextElement
- (void *)setNextElement

Sets the cursor to point to the next record in the container and returns that record.  Returns nil and doesn't move the cursor if it's currently pointing to the last record.

setPreviousElement
- (void *)setPreviousElement

Sets the cursor to point to the previous record in the container and returns that record.  Returns nil and doesn't move the cursor if it's currently pointing to the first record.

setTo:
- (void *)setTo:(unsigned int)index

Sets the cursor to point to the index'th record in the container and returns that record.  Returns nil and doesn't move the cursor if index is out of bounds.