RexxHashTable Class Reference

#include <RexxHashTable.hpp>

Inheritance diagram for RexxHashTable:
[legend]

Public Types

enum  { DEFAULT_HASH_SIZE = 22 , STRING_TABLE = 1 , PRIMITIVE_TABLE = 2 , FULL_TABLE = 3 }
 

Public Member Functions

void * operator new (size_t size, void *objectPtr)
 
void operator delete (void *)
 
void operator delete (void *, void *)
 
 RexxHashTable (RESTORETYPE restoreType)
 
 RexxHashTable ()
 
void live (size_t)
 
void liveGeneral (int reason)
 
void flatten (RexxEnvelope *)
 
RexxArraymakeArray ()
 
void empty ()
 
bool isEmpty ()
 
size_t items ()
 
void emptySlot (HashLink)
 
HashLink next (HashLink position)
 
RexxObjectvalue (HashLink position)
 
RexxObjectindex (HashLink position)
 
RexxObjectmerge (RexxHashTableCollection *target)
 
RexxObjectmergeItem (RexxObject *value, RexxObject *index)
 
RexxHashTableadd (RexxObject *value, RexxObject *key)
 
RexxObjectremove (RexxObject *key)
 
RexxObjectremoveAll (RexxObject *key)
 
RexxArraygetAll (RexxObject *key)
 
size_t countAll (RexxObject *key)
 
RexxObjectget (RexxObject *key)
 
RexxHashTableput (RexxObject *value, RexxObject *key)
 
RexxHashTableprimitiveAdd (RexxObject *value, RexxObject *key)
 
RexxObjectprimitiveRemove (RexxObject *key)
 
RexxArrayprimitiveGetAll (RexxObject *key)
 
RexxObjectprimitiveGet (RexxObject *key)
 
RexxHashTableprimitivePut (RexxObject *value, RexxObject *key)
 
RexxObjectprimitiveRemoveItem (RexxObject *value, RexxObject *key)
 
RexxObjectprimitiveRemoveItem (RexxObject *value)
 
RexxObjectprimitiveHasItem (RexxObject *, RexxObject *)
 
RexxObjectprimitiveHasItem (RexxObject *)
 
RexxObjectprimitiveGetIndex (RexxObject *value)
 
size_t totalEntries ()
 
HashLink first ()
 
RexxObjectreplace (RexxObject *value, HashLink position)
 
RexxArrayallIndex (RexxObject *key)
 
RexxObjectgetIndex (RexxObject *value)
 
RexxHashTablereHash ()
 
RexxHashTableputNodupe (RexxObject *value, RexxObject *key)
 
RexxSuppliersupplier ()
 
RexxArrayallItems ()
 
RexxArrayallIndexes ()
 
RexxArrayuniqueIndexes ()
 
RexxObjectremoveItem (RexxObject *value, RexxObject *key)
 
RexxObjectremoveItem (RexxObject *value)
 
RexxObjectstringGet (RexxString *key)
 
RexxHashTablestringPut (RexxObject *value, RexxString *key)
 
RexxHashTablestringAdd (RexxObject *value, RexxString *key)
 
RexxArraystringGetAll (RexxString *key)
 
RexxObjectstringMerge (RexxHashTable *target)
 
RexxObjecthasItem (RexxObject *value, RexxObject *key)
 
RexxObjecthasItem (RexxObject *value)
 
void reMerge (RexxHashTable *target)
 
void primitiveMerge (RexxHashTable *target)
 
RexxHashTableinsert (RexxObject *value, RexxObject *index, HashLink position, int type)
 
RexxObjectnextItem (RexxObject *, RexxObject *)
 
RexxObjectprimitiveNextItem (RexxObject *, RexxObject *)
 
size_t mainSlotsSize ()
 
size_t totalSlotsSize ()
 
bool available (HashLink position)
 
HashLink hashIndex (RexxObject *obj)
 
HashLink hashPrimitiveIndex (RexxObject *obj)
 
HashLink hashStringIndex (RexxObject *obj)
 
- Public Member Functions inherited from RexxInternalObject
void * operator new (size_t, RexxClass *)
 
void * operator new (size_t, RexxClass *, RexxObject **, size_t, size_t)
 
