Go to the previous, next section.
#include <nihcl/KeySortCltn.h>
A
KeySortCltn
is a
SortedCltn
that allows the sorting of value objects by means of separate key objects. Each element of the collection is actually a key/value pair, but the sorting of the elements within the collection is based upon the key values alone.
KeySortCltn(int
capacity
=DEFAULT_CAPACITY)
KeySortCltn
that can hold up to
capacity
objects. An
NIHCL_ALLOCSIZE
error is raised if
capacity
is not greater than 0. If an attempt is made to add more than
capacity
objects to a
KeySortCltn
,
reSize()
is called to increase its capacity.
virtual Assoc* addAssoc(Object&
key, Object&
value)
Assoc
) with the specified
key
and
value
objects, inserts it into this
KeySortCltn
in ascending order sorted on the
key
object, and returns a pointer to the newly constructed association. The caller is responsible for deleting this association when no longer needed.
virtual Collection& addValuesTo(Collection&
cltn) const
virtual Collection& addKeysTo(Collection&
cltn) const
KeySortCltn
in sorted order to the
Collection
cltn, and returns a reference to
cltn.
virtual Collection& addContentsBeforeTo(Object&
key, Collection&
cltn)
KeySortCltn
whose key objects are less than or equal to
key
to the
Collection
cltn, and returns a reference to
cltn.
virtual Object* atKey(Object&
key)
nil
if
key
is not found.
virtual LookupKey* assocAt(int i)
KeySortCltn
.
virtual Object* keyAt(int i)
virtual Object* valueAt(int i)
KeySortCltn
.
Go to the previous, next section.