OSID Logo
OSID Specifications
osid package
Version 3.0.0
Release Candidate Preview
Interfaceosid.OsidList
Description

OsidList is the top-level interface for all OSID lists. An OSID list provides sequential access, one at a time or many at a time, access to a set of elements. These elements are not required to be OsidObjects but generally are. The element retrieval methods are defined in the sub-interface of OsidList where the appropriate return type is defined.

Osid lists are a once pass through iteration of elements. The size of the object set and the means in which the element set is generated or stored is not known. Assumptions based on the length of the element set by copying the entire contents of the list into a fixed buffer should be done with caution a awareness that an implementation may return a number of elements ranging from zero to infinity.

Lists are returned by methods when multiple return values are possible. There is no guarantee that successive calls to the same method will return the same set of elements in a list. Unless an order is specified in an interface definition, the order of the elements is not known.

MethodhasNext
Description

Tests if there are more elements in this list.

Returnboolean true if more elements are available in this list, false if the end of the list has been reached
CompliancemandatoryThis method must be implemented.
Provider Notes

Any errors that may result from accesing the underlying set of elements are to be deferred until the consumer attempts retrieval in which case the provider must return true for this method.

Methodavailable
Description

Gets the number of elements available for retrieval. The number returned by this method may be less than or equal to the total number of elements in this list. To determine if the end of the list has been reached, the method hasNext() should be used. This method conveys what is known about the number of remaining elements at a point in time and can be used to determine a minimum size of the remaining elements, if known. A valid return is zero even if hasNext() is true.

This method does not imply asynchronous usage. All OSID methods may block.

Returncardinalthe number of elements available for retrieval
CompliancemandatoryThis method must be implemented.
Provider Notes

Any errors that may result from accesing the underlying set of elements are to be deferred until the consumer attempts retrieval in which case the provider must return a positive integer for this method so the consumer can continue execution to receive the error. In all other circumstances, the provider must not return a number greater than the number of elements known since this number will be fed as a parameter to the bulk retrieval method.

Methodskip
Description

Skip the specified number of elements in the list. If the number skipped is greater than the number of elements in the list, hasNext() becomes false and available() returns zero as there are no more elements to retrieve.

Parameterscardinalnthe number of elements to skip
CompliancemandatoryThis method must be implemented.