### 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.

~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

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.

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

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

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

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

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

  - The cursor must belong to the collection.
  - If the collection is a map or a sorted map and contains an element with the same key as the given element, this element must be equal to the given element.
  - The element or key must exist, or (IACollection::maxNumberOfElements).

  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

  - IOutOfMemory
  - ICursorInvalidException
  - IFullException, if the collection is bounded
  - IKeyAlreadyExistsException, if the collection is a map or a sorted map

  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

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

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

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

  -     virtual ~IACollection()

  -     virtual bool add(Element const&, ICursor&)

  -     virtual bool add(Element const&)

  -     virtual void addAllFrom(IACollection < Element > const&)

  -     void adoptStreamer(IACollectionStreamer*)

  -     bool
          allElementsDo( bool ( * applicatorFunction ) ( Element const&,
                         void * ) , void* additionalArgument = 0 ) const

  -     bool
          allElementsDo( bool ( * applicatorFunction ) ( Element&,
                         void * ) , void* additionalArgument = 0 )

  -     bool allElementsDo(IConstantApplicator < Element >&) const

  -     bool allElementsDo(IApplicator < Element >&)

  -     Element const& any() const

  -     Element const& anyElement() const

  -     virtual void copy(IACollection < Element > const&)

  -     INotifier& disableNotification()

  -     Element& elementAt(ICursor const&)

  -     Element const& elementAt(ICursor const&) const

  -     INotifier& enableNotification(bool = true)

  -     IACollection(INotifier&)

  -     bool isBounded() const

  -     bool isConsistent() const

  -     bool isEmpty() const

  -     bool isEnabledForNotification() const

  -     bool isFull() const

  -     INumber maxNumberOfElements() const

  -     virtual ICursor* newCursor() const

  -     ICursor* newMngCursor() const

  -     INotifier& notifier()

  -     INotifier const& notifier() const

  -     INotifier& notifyObservers(INotificationEvent const&)

  -     INumber numberOfElements() const

  -     virtual void operator <<=(IDataStream&)

  -     virtual void operator >>=(IDataStream&)

  -     operator INotifier &() const

  -     virtual INumber removeAll()

  -     virtual INumber
          removeAll( bool ( * predicateFunction ) ( Element const&,
                     void * ) , void* additionalArgument = 0 )

  -     virtual void removeAt(ICursor&)

  -     virtual void replaceAt(ICursor const&, Element const&)

  -     bool setToFirst(ICursor&) const

  -     bool setToNext(ICursor&) const

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IACollectionBase

  -     ~IACollectionBase()

  -     static ICursorImpl& CrsrImplOf(ICursor& cursor)

  -     static ICursorImpl const& CrsrImplOf(ICursor const& cursor)

  -     IACollectionBase(IACollectionBase const&)

  -     IACollectionBase()

  -     static ICursor* InterfaceFor(ICursorImpl* cursor)

  IACollection

  -     IACollection()

  -     IACollection(IACollection < Element > const&)

  -     static Implementation&
          ImplOf( IACollection < Element > const& )

#### Inherited Protected Data

  - None