void * operator new (size_t size, void *ptr)
 
void operator delete (void *)
 
void operator delete (void *p, void *ptr)
 
 RexxInternalObject ()
 
 RexxInternalObject (RESTORETYPE restoreType)
 
virtual ~RexxInternalObject ()
 
 operator RexxObject * ()
 
size_t getObjectSize ()
 
void setObjectSize (size_t s)
 
size_t getObjectDataSize ()
 
void * getObjectDataSpace ()
 
void clearObject ()
 
void clearObject (size_t l)
 
void setVirtualFunctions (void *t)
 
void setInitHeader (size_t s, size_t markword)
 
void setInitHeader (size_t markword)
 
void setObjectLive (size_t markword)
 
void setHasReferences ()
 
void setHasNoReferences ()
 
bool hasReferences ()
 
bool hasNoReferences ()
 
void setPrimitive ()
 
void setNonPrimitive ()
 
bool isPrimitive ()
 
bool isNonPrimitive ()
 
void setInRexxPackage ()
 
bool isInRexxPackage ()
 
bool isObjectMarked (size_t markword)
 
void setObjectMark (size_t markword)
 
void clearObjectMark ()
 
bool isObjectLive (size_t mark)
 
bool isObjectDead (size_t mark)
 
bool isOldSpace ()
 
bool isNewSpace ()
 
void setNewSpace ()
 
void setOldSpace ()
 
void makeProxiedObject ()
 
bool isProxyObject ()
 
bool isSubClassOrEnhanced ()
 
bool isBaseClass ()
 
size_t getObjectTypeNumber ()
 
RexxBehaviourgetObjectType ()
 
bool isObjectType (RexxBehaviour *b)
 
bool isObjectType (size_t t)
 
bool isSameType (RexxInternalObject *o)
 
void setBehaviour (RexxBehaviour *b)
 
virtual RexxObjectmakeProxy (RexxEnvelope *)
 
virtual RexxObjectcopy ()
 
virtual RexxObjectevaluate (RexxActivation *, RexxExpressionStack *)
 
virtual RexxObjectgetValue (RexxActivation *)
 
virtual RexxObjectgetValue (RexxVariableDictionary *)
 
virtual RexxObjectgetRealValue (RexxActivation *)
 
virtual RexxObjectgetRealValue (RexxVariableDictionary *)
 
virtual void uninit ()
 
virtual HashCode hash ()
 
virtual HashCode getHashValue ()
 
HashCode identityHash ()
 
virtual bool truthValue (int)
 
virtual bool logicalValue (logical_t &)
 
virtual RexxStringmakeString ()
 
virtual RexxTextmakeText ()
 
virtual void copyIntoTail (RexxCompoundTail *buffer)
 
virtual RexxStringprimitiveMakeString ()
 
virtual RexxTextprimitiveMakeText ()
 
virtual RexxStringstringValue ()
 
virtual RexxTexttextValue ()
 
virtual RexxIntegerintegerValue (size_t)
 
virtual bool numberValue (wholenumber_t &result, size_t precision)
 
virtual bool numberValue (wholenumber_t &result)
 
virtual bool unsignedNumberValue (stringsize_t &result, size_t precision)
 
virtual bool unsignedNumberValue (stringsize_t &result)
 
virtual bool doubleValue (double &result)
 
virtual RexxNumberStringnumberString ()
 
virtual bool isEqual (RexxObject *)
 
virtual bool isInstanceOf (RexxClass *)
 
virtual RexxMethodinstanceMethod (RexxString *)
 
virtual RexxSupplierinstanceMethods (RexxClass *)
 
virtual RexxObjectdynamicTarget (RexxObject **arguments, size_t count, size_t named_count)
 
void hasUninit ()
 
void removedUninit ()
 
void printObject ()
 
RexxObjectclone ()
 
- Public Member Functions inherited from RexxVirtualBase
virtual RexxObjectunflatten (RexxEnvelope *)
 

Static Public Member Functions

static RexxTablenewInstance (size_t, size_t, size_t)
 
static RexxHashTablenewInstance (size_t)
 
- Static Public Member Functions inherited from RexxInternalObject
static size_t getObjectHeaderSize ()
 

