Class DInternalHash (unit SDL) |
Inherits from
DAssociative
constructor Create; override;
- Creates this container using the default comparator (DObjectComparator).
constructor CreateFrom(another : DInternalHash);
constructor CreateWith(compare : DComparator); override;
- Creates this container using the specified comparator for ordering
elements.
function allowsDuplicates : Boolean; override;
Determine if this map permits duplicates.
destructor Destroy; override;
function finish : DIterator; override;
Returns an iterator positioned after the last item.
function maxSize : Integer; override;
Returns the absolute maximum number of items this hash map can hold.
procedure removeAt(iterator : DIterator); override;
Removes the pair the iterator is pointing to.
procedure removeIn(_start, _finish : DIterator); override;
Removes all pairs from start to finish.
procedure SetBucketClass(cls : DSequenceClass);
Choose a different class for the hash buckets.
procedure SetBucketCount(bCount : Integer);
Choose the number of buckets to be used.
function size : Integer; override;
Returns the number of pairs in this hash map.
function start : DIterator; override;
Returns an iterator positioned at the first pair in the hash map.
function startKey : DIterator; override;
Returns a key oriented iterator positioned at the first pair.
procedure _add(const obj : DObject); override;
Adds an object to this hash map.
function _count(const key : DObject) : Integer; override;
Return the number of pairs with keys equal to the specified key.
function _countValues(const value : DObject) : Integer; override;
Return the number of pairs with values equal to the specified value.
function _getAt(const key : DObject) : DObject; override;
Retrieve the value for a specified key.
function _locate(const key : DObject) : DIterator; override;
Returns an iterator positioned at the pair with the specified key.
procedure _putAt(const key, value : DObject); override;
Add the specified key, value pair to the map.
procedure _remove(const key : DObject); override;
Removes the all pairs with the specified key.
procedure _removeN(const key : DObject; count : Integer); override;
Removes the first count pairs with the specified key.
procedure _removeValueN(const value : DObject; count : Integer); override;
Removes the first pair with the specified value.
constructor Create; override;
Creates this container using the default comparator (DObjectComparator).
constructor CreateFrom(another : DInternalHash);
constructor CreateWith(compare : DComparator); override;
Creates this container using the specified comparator for ordering
elements.
function allowsDuplicates : Boolean; override;
Determine if this map permits duplicates.
destructor Destroy; override;
function finish : DIterator; override;
Returns an iterator positioned after the last item.
function maxSize : Integer; override;
Returns the absolute maximum number of items this hash map can hold.
procedure removeAt(iterator : DIterator); override;
Removes the pair the iterator is pointing to.
procedure removeIn(_start, _finish : DIterator); override;
Removes all pairs from start to finish.
procedure SetBucketClass(cls : DSequenceClass);
Parameter | Description |
---|
cls | The DSequence-derived class to use to store items that
collide on hash entries. Arrays are the tightested, but
don't have good deletion characteristics. Lists delete better,
but take up more space and iterate more slowly. |
Choose a different class for the hash buckets. Supported classes
are DSequence derivatives. It is an error to call this function if
the container is not empty.
procedure SetBucketCount(bCount : Integer);
Parameter | Description |
---|
bCount | The number of buckets to use. Using more buckets usually
reduces search time, but chews up more memory. You need
to decide on an appropriate tradeoff. The default is
128. |
Choose the number of buckets to be used. It is an error to call this
if the container is not empty.
function size : Integer; override;
Returns the number of pairs in this hash map.
function start : DIterator; override;
Returns an iterator positioned at the first pair in the hash map.
function startKey : DIterator; override;
Returns a key oriented iterator positioned at the first pair.
procedure _add(const obj : DObject); override;
Adds an object to this hash map.
function _count(const key : DObject) : Integer; override;
Return the number of pairs with keys equal to the specified key.
function _countValues(const value : DObject) : Integer; override;
Return the number of pairs with values equal to the specified value.
function _getAt(const key : DObject) : DObject; override;
Retrieve the value for a specified key. The key must exist in the map.
function _locate(const key : DObject) : DIterator; override;
Returns an iterator positioned at the pair with the specified key.
If the key is not found, the iterator is positioned at the end.
procedure _putAt(const key, value : DObject); override;
Add the specified key, value pair to the map. Copies are made of
the objects.
procedure _remove(const key : DObject); override;
Removes the all pairs with the specified key.
procedure _removeN(const key : DObject; count : Integer); override;
Removes the first count pairs with the specified key.
procedure _removeValueN(const value : DObject; count : Integer); override;
Removes the first pair with the specified value.