IASequentialCollection

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


IASequentialCollection - Member Functions and Data by Group

Constructors & Destructor

Construct and destruct objects of this class.


[view class]
~IASequentialCollection
public:
~IASequentialCollection()
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]
IASequentialCollection
Construct or destruct a collection.


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:
IASequentialCollection(INotifier&)
Use this constructor to create a collection with support for notification.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IASequentialCollection( IASequentialCollection < Element > const& )
Copy constructor, which is hidden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
protected:
IASequentialCollection()
The default constructor, which is hidden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Add Elements

These methods add elements to the collection.


[view class]
addAsFirst
Adds the element to the collection as the first element in sequential order. Sets the cursor to the added element.

Preconditions

Side Effects

All cursors of this collection, except the given cursor, become undefined.

Exceptions


Overload 1
public:
virtual void addAsFirst(Element const&, ICursor&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual void addAsFirst(Element const&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
addAsLast
Adds the element to the collection as the last element in sequential order. Sets the cursor to the added element.

Preconditions

Side Effects

All cursors of this collection, except the given cursor, become undefined.

Exceptions


Overload 1
public:
virtual void addAsLast(Element const&, ICursor&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual void addAsLast(Element const&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
addAsNext
public:
virtual void addAsNext(Element const&, ICursor&)
Adds the element to the collection as the element following element pointed to by the cursor. Sets the cursor to the added element.

Preconditions

Side Effects

All cursors of this collection, except the given cursor, become undefined.

Exceptions

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
addAsPrevious
public:
virtual void addAsPrevious(Element const&, ICursor&)
Adds the element to the collection as the element preceding the element pointed to by the cursor. Sets the cursor to the added element.

Preconditions

Side Effects

All cursors of this collection, except the given cursor, become undefined.

Exceptions

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
addAtPosition
Adds the element at the given position to the collection, and sets the cursor to the added element. If an element exists at the given position, the new element is added as the element preceding the existing element.

Preconditions

Side Effects

All cursors of this collection, except the given cursor, become undefined.

Exceptions


Overload 1
public:
virtual void addAtPosition(IPosition, Element const&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual void addAtPosition( IPosition, Element const&, ICursor& )

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Element Access

These methods provide access to specific elements of the collection.


[view class]
any

Returns a reference to an arbitrary element of the collection.

Precondition

The collection must not be empty.

Exception

IEmptyException


Overload 1
public:
Element& any()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
Element const& any() const

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
elementAtPosition

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


Overload 1
public:
Element& elementAtPosition(IPosition)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
Element const& elementAtPosition(IPosition) const

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
first

Returns a reference to the first element of the collection.

Precondition

The collection must not be empty.

Exception

IEmptyException


Overload 1
public:
Element& first()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
Element const& first() const

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
last

Returns a reference to the last element of the collection.

Precondition

The collection must not be empty.

Exception

IEmptyException


Overload 1
public:
Element& last()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
Element const& last() const

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Element Ordering

These methods control ordering of the elements.


[view class]
reverse
public:
virtual void reverse()
This function reverses the sequence of elements in a collection. It is valid for all sequential collections:

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
sort
public:
virtual void sort( long ( * comparisonFunction ) ( Element const & , Element const & ) )
Sorts the collection so that the elements occur in ascending order. The relation of two elements is defined by the comparisonFunction, which you provide.


Note: The comparisonFunction must deliver a result according to the following rules:

>0
if (element1 > element2)
0
if (element1 == element2)
<0
if (element1 < element2)

Side Effects

All cursors of this collection become undefined.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IASequentialCollection - Inherited Member Functions and Data

Inherited Public Functions

IACollection
IAOrderedCollection

Inherited Public Data

Inherited Protected Functions

IACollectionBase
IACollection
IAOrderedCollection

Inherited Protected Data