A sorted set is an ordered collection of zero or more elements with element equality but no key. Only unique elements are supported. A request to add an element that already exists is ignored. The value of the elements is relevant.
The elements of a sorted set are ordered such that the value of each element is less than or equal to the value of its successor.
The element with the smallest value currently in a sorted set is called the first element. The element with the largest value is called the last element. When an element is added, it is placed in the sorted set according to the defined ordering relation.
Use these members to construct or destruct objects of the class.
![]() |
public:
~IASortedSet()
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IASortedSet(INotifier&)
Use this constructor to create a collection with support for notification.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
IASortedSet(IASortedSet < Element > const&)
Constructs a collection.
The collection is unbounded and is initially empty.
Exception
IOutOfMemory
Note:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
IASortedSet()
This is the default constructor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members as comparison operators.
![]() |
public:
long compare( IASortedSet < Element > 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.
Return Value
Returns the result of the collection comparison.
Note:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to perform miscellaneous tasks.
![]() |
public:
virtual void addDifference( IASortedSet < Element > const&, IASortedSet < Element > const& )
Creates the difference between the two given collections, and adds this difference to the collection. The contents of the added elements, not the pointers to those elements, are copied.
For a definition of the difference between two collections, see differenceWith.
Preconditions
Because the elements are added one by one, the following preconditions are tested for each individual addition.
Side Effects
If any elements were added, all cursors of this collection become undefined.
Exceptions
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual void addIntersection( IASortedSet < Element > const&, IASortedSet < Element > const& )
Creates the intersection of the two given collections, and adds this intersection to the collection. The contents of the added elements, not the pointers to those elements, are copied.
For a definition of the intersection of two collections, see intersectionWith.
Preconditions
Because the elements are added one by one, the following preconditions are tested for each individual addition.
Side Effects
If any elements were added, all cursors of this collection become undefined.
Exceptions
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual void addUnion( IASortedSet < Element > const&, IASortedSet < Element > const& )
Creates the union of the two given collections, and adds this union to the collection. The contents of the added elements, not the pointers to those elements, are copied.
For a definition of the union of two collections, see unionWith.
Preconditions
Because the elements are added one by one, the following preconditions are tested for each individual addition.
Side Effects
If any elements were added, all cursors of this collection become undefined.
Exceptions
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual void differenceWith(IASortedSet < Element > const&)
Makes the collection the difference between the collection and the given collection. The difference of A and B (A minus B) is the set of elements that are contained in A but not in B.
The following rule applies for bags with duplicate elements: If bag P contains the element X m times and bag Q contains the element X n times, the difference of P and Q contains the element X m-n times if m> n, and zero times if m<=n.
Side Effects
If any elements were removed, all cursors of this collection become undefined.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual void intersectionWith( IASortedSet < Element > const& )
Makes the collection the intersection of the collection and the given collection. The intersection of A and B is the set of elements that is contained in both A and B.
The following rule applies for bags with duplicate elements: If bag P contains the element X m times and bag Q contains the element X n times, the intersection of P and Q contains the element X MIN(m,n)times.
Side Effects
If any elements were removed, all cursors of this collection become undefined.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean operator !=(IASortedSet < Element > const&) const
Returns true if the cursor does not point to the same element (of the same collection) as the given cursor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean operator ==(IASortedSet < Element > const&) const
Returns true if the cursor points to the same element (of the same collection) as the given cursor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual void unionWith(IASortedSet < Element > const&)
Makes the collection the union of the collection and the given collection. The union of A and B is the set of elements that are members of A or B or both.
The following rule applies for bags with duplicate elements: If bag P contains the element X m times and bag Q contains the element X n times, the union of P and Q contains the element X m+n times.
Preconditions
Because the elements from the given collection are added to the collection one by one, the following preconditions are tested for each individual add operation :
Side Effects
If any elements were added to the collection, all cursors of this collection become undefined.
Exceptions
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
INumber numberOfOccurrences(Element const&) const
Returns the number of occurrences of the given element in the collection.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
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 removeAt.
Side Effects
If any elements were removed, all cursors of this collection become undefined.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
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& 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( 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
~IAOrderedCollection()
Element const& elementAtPosition(IPosition) const
Element const& first() const
Element const& firstElement() const
IAOrderedCollection(INotifier&)
bool isFirst(ICursor const&) const
bool isFirstAt(ICursor const&) const
bool isLast(ICursor const&) const
bool isLastAt(ICursor const&) const
Element const& last() const
Element const& lastElement() const
IPosition position(ICursor const&) const
IPosition positionAt(ICursor const&) const
virtual void removeAtPosition(IPosition)
virtual void removeFirst()
virtual void removeLast()
bool setToLast(ICursor&) const
void setToPosition(IPosition, ICursor&) const
bool setToPrevious(ICursor&) const
~IASortedCollection()
IASortedCollection(INotifier&)
IACollection()
IACollection(IACollection < Element > const&)
static Implementation& ImplOf( IACollection < Element > const& )
IAOrderedCollection(IAOrderedCollection < Element > const&)
IAOrderedCollection()
IASortedCollection(IASortedCollection < Element > const&)
IASortedCollection()