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 Methods

 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 Methods

T * enumerate_int () const
T * next_int () const
void rehash ()
HashtableCore & operator= (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-2005 Cail Lomecb.
Generated at Fri Apr 29 02:50:05 2005 by doxygen 1.3-rc2.