- Inherits from:
- Object
- Declared in:
- DHashTable.h
Object
|
+---DHashTable
Class Description
The hash table collection class implements a number of methods for creating, inserting
searching and removing objects in a hash table.
- Last modified:
- 27-Feb-2005 (DHashTable.h)
Instance Variables
- private DHashNode **_table
- the actual table with the nodes
- private Class _class
- the class of the key
- private unsigned long _size
- the size of the table
- private long _count
- the number of nodes in the hash table
- private double _load
- the load factor before resising >0.0
- private unsigned long _threshold
- the threshold for resizing
- Constructors
- - (DHashTable *) init :(Class) key
- Initialise an empty hash table with a default size and load
- Parameters:
- key - the class of the key (conforms DDatable and DComparable)
- Returns:
- the object
- - (DHashTable *) init :(Class) key :(unsigned long) size :(double) load
- Initialise an empty hash table with an initial size
- Parameters:
- key - the class of the key (conforms DDatable and DComparable)
size - the initial size of the table
load - the load factor for resizing
- Returns:
- the object
- Copy related methods
- - deepen
- Deepen a copy of the object (not implemented)
- Returns:
- the object
- Destructor
- - free
- (Deep) free the hash table (the stored objects are *FREED*)
- Returns:
- the object
- - shallowFree
- Free the hash table (the objects are *NOT* freed)
- Returns:
- the object
- Member methods
- - (BOOL) isEmpty
- Check if the hash table is empty
- Returns:
- is it?
- - (long) length
- Return the number of elements
- Returns:
- the length
- - (double) load
- Return the load factor
- Returns:
- the factor
- - (DHashTable *) load :(double) load
- Set the load factor
- Parameters:
- load - the new load factor (> 0.0)
- Returns:
- the object
- - (unsigned long) size
- Return the size of the hash table
- Returns:
- the size
- - (DHashTable *) size :(unsigned long) size
- Set the size of the hash table
- Parameters:
- size - the new size for the table
- Returns:
- the object
- Hash table manipulation
- - (id) delete :(id) key
- Remove a key,object from the hash table
- Parameters:
- key - the key to be removed
- Returns:
- the object (or nil for not found)
- - (DHashTable *) each :(SEL) sel
- Perform a method for every object in the hash table
- Parameters:
- sel - the selector of the method
- Returns:
- the object
- - (id) get :(id) key
- Return the object related to the key in the hash table
- Parameters:
- key - the key to be checked
- Returns:
- the object related to the key (or nil)
- - (BOOL) has :(id) key
- Check if the hash table has a certain key
- Parameters:
- key - the key to be checked
- Returns:
- is the key present
- - (BOOL) insert :(id) key :(id) object
- Insert a key,object in the hash table
- Parameters:
- key - the key to be inserted
object - the object to be inserted
- Returns:
- success
- List related functions
- - (DList *) keys
- Return a list with copies of all keys in the hash table
- Returns:
- a (new) list with all the keys
- - (DList *) objects
- Return a list with copies of all the objects in the hash table
- Returns:
- a (new) list with all the objects
generated 08-Jan-2006 by ObjcDoc 3.0.0