IAOrderedCollection

Because ordered collection is an abstract class, it cannot be used to create any objects. The ordered collection defines the interfaces for the property of ordered elements.


IAOrderedCollection - Member Functions and Data by Group

Constructors & Destructor

Construct and destruct objects of this class.


[view class]
~IAOrderedCollection
public:
~IAOrderedCollection()
Removes all elements from the collection. Destructors are called for all elements contained in the collection and for elements that have been constructed in advance.

Side Effects

All cursors of the collection become undefined.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IAOrderedCollection
Construct and destruct objects of this class.
Note: The collection constructor does not define whether any elements are constructed when the collection is constructed. For some classes, the element's default constructor may be invoked when the collection's constructor is invoked. This happens if a tabular or a diluted sequence implementation variant is used for a collection. The element's default constructor is used to allocate the required storage and initialize the elements. Therefore, a default constructor must be available for elements in such cases.

Exception

IOutOfMemory


Overload 1
public:
IAOrderedCollection(INotifier&)
Use this constructor to create a collection with support for notification.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IAOrderedCollection(IAOrderedCollection < Element > const&)
Copy constructs a collection.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
protected:
IAOrderedCollection()
The default constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Cursor Support

Set cursors to point at particular elements of the collection.


[view class]
setToLast
public:
bool setToLast(ICursor&) const
Sets the cursor to the last element of the collection in iteration order. If the collection is empty (if no last element exists), the given cursor is no longer valid.

Precondition

The cursor must belong to the collection.

Return Value

Returns true if the collection is not empty.

Exceptions

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setToPosition
public:
void setToPosition(IPosition, ICursor&) const
Sets the cursor to the element at the given position. Position 1 specifies the first element.

Precondition

Exceptions

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setToPrevious
public:
bool setToPrevious(ICursor&) const
Sets the cursor to the previous element in iteration order, or invalidates the cursor if no such element exists.

Preconditions

The cursor must belong to the collection and must point to an element of the collection.

Return Value

Returns true if a previous element exists.

Exception

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Element Access

Access particular elments in the collection.


[view class]
elementAtPosition
public:
Element const& elementAtPosition(IPosition) const

Returns a reference to the element at the given position in the collection.

Position 1 specifies the first element.

Position must be a valid position in the collection; that is, (1 <= position <= numberOfElements()).

Precondition

(1 <= position <= numberOfElements()).

Exception

IPositionInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
first
public:
Element const& first() const

Provides the same functionality as firstElement().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
firstElement
public:
Element const& firstElement() const

Returns a reference to the first element of the collection.

Precondition

The collection must not be empty.

Exception

IEmptyException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
last
public:
Element const& last() const
Provides the same functionality as lastElement().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
lastElement
public:
Element const& lastElement() const
Returns a reference to the last element of the collection.

Precondition

The collection must not be empty.

Exception

IEmptyException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Element Position Testing

See if a cursor is pointing at an element at a particular position in the collection.


[view class]
isFirst
public:
bool isFirst(ICursor const&) const
Provides the same functionality as isFirstAt().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isFirstAt
public:
bool isFirstAt(ICursor const&) const
Returns true if the given cursor points to the first element of the collection.

Preconditions

The cursor must belong to the collection and must point to an element of the collection.

Exception

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isLast
public:
bool isLast(ICursor const&) const
Provides the same functionality as isLastAt().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isLastAt
public:
bool isLastAt(ICursor const&) const
Returns true if the given cursor points to the last element of the collection.

Preconditions

The cursor must belong to the collection and must point to an element of the collection.

Exception

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
position
public:
IPosition position(ICursor const&) const
Provides the same functionality as positionAt().

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
positionAt
public:
IPosition positionAt(ICursor const&) const
Determines the position of the current element. position 1 specifies the position of the first element.

Preconditions The cursor must belong to the collection, and the cursor must point to an element of the collection.

Exceptions ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Remove Elements

Remove elements from the collection.


[view class]
removeAtPosition
public:
virtual void removeAtPosition(IPosition)
Removes the element from the collection that is at the given position. Element destructors are called as described in IACollection::removeAt.

The first element of the collection has position 1.

Precondition

Position must be a valid position in the collection; that is, (1 <= position <= numberOfElements()).

Side Effects

All cursors of this collection become undefined.

Exception

IPositionInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
removeFirst
public:
virtual void removeFirst()
Removes the first element from the collection. Element destructors are called as described in IACollection::removeAt.

Precondition

The collection must not be empty.

Side Effects

All cursors of this collection become undefined.

Exception

IEmptyException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
removeLast
public:
virtual void removeLast()
Removes the last element from the collection. Element destructors are called as described in IACollection::removeAt.

Precondition

The collection must not be empty.

Side Effects

All cursors of this collection become undefined.

Exception

IEmptyException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IAOrderedCollection - Inherited Member Functions and Data

Inherited Public Functions

IACollection

Inherited Public Data

Inherited Protected Functions

IACollectionBase
IACollection

Inherited Protected Data