IAEqualityCollection

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


IAEqualityCollection - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~IAEqualityCollection
public:
~IAEqualityCollection()

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]
IAEqualityCollection


Overload 1
public:
IAEqualityCollection(INotifier&)

Use this constructor to create a collection with support for notification.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IAEqualityCollection( IAEqualityCollection < Element > const& )

Constructs a collection from another collection.

Exception

IOutOfMemory

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
protected:
IAEqualityCollection()

The default constructor. The collection is unbounded and is initially empty. If the estimated maximum is exceeded, the collection is automatically enlarged.


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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Miscellaneous

Use these members to execute miscellaneous operations.


[view class]
contains
public:
bool contains(Element const&) const

Returns true if the collection contains an element equal to the given element.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
containsAllFrom
public:
bool containsAllFrom(IACollection < Element > const&) const

Returns true if all the elements of the given collection are contained in the collection. The definition of containment is described in IAEqualityCollection::contains

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
locate
public:
bool locate(Element const&, ICursor&) const

Locates an element in the collection that is equal to the given element. Sets the cursor to point to the element in the collection, or invalidates the cursor if no such element exists.

If the collection contains several such elements, the first element in iteration order is located.

Precondition

The cursor must belong to the collection.

Return Value

Returns true if an element was found.

Exceptions

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
locateNext
public:
bool locateNext(Element const&, ICursor&) const

Locates the next element in iteration order in the collection that is equal to the given element, starting at the element next to the one pointed to by the given cursor. Sets the cursor to point to the element in the collection. The cursor is invalidated if the end of the collection is reached and no more occurrences of the given element are left to be visited.
Note: If you code a call to IACollection::locateFirst and a set of calls to IASet::locateNext, each occurrence of an element will be visited exactly once in iteration order.

Precondition

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

Return Value

Returns true if an element was found.

Exception

ICursorInvalidException

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
locateOrAdd

Locates an element in the collection that is equal to the given element. (See IAEqualityCollection::locate for details on locate().) If no such element is found, locateOrAdd adds the element as described in IACollection::add. The cursor is set to the located or added element.
Note: This method may be more efficient than using locate() followed by a conditionally called IACollection::add.

Preconditions

Side Effects

If the element was added, all cursors of this collection, except the given cursor, become undefined.

Return Value

Returns true if the element was located. Returns false if the element could not be located but had to be added.

Exceptions


Overload 1
public:
virtual bool locateOrAdd(Element const&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual bool locateOrAdd(Element const&, ICursor&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
numberOfOccurrences
public:
INumber numberOfOccurrences(Element const&) const

Returns the number of occurrences of the given element in the collection.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
remove
public:
virtual bool remove(Element const&)

Removes an element in the collection that is equal to the given element. If no such element exists, the collection remains unchanged. In collections with nonunique elements, an arbitrary occurrence of the given element will be removed. Element destructors are called as described in IACollection::removeAt.

Side Effects

If an element was removed, all cursors of this collection become undefined. become undefined.

Return Value

Returns true if an element was removed.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
removeAllOccurrences
public:
virtual INumber removeAllOccurrences(Element const&)

Removes all elements from the collection that are equal to the given element, and returns the number of elements removed. Element destructors are called as described in IACollection::removeAt.

Side Effects

If any elements were removed, all cursors of this collection become undefined.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IAEqualityCollection - Inherited Member Functions and Data

Inherited Public Functions

IACollection

Inherited Public Data

Inherited Protected Functions

IACollectionBase
IACollection

Inherited Protected Data