Home | Modules | Class Hierarchy | Alphabetical List | Compound List | Related Pages

HashtableCore< T > Class Template Reference
[Common interfaces]

Inheritance diagram for HashtableCore< T >:

Hashtable< T > HashtableWOnulls< T >

Detailed Description

template<class T>
class HashtableCore< T >

Common hashtable template.

Has no suppositions about templated object structure.


Public Member Functions

 HashtableCore ()
 Default constructor.
 HashtableCore (int capacity, double loadFactor=DEFAULT_LOAD_FACTOR)
 Constructor with explicit hashtable size declaration.
virtual ~HashtableCore ()
 Default Destructor.
bool put (const String *key, T value)
 Puts object into hashtable.
bool remove (const String *key)
 Removes object from hashtable.
const Stringkey (int index) const
 Enumerates hashtable keys.
StringenumerateKey () const
 Starts internal hashtable enumeration procedure on keys.
Stringnextkey () const
 Returns the next key object with current enumeration procedure.
void clear ()
 Clears hashtable.
int size () const
 Number of objects, currently stored in hashtable.

Protected Member Functions

T * enumerate_int () const
T * next_int () const
void rehash ()
HashtableCoreoperator= (HashtableCore &)

Protected Attributes

int csize
int capacity
double loadFactor
HashEntry< T > ** bucket
HashEntry< T > * enum_he
int enum_bno


Constructor & Destructor Documentation

template<class T>
HashtableCore< T >::HashtableCore int  capacity,
double  loadFactor = DEFAULT_LOAD_FACTOR
 

Constructor with explicit hashtable size declaration.

Parameters:
capacity Initial capacity of Hashtable
loadFactor Initial loadFactor (0 < loadFactor < 1)


Member Function Documentation

template<class T>
bool HashtableCore< T >::put const String key,
value
 

Puts object into hashtable.

If such a key already exists, object is replaced.

Returns:
true, if object is replaced, false, if new object is inserted.

template<class T>
bool HashtableCore< T >::remove const String key  ) 
 

Removes object from hashtable.

If there is no record, associated with key, method does nothing.

Returns:
true, if object was removed

template<class T>
const String * HashtableCore< T >::key int  index  )  const
 

Enumerates hashtable keys.

Parameters:
index Internal index. Must be less, than size()

template<class T>
String * HashtableCore< T >::enumerateKey  )  const
 

Starts internal hashtable enumeration procedure on keys.

Returns:
First element's key value in a sequence, or null, if hashtable is empty.

template<class T>
String * HashtableCore< T >::nextkey  )  const
 

Returns the next key object with current enumeration procedure.

If hashtable state is changed, and nextkey() call occurs, exception is thrown. Note, that internal enumeration counter is one for keys and values methods - so, each of them iterates one sequence.

template<class T>
void HashtableCore< T >::clear  ) 
 

Clears hashtable.

Deletes all objects, stored in it.



Colorer-take5 Library. Copyright © 1999-2006 Igor Russkih.
Generated at Fri Nov 24 17:13:13 2006 by doxygen 1.4.6.