Protected Attributes

size_t size
 
HashLink free
 
TABENTRY entries [1]
 

Additional Inherited Members

- Public Attributes inherited from RexxInternalObject
ObjectHeader header
 
RexxBehaviourbehaviour
 
- Protected Member Functions inherited from RexxVirtualBase
virtual ~RexxVirtualBase ()
 
virtual void baseVirtual ()
 

Detailed Description

Definition at line 60 of file RexxHashTable.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEFAULT_HASH_SIZE 
STRING_TABLE 
PRIMITIVE_TABLE 
FULL_TABLE 

Definition at line 62 of file RexxHashTable.hpp.

Constructor & Destructor Documentation

◆ RexxHashTable() [1/2]

RexxHashTable::RexxHashTable ( RESTORETYPE  restoreType)
inline

Definition at line 74 of file RexxHashTable.hpp.

◆ RexxHashTable() [2/2]

RexxHashTable::RexxHashTable ( )
inline

Definition at line 75 of file RexxHashTable.hpp.

Referenced by newInstance().

Member Function Documentation

◆ add()

RexxHashTable * RexxHashTable::add ( RexxObject value,
RexxObject key 
)

◆ allIndex()

RexxArray * RexxHashTable::allIndex ( RexxObject key)

◆ allIndexes()

RexxArray * RexxHashTable::allIndexes ( )

◆ allItems()

RexxArray * RexxHashTable::allItems ( )

◆ available()

bool RexxHashTable::available ( HashLink  position)
inline

Definition at line 135 of file RexxHashTable.hpp.

References totalSlotsSize().

Referenced by RexxHashTableCollection::available().

◆ countAll()

size_t RexxHashTable::countAll ( RexxObject _index)

Return a count of all items with a given index.

Parameters
_indexThe target index
Returns
The count of matching items.

Definition at line 901 of file RexxHashTable.cpp.

References entries, EQUAL_VALUE(), hashIndex(), index(), next(), NO_MORE, and OREF_NULL.

Referenced by getAll(), RexxRelation::itemsRexx(), and removeAll().

◆ empty()

void RexxHashTable::empty ( )

Empty a HashTable.

Definition at line 1696 of file RexxHashTable.cpp.

References emptySlot(), and mainSlotsSize().

Referenced by RexxHashTableCollection::empty(), and RexxDirectory::reset().

◆ emptySlot()

void RexxHashTable::emptySlot ( HashLink  position)

Empty an individual hashtable bucket. This will clear the entire chain.

Parameters
positionThe hash table bucket to clear.

Definition at line 1657 of file RexxHashTable.cpp.

References entries, free, index(), tabentry::next, NO_MORE, OREF_NULL, OrefSet, and value().

Referenced by empty().

◆ first()

◆ flatten()

void RexxHashTable::flatten ( RexxEnvelope envelope)
virtual

Reimplemented from RexxVirtualBase.

Definition at line 195 of file RexxHashTable.cpp.

References cleanUpFlatten, entries, flatten_reference, index(), OREF_NULL, setUpFlatten, and totalSlotsSize().

◆ get()

RexxObject * RexxHashTable::get ( RexxObject key)

◆ getAll()

◆ getIndex()

RexxObject * RexxHashTable::getIndex ( RexxObject value)

◆ hashIndex()

HashLink RexxHashTable::hashIndex ( RexxObject obj)
inline

◆ hashPrimitiveIndex()

◆ hashStringIndex()

HashLink RexxHashTable::hashStringIndex ( RexxObject obj)
inline

Definition at line 143 of file RexxHashTable.hpp.

References RexxObject::hash(), and mainSlotsSize().

Referenced by stringAdd(), stringGet(), stringGetAll(), and stringPut().

◆ hasItem() [1/2]

RexxObject * RexxHashTable::hasItem ( RexxObject _value)

Test if an item exists in the hash collection.

Parameters
valueThe test value.
Returns
.true if it exists, .false otherwise.

Definition at line 684 of file RexxHashTable.cpp.

References entries, EQUAL_VALUE(), tabentry::index, OREF_NULL, TheFalseObject, TheTrueObject, totalSlotsSize(), and tabentry::value.

