jcpp::StringHash Class Reference

#include <StringHash.h>

Inheritance diagram for jcpp::StringHash:

Inheritance graph
[legend]
Collaboration diagram for jcpp::StringHash:

Collaboration graph
[legend]

List of all members.

Public Member Functions

int size ()
boolean isEmpty ()
StringEnumerationkeys ()
 keys will be enumerated as (char *)
Enumerationelements ()
boolean contains (Object *value)
boolean containsKey (char *key)
CFREE char ** charKeysToArray (int &ka_length)
Objectget (const char *key)
Objectget (const std::string key)
CONST char * getKey (char *key)
Objectput (const char *key, Object *value)
Objectput (const std::string key, Object *value)
Objectremove (const char *key)
void clear ()
Objectclone ()
CFREE char * toString ()
boolean containsValue (Object *o)
void rehash (int &RehashError)

Private Member Functions

int calculateBucket (register const char *str)

Private Attributes

StringHashBucket ** table
int table_length
int N
float loadFactor
int numberOfKeys
int rehashLimit
char ** okeys
Object ** oelements


Detailed Description

how to write a lousy hash class, by Ben Allan, 7/99. Note this used to have string template class dependencies that have been removed.

Member Function Documentation

StringEnumeration* jcpp::StringHash::keys (  ) 

keys will be enumerated as (char *)

CFREE char** jcpp::StringHash::charKeysToArray ( int &  ka_length  ) 

Create array of keys used in table. The array returned should be freed, but the keys in it should not. The keys will expire if the hashtable is destroyed.

Object* jcpp::StringHash::get ( const char *  key  ) 

Return the Object indexed by key argument, or if no such Object exists in the table, NULL.

Object* jcpp::StringHash::get ( const std::string  key  ) 

Return the Object indexed by key argument, or if no such Object exists in the table, NULL.

CONST char* jcpp::StringHash::getKey ( char *  key  ) 

Return the string key pointer matching the query. The returned key will persist until that key/object pair is removed from the table.

Object* jcpp::StringHash::put ( const char *  key,
Object value 
)

Returns value argument or, if there already was an Object in the table under that key, returns the Object* it replaces.

Object* jcpp::StringHash::put ( const std::string  key,
Object value 
)

Returns value argument or, if there already was an Object in the table under that key, returns the Object* it replaces.


The documentation for this class was generated from the following file:

Generated on Thu Sep 17 08:21:31 2009 for CCAFFEINE by  doxygen 1.5.9