### IAKeySortedBag

  A key sorted bag 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. Multiple elements are supported.

### IAKeySortedBag - Member Functions and Data by Group

### Constructors & Destructor

Construct and destruct objects of this class.

~IAKeySortedBag

      public:
      ~IAKeySortedBag()

  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

IAKeySortedBag
  Construct objects of this class.

  Exception

  IOutOfMemory

  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.

  Overload 1

      public:
      IAKeySortedBag(INotifier&)

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

Supported Platforms

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

  Overload 2

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

  Copy constructs a collection.

Supported Platforms

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

  Overload 3

      protected:
      IAKeySortedBag()

  This is the default constructor.

Supported Platforms

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

### Comparison

Use these members to compare two collections.

compare

      public:
      long
        compare( IAKeySortedBag < 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*, IACollection::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 IACollection::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

### IAKeySortedBag - 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&,
                         void * ) , void* additionalArgument = 0 )

  -     bool allElementsDo(IConstantApplicator < Element >&) const

  -     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& 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

  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& )

  -     INumber numberOfDifferentKeys() const

  -     INumber numberOfElementsWithKey(Key const&) const

  -     virtual INumber removeAllElementsWithKey(Key const&)

  -     virtual bool removeElementWithKey(Key const&)

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

  -     virtual bool replaceElementWithKey(Element const&)

  -     bool setToNextWithDifferentKey(ICursor&) const

  IAKeySortedCollection

  -     ~IAKeySortedCollection()

  -     IAKeySortedCollection(INotifier&)

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  IACollectionBase

  -     ~IACollectionBase()

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

  -     static ICursorImpl& CrsrImplOf(ICursor& cursor)

  -     IACollectionBase()

  -     IACollectionBase(IACollectionBase const&)

  -     static ICursor* InterfaceFor(ICursorImpl* cursor)

  IACollection

  -     IACollection()

  -     IACollection(IACollection < Element > const&)

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

  IAKeyCollection

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

  -     IAKeyCollection()

  IAKeySortedCollection

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

  -     IAKeySortedCollection()

#### Inherited Protected Data

  - None