◆ hasItem() [2/2]

RexxObject * RexxHashTable::hasItem ( RexxObject value,
RexxObject key 
)

◆ index()

◆ insert()

◆ isEmpty()

bool RexxHashTable::isEmpty ( )

Test if the hash table is empty.

Returns

Definition at line 1711 of file RexxHashTable.cpp.

References items().

Referenced by RexxHashTableCollection::isEmpty().

◆ items()

size_t RexxHashTable::items ( )

count the number of items in the hash table.

Returns
The item count.

Definition at line 1635 of file RexxHashTable.cpp.

References entries, index(), OREF_NULL, and totalSlotsSize().

Referenced by allIndexes(), allItems(), isEmpty(), and supplier().

◆ live()

void RexxHashTable::live ( size_t  liveMark)
virtual

Reimplemented from RexxVirtualBase.

Definition at line 154 of file RexxHashTable.cpp.

References entries, tabentry::index, memory_mark, OREF_NULL, totalSlotsSize(), and tabentry::value.

◆ liveGeneral()

void RexxHashTable::liveGeneral ( int  reason)
virtual

Reimplemented from RexxVirtualBase.

Definition at line 175 of file RexxHashTable.cpp.

References entries, tabentry::index, memory_mark_general, OREF_NULL, totalSlotsSize(), and tabentry::value.

◆ mainSlotsSize()

size_t RexxHashTable::mainSlotsSize ( )
inline

◆ makeArray()

RexxArray * RexxHashTable::makeArray ( void  )
virtual

Reimplemented from RexxInternalObject.

Definition at line 1719 of file RexxHashTable.cpp.

References allIndexes().

Referenced by RexxHashTableCollection::makeArray().

◆ merge()

RexxObject * RexxHashTable::merge ( RexxHashTableCollection target)

◆ mergeItem()

RexxObject * RexxHashTable::mergeItem ( RexxObject value,
RexxObject index 
)

Definition at line 1586 of file RexxHashTable.cpp.

References OREF_NULL, and putNodupe().

◆ newInstance() [1/2]

RexxHashTable * RexxHashTable::newInstance ( size_t  entries)
static

Definition at line 75 of file RexxHashTable.cpp.

References entries, free, new_object(), RexxHashTable(), size, and T_HashTable.

◆ newInstance() [2/2]

◆ next()

◆ nextItem()

RexxObject * RexxHashTable::nextItem ( RexxObject _value,
RexxObject _index 
)

◆ operator delete() [1/2]

void RexxHashTable::operator delete ( void *  )
inline

Definition at line 71 of file RexxHashTable.hpp.

◆ operator delete() [2/2]

void RexxHashTable::operator delete ( void *  ,
void *   
)
inline

Definition at line 72 of file RexxHashTable.hpp.

◆ operator new()

void* RexxHashTable::operator new ( size_t  size,
void *  objectPtr 
)
inline

Definition at line 70 of file RexxHashTable.hpp.

◆ primitiveAdd()

RexxHashTable * RexxHashTable::primitiveAdd ( RexxObject value,
RexxObject key 
)

◆ primitiveGet()

RexxObject * RexxHashTable::primitiveGet ( RexxObject key)

◆ primitiveGetAll()

RexxArray * RexxHashTable::primitiveGetAll ( RexxObject key)

◆ primitiveGetIndex()

RexxObject * RexxHashTable::primitiveGetIndex ( RexxObject value)

◆ primitiveHasItem() [1/2]

RexxObject * RexxHashTable::primitiveHasItem ( RexxObject _value)

Definition at line 638 of file RexxHashTable.cpp.

References OREF_NULL, primitiveGetIndex(), TheFalseObject, and TheTrueObject.

◆ primitiveHasItem() [2/2]

RexxObject * RexxHashTable::primitiveHasItem ( RexxObject _value,
RexxObject _index 
)

◆ primitiveMerge()

void RexxHashTable::primitiveMerge ( RexxHashTable target)

Definition at line 1523 of file RexxHashTable.cpp.

References entries, index(), OREF_NULL, primitiveAdd(), totalSlotsSize(), and value().

Referenced by insert().

◆ primitiveNextItem()

