#include <HashSet.h>
Inheritance diagram for IntKeyHashSet:
Definition at line 135 of file HashSet.h.
Public Member Functions | |
void | Add (long key) |
Adds a key to the hash set. | |
bool | Contains (long key) const |
Returns, if the hash set contains a given key. | |
bool | ContainsKey (void *key) const |
Returns, if the hash table contains a given key. | |
bool | ContainsKey (long key) const |
Returns, if the hash table contains a given key. | |
void | Delete (void *key) |
Removes a key/value pair from the hash table. | |
void | Delete (long key) |
Removes a key/value pair from the hash table and frees the memory of the value. | |
void | DeleteAll () |
Removes all key/value pairs from the hash table. | |
Void * | Get (void *key) const |
Returns the value of a key/value pair by its key. | |
Void * | Get (long key) const |
Returns the value of a key/value pair by its key. | |
PointeredList * | GetAll () const |
Returns a new PointeredList of all keys currently in the hash set. | |
long | GetCount () const |
Returns the number of set keys. | |
int | GetDesiredFillRatio () const |
Returns the fill ratio after a hash table resize. | |
int | GetFillRatio () const |
Returns the current fill ratio. | |
PointeredList * | GetKeys () const |
Returns a new PointeredList of all keys currently in the hash table. | |
long | GetSize () const |
Returns the number of buckets currently used. | |
PointeredList * | GetValues () const |
Returns a new PointeredList of all values currently in the hash table. | |
IntKeyHashSet (long initSize, int desiredFillRatio) | |
Creates a new int key hash set with customized settings. | |
IntKeyHashSet (long initSize) | |
Creates a new int key hash set with an initial size. | |
IntKeyHashSet () | |
Creates a new int key hash set. | |
bool | IsEmpty () const |
Returns whether there are no elements in the hash table. | |
void | Remove (long key) |
Removes a key from the hash set. | |
void | RemoveAll () |
Removes all keys from the hash set. | |
void | Set (void *key, Void *Value) |
Sets a key/value pair into the hash table. | |
void | Set (long key, Void *Value) |
Sets a key/value pair into the hash table. | |
Void * | Unset (void *key) |
Removes a key/value pair from the hash table. | |
Void * | Unset (long key) |
Removes a key/value pair from the hash table Afterwards, the method checks if the hash table has to be resized. | |
void | UnsetAll () |
Removes all key/value pairs from the hash table. | |
virtual | ~IntKeyHashSet () |
Destroys the int key hash set. | |
Protected Member Functions | |
virtual void * | CreateKey (void *key) const |
Creates the key object that shall be stored in the key buckets. | |
virtual void | DestroyKey (void *key) const |
Disposes a key created by the CreateKey method. | |
virtual bool | Equals (void *key1, void *key2) const |
Checks, if to keys equal each other. | |
virtual unsigned long | HashCode (void *key) const |
Returns the hash code of the key. | |
Protected Attributes | |
PointeredList ** | KeyBuckets |
The array of key buckets. | |
long | Size |
The number of buckets currently used. | |
PointeredList ** | ValueBuckets |
The array of value buckets. |
|
Creates a new int key hash set.
|
|
Creates a new int key hash set with an initial size.
|
|
Creates a new int key hash set with customized settings.
|
|
Destroys the int key hash set. The memory of the keys is not freed, since it was not acquired, |
|
Adds a key to the hash set. Afterwards, the method checks if the hash set has to be resized.
|
|
Returns, if the hash set contains a given key.
|
|
Returns, if the hash table contains a given key.
|
|
Returns, if the hash table contains a given key.
|
|
Creates the key object that shall be stored in the key buckets. The method receives a key and e.g. creates a clone, or uses the key directly, if this is possible. The Equals and HashCode method must return the same values when using the original key and the one returned by this method. The DestroyKey method disposes this key again. In the HashMap class, the key is returned directly.
Reimplemented in StringKeyHashMap< Void >. |
|
Removes a key/value pair from the hash table. The memory of the key is not freed, since it was not acquired, but the memory of the value is freed.
|
|
Removes a key/value pair from the hash table and frees the memory of the value.
|
|
Removes all key/value pairs from the hash table. The memory of the keys is not freed, since it was not acquired, but the memory of the values is freed. |
|
Disposes a key created by the CreateKey method. This can be done by freeing the memory, if the key was cloned, or by simply doing nothing, if the user's key was directly used. This method should do the opposite of the CreateKey method. In the HashMap class, this method does nothing, since the key was directly used.
Reimplemented in StringKeyHashMap< Void >. |
|
Checks, if to keys equal each other. In the HashMap class, this is true, if they point to the same memory.
Reimplemented in StringKeyHashMap< Void >, and ICStringKeyHashMap< Void >. |
|
Returns the value of a key/value pair by its key.
|
|
Returns the value of a key/value pair by its key.
|
|
Returns a new PointeredList of all keys currently in the hash set.
|
|
Returns the number of set keys.
Reimplemented in HashSet. |
|
Returns the fill ratio after a hash table resize.
|
|
Returns the current fill ratio. This is the ratio between the used hash table cells (Count), and the reserved cells (Size).
|
|
Returns a new PointeredList of all keys currently in the hash table.
|
|
Returns the number of buckets currently used.
|
|
Returns a new PointeredList of all values currently in the hash table.
|
|
Returns the hash code of the key. This is a value that has to be constant for the same key all the time, needs not to be injective, and should distribute the keys quite good.
Reimplemented from HashMap< Void >. |
|
Returns whether there are no elements in the hash table.
Reimplemented in HashSet. |
|
Removes a key from the hash set. Afterwards, the method checks if the hash set has to be resized. The memory of the key is not freed.
|
|
Removes all keys from the hash set. Afterwards, the method checks if the hash set has to be resized. The memory of the key is not freed. |
|
Sets a key/value pair into the hash table. Afterwards, the method checks if the hash table has to be resized. If the key existed, the old value is replaced, and its memory is freed.
|
|
Sets a key/value pair into the hash table. Afterwards, the method checks if the hash table has to be resized. If the key existed, the old value is replaced, and its memory is freed.
|
|
Removes a key/value pair from the hash table. Afterwards, the method checks if the hash table has to be resized. Both the memory of the key and the memory of the value are not freed, but the value is returned.
|
|
Removes a key/value pair from the hash table Afterwards, the method checks if the hash table has to be resized. The memory of the value is not freed, but returned.
|
|
Removes all key/value pairs from the hash table. Afterwards, the method checks if the hash table has to be resized. Both the memory of the keys and the memory of the values are not freed.
|
|
The array of key buckets.
|
|
The number of buckets currently used.
|
|
The array of value buckets.
|