### IAKeySortedSet

  A key sorted set is an ordered collection of zero or more elements that have a key. Elements are sorted according to the value of their key field. Element equality is not supported. Only elements with unique keys are supported. A request to add an element whose key already exists is ignored.

### IAKeySortedSet - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class.

~IAKeySortedSet

      public:
      ~IAKeySortedSet()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IAKeySortedSet

  Overload 1

      public:
      IAKeySortedSet(INotifier&)

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      IAKeySortedSet(IAKeySortedSet < Element, Key > const&)

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      protected:
      IAKeySortedSet()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Comparisons

Compares two collections.

compare

      public:
      long
        compare( IAKeySortedSet < Element,
                 Key > const&,
                 long ( * comparisonFunction ) ( Element const & ,
                 Element const & ) ) const

  Compares the collection with the given collection. Comparison yields <0 if the collection is less than the given collection, 0 if the collection is equal to the given collection, and >0 if the collection is greater than the given collection. Comparison is defined by the first pair of corresponding elements, in both collections, that are not equal. If such a pair exists, the collection with the greater element is the greater one. Otherwise, the collection with more elements is the greater one.
  Note:

  1. The given comparison function must return a result according to the following rules:
     >0
       if (element1 > element2)
     0
       if (element1 == element2)
     <0
       if (element1 < element2)
  2. For elements of type char*, compare() is not locale-sensitive by default. Because it uses strcmp() and not strcoll(), it compares the binary values representing the characters, and is not based on the LC_COLLATE category of the current locale. Its results are reliable only for code pages and character sets in which the collating sequence matches the sequence of binary representations. If you need a comparison based on the LC_COLLATE cateogory, then you must implement your own compare() function as described in Using Separate Functions in the Class Library User's Guide.

  Return Value

  Returns the result of the collection comparison.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Miscellaneous

Use these members to perform miscellaneous functions.

numberOfDifferentKeys

      protected:
      INumber numberOfDifferentKeys() const

  Returns the number of different keys in the collection.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

numberOfElementsWithKey

      protected:
      INumber numberOfElementsWithKey(Key const&) const

  Returns the number of elements in the collection with the given key.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAllElementsWithKey

      protected:
      INumber removeAllElementsWithKey(Key const&)

  Removes all elements from the collection with the same key as the given key. Element destructors are called as described in IACollection::removeAt.

  Side Effects

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

  Return Value

  The number of elements removed.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToNextWithDifferentKey

      protected:
      bool setToNextWithDifferentKey(ICursor&) const

  Sets the cursor to the next element in the collection in iteration order with a key different from the key of the element pointed to by the given cursor. If no such element exists, the given cursor is no longer valid.

  Preconditions

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

  Return Value

  Returns true if a subsequent element was found whose key is different from the current key.

  Exception

  ICursorInvalidException

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IAKeySortedSet - Inherited Member Functions and Data

#### Inherited Public Functions

  IACollection

  -     virtual ~IACollection()

  -     virtual bool add(Element const&)

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

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

  -     void adoptStreamer(IACollectionStreamer*)

  -     bool allElementsDo(IConstantApplicator < Element >&) const

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

  -     bool allElementsDo(IApplicator < Element >&)

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

  -     Element const& any() const

  -     Element const& anyElement() const

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

  -     INotifier& disableNotification()

  -     Element const& elementAt(ICursor const&) const

  -     Element& elementAt(ICursor 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 const& notifier() const

  -     INotifier& notifier()

  -     INotifier& notifyObservers(INotificationEvent const&)

  -     INumber numberOfElements() const

  -     virtual void operator <<=(IDataStream&)

  -     virtual void operator >>=(IDataStream&)

  -     operator INotifier &() const

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

  -     virtual INumber removeAll()

  -     virtual void removeAt(ICursor&)

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

  -     bool setToFirst(ICursor&) const

  -     bool setToNext(ICursor&) const

  IAKeyCollection

  -     ~IAKeyCollection()

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

  -     virtual bool addOrReplaceElementWithKey(Element const&)

  -     bool
          containsAllKeysFrom( IACollection < Element > const& ) const

  -     bool containsElementWithKey(Key const&) const

  -     Element& elementWithKey(Key const&)

  -     Element const& elementWithKey(Key const&) const

  -     IAKeyCollection(INotifier&)

  -     Key const& key(Element const&) const

  -     bool locateElementWithKey(Key const&, ICursor&) const

  -     bool locateNextElementWithKey(Key const&, ICursor&) const

  -     virtual bool locateOrAddElementWithKey(Element const&)

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

  -     virtual INumber removeAllElementsWithKey(Key const&)

  -     virtual bool removeElementWithKey(Key const&)

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

  -     virtual bool replaceElementWithKey(Element const&)

  IAKeySortedCollection

  -     ~IAKeySortedCollection()

  -     IAKeySortedCollection(INotifier&)

#### 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 < Element > const&)

  -     IACollection()

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

  IAKeyCollection

  -     IAKeyCollection(IAKeyCollection < Element, Key > const&)

  -     IAKeyCollection()

  IAKeySortedCollection

  -     IAKeySortedCollection()

  -     IAKeySortedCollection( IAKeySortedCollection < Element,
                               Key > const& )

#### Inherited Protected Data

  - None