RexxObject * RexxHashTable::primitiveNextItem ( RexxObject _value,
RexxObject _index 
)

◆ primitivePut()

RexxHashTable * RexxHashTable::primitivePut ( RexxObject value,
RexxObject key 
)

◆ primitiveRemove()

RexxObject * RexxHashTable::primitiveRemove ( RexxObject key)

◆ primitiveRemoveItem() [1/2]

RexxObject * RexxHashTable::primitiveRemoveItem ( RexxObject _value)

Removes an item from the hash table.

Parameters
valueThe test value.
Returns
.true if it exists, .false otherwise.

Definition at line 747 of file RexxHashTable.cpp.

References entries, tabentry::index, OREF_NULL, primitiveRemoveItem(), TheNilObject, totalSlotsSize(), and tabentry::value.

◆ primitiveRemoveItem() [2/2]

RexxObject * RexxHashTable::primitiveRemoveItem ( RexxObject value,
RexxObject key 
)

◆ put()

RexxHashTable * RexxHashTable::put ( RexxObject value,
RexxObject key 
)

◆ putNodupe()

RexxHashTable * RexxHashTable::putNodupe ( RexxObject value,
RexxObject key 
)

◆ reHash()

RexxHashTable * RexxHashTable::reHash ( void  )

Definition at line 1819 of file RexxHashTable.cpp.

References add(), entries, index(), new_hashtab(), OREF_NULL, totalSlotsSize(), and value().

Referenced by RexxTable::reHash().

◆ reMerge()

void RexxHashTable::reMerge ( RexxHashTable target)

Definition at line 1504 of file RexxHashTable.cpp.

References add(), entries, index(), OREF_NULL, totalSlotsSize(), and value().

Referenced by insert().

◆ remove()

◆ removeAll()

RexxObject * RexxHashTable::removeAll ( RexxObject _index)

Remove all elements with a given index from a hashtable, returning an array of all items.

Parameters
_indexThe target index.
Returns
An array of all matching items.

Definition at line 336 of file RexxHashTable.cpp.

References countAll(), entries, EQUAL_VALUE(), free, hashIndex(), index(), new_array(), tabentry::next, NO_LINK, NO_MORE, OREF_NULL, OrefSet, RexxArray::put(), and value().

Referenced by RexxRelation::removeAll().

◆ removeItem() [1/2]

RexxObject * RexxHashTable::removeItem ( RexxObject _value)

Removes an item from the hash table.

Parameters
valueThe test value.
Returns
.true if it exists, .false otherwise.

Definition at line 715 of file RexxHashTable.cpp.

References entries, EQUAL_VALUE(), tabentry::index, OREF_NULL, removeItem(), TheNilObject, totalSlotsSize(), and tabentry::value.

◆ removeItem() [2/2]

◆ replace()

RexxObject * RexxHashTable::replace ( RexxObject value,
HashLink  position 
)

◆ stringAdd()

◆ stringGet()

◆ stringGetAll()

◆ stringMerge()

RexxObject * RexxHashTable::stringMerge ( RexxHashTable target)

Definition at line 1542 of file RexxHashTable.cpp.

References entries, index(), OREF_NULL, stringAdd(), totalSlotsSize(), and value().

Referenced by insert().

◆ stringPut()

◆ supplier()

RexxSupplier * RexxHashTable::supplier ( void  )

◆ totalEntries()

size_t RexxHashTable::totalEntries ( void  )

◆ totalSlotsSize()

◆ uniqueIndexes()

RexxArray * RexxHashTable::uniqueIndexes ( )

Return an array containing the unique indexes of a Relation object.

Returns
An array with the set of unique index values

Definition at line 1755 of file RexxHashTable.cpp.

References RexxHashTableCollection::allIndexes(), entries, index(), new_table(), OREF_NULL, RexxHashTableCollection::put(), TheNilObject, and totalSlotsSize().

Referenced by RexxHashTableCollection::uniqueIndexes().

◆ value()

Member Data Documentation

◆ entries

◆ free

HashLink RexxHashTable::free
protected

◆ size

size_t RexxHashTable::size
protected

Definition at line 150 of file RexxHashTable.hpp.

Referenced by mainSlotsSize(), and newInstance().


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