pine.HashTable: | Functions | Types | Modinfo | Source |
Hash tables only afford an advantage while they are large enough to not encounter tons of key collisions - in essence, if your hash table is nearly full (which you can check using HashFilled) you ought to use ResizeHash to allocate for it more space.
To create a hash table, use the CreateHash command. You can insert key and value pairs into using HashInsert, find them using HashFind, and take them out using HashRemove. This hash table implementation moves key and value pairs to the front of the bucket when they are accessed, and this requires extremely little overhead. This behavior can be switched off using HashSetBringToFront. That would not be recommended, however, for most applications.
To visit all the objects in a hash table you can use an EachIn loop.
ClearHash | Clear the contents of a hash table. |
CopyHash | Copy a hash table. |
CountHash | Count the number of elements in the hash table. |
CreateHash | Create a new hash table. |
CreateHashNode | Create a new hash table node. |
dbgHashKey | Native hash function. |
HashBucket | Find the bucket of the hash table at the specified index. |
HashDeepest | Find the bucket in the hash table with the greatest number of elements. |
HashDeepestBucket | Find the bucket in the hash table with the greatest number of elements. |
HashDeepestNodeBucket | Find the bucket in the hash table with the greatest number of elements. |
HashDepth | Find the most number of elements in any bucket. |
HashFilled | Determine the number of occupied buckets in the hash table. |
HashFind | Find the first value corresponding to some key in the hash table. |
HashFindAll | Find all the values corresponding to some key in the hash table. |
HashFindAllNodes | Find all the nodes with some key in the hash table. |
HashFindNode | Find the first node with some key in the hash table. |
HashGetBringToFront | Get whether values are brought to the front of a bucket for quicker finding in the future whenever they are accessed. |
HashInsert | Insert a new key and value pair into a hash table. |
HashInsertNode | Insert a node into a hash table. |
HashKeys | Returns an iterator object to that can be used with EachIn. |
HashNodeBucket | Find the bucket of the hash table at the specified index. |
HashNodeKey | Gets node key. |
HashNodes | Returns an iterator object to that can be used with EachIn. |
HashNodeValue | Gets node value. |
HashObjects | Returns an iterator object to that can be used with EachIn. |
HashRemove | Remove the first node with a given key. |
HashRemoveAll | Remove all the nodes with a given key. |
HashRemoveAllNodes | Remove all the nodes with a given key. |
HashSetBringToFront | Set whether values are brought to the front of a bucket for quicker finding in the future whenever they are accessed. |
HashSize | Get the size of a hash table. |
ResizeHash | Resize a hash table. |
HashNode | A hash table node object. |
HashTable | A hash table object. |
Function ClearHash(hash:HashTable) | |
Description | Clear the contents of a hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some things in it For Local x%=1 To 8 HashInsert hash,x,String(x) Next 'how many things does it have in it? Print "Number of elements: "+CountHash(hash) 'now clear it Print "Clearing the hash table..." ClearHash hash 'and how many things does it have in it now? Print "Number of elements: "+CountHash(hash) |
Function CopyHash:HashTable(hash:HashTable) | |
Returns | A new hash table containing all the same key and value pairs as the previous and possessing the same characteristics. |
Description | Copy a hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some things in it For Local x%=1 To 8 HashInsert hash,x,String(x) Next 'copy it Local hash_2:HashTable=CopyHash(hash) 'clear the first one ClearHash hash 'now print out the contents of the copied one For Local str$=EachIn hash_2 Print str Next |
Function CountHash:Int(hash:HashTable) | |
Returns | The number of nodes. |
Description | Count the number of elements in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'print the number of nodes Print "Number of nodes: "+CountHash(hash) |
Function CreateHash:HashTable(size:Int,hashfunction:Int(str:String)=dbgHashKey) | |
Returns | A new hash table. |
Description | Create a new hash table. |
Information | hashfunction should be a function that takes a string as an argument and returns an integer. For best results, the hash function's distribution of keys should be as close to uniform as possible. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) |
Function CreateHashNode:HashNode(key:String,value:Object) | |
Returns | The new node. |
Description | Create a new hash table node. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a new node Local node:HashNode=HashInsert(hash,"c'mon baby","do the locomotion") 'now print some info about it Print "node key: "+HashNodeKey(node) Print "node value: "+String(HashNodeValue(node)) |
Function dbgHashKey:Int(s:String) | |
Returns | A hash. |
Description | Native hash function. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'print out the hashes of some strings Print dbgHashKey("na na na na na na na na na na na na na na na na") Print dbgHashKey("batman!") Print dbgHashKey("holy smokes!") |
Function HashBucket:TList(hash:HashTable,index:Int) | |
Returns | The TList which serves as the bucket at that index, contains values. |
Description | Find the bucket of the hash table at the specified index. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'fill it with a ton of crap For Local x%=1 To 256 HashInsert hash,x,String(x) Next 'get the bucket at index 2 Local bucket:TList=HashBucket(hash,2) 'now print out its contents For Local str$=EachIn bucket Print str Next |
Function HashDeepest:Int(hash:HashTable) | |
Returns | The index of the bucket in the hash table with the greatest depth. |
Description | Find the bucket in the hash table with the greatest number of elements. |
Information | When more than one bucket is tied for the greatest depth, the one with the lowest index will be returned. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a lot of nodes For Local x%=1 To 128 HashInsert hash,x,String(x) Next 'print the greatest depth of any single bucket Print "Greatest depth: "+HashDepth(hash) Print "And it belongs to bucket no. "+HashDeepest(hash) |
Function HashDeepestBucket:TList(hash:HashTable) | |
Returns | The TList which is the bucket in the hash table with the greatest depth, contains values. |
Description | Find the bucket in the hash table with the greatest number of elements. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put a bunch of stuff into it For Local x%=1 To 64 HashInsert hash,x,String(x) Next 'get the deepest bucket Local bucket:TList=HashDeepestBucket(hash) 'print out its contents For Local str$=EachIn bucket Print str Next |
Function HashDeepestNodeBucket:TList(hash:HashTable) | |
Returns | The TList which is the bucket in the hash table with the greatest depth, contains nodes. |
Description | Find the bucket in the hash table with the greatest number of elements. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put a bunch of stuff into it For Local x%=1 To 64 HashInsert hash,x,String(x) Next 'get the deepest bucket Local bucket:TList=HashDeepestNodeBucket(hash) 'print out its contents For Local node:HashNode=EachIn bucket Print HashNodeKey(node) Next |
Function HashDepth:Int(hash:HashTable) | |
Returns | The maximum number of nodes in a single bucket. |
Description | Find the most number of elements in any bucket. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a lot of nodes For Local x%=1 To 128 HashInsert hash,x,String(x) Next 'print the greatest depth of any single bucket Print "Greatest depth: "+HashDepth(hash) Print "And it belongs to bucket no. "+HashDeepest(hash) |
Function HashFilled:Int(hash:HashTable) | |
Returns | The number of buckets containing at least one node. |
Description | Determine the number of occupied buckets in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a few nodes Print "Inserting 18 elements..." For Local x%=1 To 18 HashInsert hash,x,String(x) Next 'print the number of buckets containing at least one element Print "Number of buckets containing at least one element: "+HashFilled(hash) |
Function HashFind:Object(hash:HashTable,key:String) | |
Returns | The first value associated with the given key. |
Description | Find the first value corresponding to some key in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert some nodes HashInsert hash,"snake","scary" HashInsert hash,"spider","scary" HashInsert hash,"hornet","scary" HashInsert hash,"kitten","adorable" HashInsert hash,"puppy","adorable" HashInsert hash,"rabbit","adorable" 'find some of those values Print "A hornet is: "+String(HashFind(hash,"hornet")) Print "A puppy is: "+String(HashFind(hash,"puppy")) |
Function HashFindAll:TList(hash:HashTable,key:String) | |
Returns | A list of the values associated with the given key. |
Description | Find all the values corresponding to some key in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert some nodes HashInsert hash,"color","red" HashInsert hash,"color","green" HashInsert hash,"color","violet" HashInsert hash,"number","one" HashInsert hash,"number","two" HashInsert hash,"number","nineteen" 'find some of those values Print "All the values with the key 'color':" For Local str$=EachIn HashFindAll(hash,"color") Print str Next 'find more of those values Print "All the values with the key 'number':" For Local str$=EachIn HashFindAll(hash,"number") Print str Next |
Function HashFindAllNodes:TList(hash:HashTable,key:String) | |
Returns | A list of the nodes with the given key. |
Description | Find all the nodes with some key in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert some nodes HashInsert hash,"color","orange" HashInsert hash,"color","purple" HashInsert hash,"color","yellow" HashInsert hash,"number","nine" HashInsert hash,"number","eight" HashInsert hash,"number","seven" 'find some of those values Print "All the nodes with the key 'color':" For Local node:HashNode=EachIn HashFindAllNodes(hash,"color") Print "key: '"+HashNodeKey(node)+"' value: '"+String(HashNodeValue(node))+"'" Next 'find more of those values Print "All the nodes with the key 'number':" For Local node:HashNode=EachIn HashFindAllNodes(hash,"number") Print "key: '"+HashNodeKey(node)+"' value: '"+String(HashNodeValue(node))+"'" Next |
Function HashFindNode:HashNode(hash:HashTable,key:String) | |
Returns | The first encountered node with the given key. |
Description | Find the first node with some key in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert some stuff HashInsert hash,"1","one" HashInsert hash,"2","two" HashInsert hash,"3","three" HashInsert hash,"4","four" 'get one of the stuffs Local node:HashNode=HashFindNode(hash,"3") 'print out its value Print String(HashNodeValue(node)) |
Function HashGetBringToFront:Int(hash:HashTable) | |
Returns | The boolean value. |
Description | Get whether values are brought to the front of a bucket for quicker finding in the future whenever they are accessed. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'is the bringtofront flag set? Print "Bring nodes to front of buckets when accessed? "+HashGetBringToFront(hash) 'set it to false Print "Setting the flag to false..." HashSetBringToFront hash,False 'how about now? Print "Bring nodes to front of buckets when accessed? "+HashGetBringToFront(hash) |
Function HashInsert:HashNode(hash:HashTable,key:String,value:Object) | |
Returns | The node in the hash table containing this new data. |
Description | Insert a new key and value pair into a hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'now put something in it! HashInsert hash,"key","value" |
Function HashInsertNode(hash:HashTable,node:HashNode) | |
Description | Insert a node into a hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'if you liked it then you shoulda put a node in it HashInsertNode hash,CreateHashNode("key","value") |
Function HashKeys:HashEnum(hash:HashTable) | |
Returns | An iterator object. |
Description | Returns an iterator object to that can be used with EachIn. |
Information | Iterates through the keys in the hash table, if a key appears in the hash table more than once then it will go to the iterator more than once. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some numbers in it For Local x%=1 To 24 HashInsert hash,x,String(x) Next 'now iterate through the keys and print all the stuff out For Local str$=EachIn HashKeys(hash) Print str Next |
Function HashNodeBucket:TList(hash:HashTable,index:Int) | |
Returns | The TList which serves as the bucket at that index, contains nodes. |
Description | Find the bucket of the hash table at the specified index. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'fill it with a ton of crap For Local x%=1 To 256 HashInsert hash,x,String(x) Next 'get the bucket at index 2 Local bucket:TList=HashNodeBucket(hash,2) 'now print out its contents For Local node:HashNode=EachIn bucket Print HashNodeKey(node) Next |
Function HashNodeKey:String(node:HashNode) | |
Returns | The node's key. |
Description | Gets node key. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a new node Local node:HashNode=HashInsert(hash,"c'mon baby","do the locomotion") 'now print some info about it Print "node key: "+HashNodeKey(node) Print "node value: "+String(HashNodeValue(node)) |
Function HashNodes:HashNodeEnum(hash:HashTable) | |
Returns | An iterator object. |
Description | Returns an iterator object to that can be used with EachIn. |
Information | Iterates through the nodes in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put a bunch of letters in it For Local x%=Asc("a") To Asc("z") HashInsert hash,x,Chr(x) Next 'now iterate through the nodes and print all the stuff out For Local node:HashNode=EachIn HashNodes(hash) Print HashNodeKey(node)+" : "+String(HashNodeValue(node)) Next |
Function HashNodeValue:Object(node:HashNode) | |
Returns | The node's value. |
Description | Gets node value. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'insert a new node Local node:HashNode=HashInsert(hash,"c'mon baby","do the locomotion") 'now print some info about it Print "node key: "+HashNodeKey(node) Print "node value: "+String(HashNodeValue(node)) |
Function HashObjects:HashEnum(hash:HashTable) | |
Returns | An iterator object. |
Description | Returns an iterator object to that can be used with EachIn. |
Information | Iterates through the objects in the hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some numbers in it For Local x%=1 To 24 HashInsert hash,x,String(x) Next 'now iterate through the objects and print all the stuff out For Local str$=EachIn HashObjects(hash) Print str Next |
Function HashRemove:HashNode(hash:HashTable,key:String) | |
Returns | The node that was removed. |
Description | Remove the first node with a given key. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some stuff in it HashInsert hash,"cougar","cat" HashInsert hash,"lion","cat" HashInsert hash,"jaguar","cat" HashInsert hash,"wolf","dog" HashInsert hash,"hound","dog" 'go through and print it all Print "Contents:" For Local str$=EachIn hash Print str Next 'now take some of them out Print "Taking out two cats and one dog..." HashRemove hash,"jaguar" HashRemove hash,"lion" HashRemove hash,"hound" 'go through and print what's left Print "Contents:" For Local str$=EachIn hash Print str Next |
Function HashRemoveAll:Int(hash:HashTable,key:String) | |
Returns | The number of nodes that were removed. |
Description | Remove all the nodes with a given key. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some stuff in it HashInsert hash,"bear","panda" HashInsert hash,"bear","grizzly" HashInsert hash,"bear","black" HashInsert hash,"bird","chickadee" HashInsert hash,"bird","robin" HashInsert hash,"rock","n roll" HashInsert hash,"rock","granite" HashInsert hash,"rock","hematite" 'go through and print it all Print "Contents:" For Local node:HashNode=EachIn HashNodes(hash) Print HashNodeKey(node)+" : "+String(HashNodeValue(node)) Next 'now take some of them out Print "Removing all the birds..." HashRemoveAll hash,"bird" 'go through and print what's left Print "Contents:" For Local node:HashNode=EachIn HashNodes(hash) Print HashNodeKey(node)+" : "+String(HashNodeValue(node)) Next 'now take more of them out Print "Removing all the bears..." HashRemoveAll hash,"bear" 'and go through and print what's left one more time Print "Contents:" For Local node:HashNode=EachIn HashNodes(hash) Print HashNodeKey(node)+" : "+String(HashNodeValue(node)) Next |
Function HashRemoveAllNodes:TList(hash:HashTable,key:String) | |
Returns | A list containing all the nodes which were removed. |
Description | Remove all the nodes with a given key. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'put some stuff in it HashInsert hash,"plant","tree" HashInsert hash,"plant","vine" HashInsert hash,"vehicle","car" HashInsert hash,"vehicle","plane" 'remove the nodes with the key 'plant' Local list:TList=HashRemoveAllNodes(hash,"plant") 'now print out the removed items For Local node:HashNode=EachIn list Print String(HashNodeValue(node)) Next |
Function HashSetBringToFront(hash:HashTable,bringtofront:Int) | |
Description | Set whether values are brought to the front of a bucket for quicker finding in the future whenever they are accessed. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'is the bringtofront flag set? Print "Bring nodes to front of buckets when accessed? "+HashGetBringToFront(hash) 'set it to false Print "Setting the flag to false..." HashSetBringToFront hash,False 'how about now? Print "Bring nodes to front of buckets when accessed? "+HashGetBringToFront(hash) |
Function HashSize:Int(hash:HashTable) | |
Returns | The size of the hash table. |
Description | Get the size of a hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'but that's not enough - 'we want To Print out the size of it, too! Print "Size: "+HashSize(hash) |
Function ResizeHash(hash:HashTable,size:Int) | |
Description | Resize a hash table. |
Information | Creates a new hash table of the same size, inserts all the values inside this hash table into it, then makes the new hash table become this hash table. |
Example | SuperStrict 'import required modules Framework brl.standardio Import pine.HashTable 'create a new hash table object of size 32 Local hash:HashTable=CreateHash(32) 'print out the size of it Print "Size: "+HashSize(hash) 'and now resize it Print "Resizing the hash table..." ResizeHash hash,64 'print out the size of it again Print "New size: "+HashSize(hash) |
Type HashNode | |
Description | A hash table node object. |
Functions Summary | |
---|---|
Create | Create a new hash table node. |
Function Create:HashNode(key$,value:Object) | |
Returns | A new hash table node. |
Description | Create a new hash table node. |
Type HashTable | |
Description | A hash table object. |
Methods Summary | |
---|---|
bucket | Get the contents of the bucket at some index as objects. |
checkfill | Determine the number of buckets occupied by at least one element. |
clear | Clear the contents of the hash table. |
copy | Create a copy of the hash table. |
count | Determine the number of elements in the hash table. |
find | Get the first object associated with a key. |
findall | Get all the objects associated with a key. |
findallnodelinks | Find the list links of all the nodes with a given key. |
findallnodes | Get all the nodes with a key. |
findnode | Get the first node with a key. |
findnodelink | Find the list link of either a specific node or the first node with a given key. |
insert | Insert a key and value pair into the hash table. |
insertnode | Insert a node into the hash table. |
KeyEnumerator | Method implements EachIn support. |
maxbucket | Find the bucket with the greatest number of elements. |
maxbucketdepth | Find the greatest number of elements contained in a single bucket. |
NodeEnumerator | Method implements EachIn support. |
ObjectEnumerator | Method implements EachIn support. |
remove | Remove the first node with a given key. |
removeall | Remove all the nodes with a given key. |
removeallnodes | Remove all the nodes with a given key. |
removenode | Remove a specific node from the hash table. |
resize | Set table size. |
setsize | Set table size. |
size | Get the size of the hash table. |
Functions Summary | |
---|---|
Create | Create a new hash table. |
Method bucket:TList(index%) | |
Returns | A TList containing the objects of the nodes in a bucket. |
Description | Get the contents of the bucket at some index as objects. |
Method checkfill%() | |
Returns | The number of buckets occupied by at least one element. |
Description | Determine the number of buckets occupied by at least one element. |
Method clear() | |
Description | Clear the contents of the hash table. |
Method copy:HashTable() | |
Returns | A new hash table with the same properties and containing the same key and value pairs as this one. |
Description | Create a copy of the hash table. |
Method count%() | |
Returns | The number of elements in the hash table. |
Description | Determine the number of elements in the hash table. |
Method find:Object(key$,bringtofront%=-1) | |
Returns | The first object associated with a key. |
Description | Get the first object associated with a key. |
Method findall:TList(key$) | |
Returns | A TList of all the objects associated with a key. |
Description | Get all the objects associated with a key. |
Method findallnodelinks:TList(key$) | |
Returns | A list of TLinks for the nodes. |
Description | Find the list links of all the nodes with a given key. |
Method findallnodes:TList(key$) | |
Returns | A TList of all the nodes with a key. |
Description | Get all the nodes with a key. |
Method findnode:HashNode(key$,bringtofront%=-1) | |
Returns | The first node with a key. |
Description | Get the first node with a key. |
Method findnodelink:TLink(key$,n:HashNode=Null,bringtofront%=-1) | |
Returns | The TLink for the node. |
Description | Find the list link of either a specific node or the first node with a given key. |
Information | bringtofront determines whether the found link should also be put to the front of the bucket. |
Method insert:HashNode(key$,value:Object) | |
Returns | The new node. |
Description | Insert a key and value pair into the hash table. |
Method insertnode(n:HashNode) | |
Description | Insert a node into the hash table. |
Method KeyEnumerator:HashEnum() | |
Returns | An iterator object. |
Description | Method implements EachIn support. |
Information | Iterates through the keys in the hash table (considers duplicates as they crop up) |
Method maxbucket%() | |
Returns | The index of the bucket which contains the greatest number of elements. |
Description | Find the bucket with the greatest number of elements. |
Method maxbucketdepth%() | |
Returns | The greatest number of elements in a single bucket. |
Description | Find the greatest number of elements contained in a single bucket. |
Method NodeEnumerator:HashNodeEnum() | |
Returns | An iterator object. |
Description | Method implements EachIn support. |
Information | Iterates through the nodes in the hash table. |
Method ObjectEnumerator:HashEnum() | |
Returns | An iterator object. |
Description | Method implements EachIn support. |
Information | Iterates through the objects in the hash table. |
Method remove:HashNode(key$) | |
Returns | The node that was removed. |
Description | Remove the first node with a given key. |
Method removeall%(key$) | |
Returns | The number of nodes that were removed. |
Description | Remove all the nodes with a given key. |
Method removeallnodes:TList(key$) | |
Returns | A TList containing the nodes that were removed. |
Description | Remove all the nodes with a given key. |
Method removenode%(n:HashNode) | |
Returns | 1 if the node was successfully removed, 0 if something went wrong. |
Description | Remove a specific node from the hash table. |
Method resize(size%) | |
Description | Set table size. |
Information | Will retain the elements which already exist in the table. |
Method setsize(size%) | |
Description | Set table size. |
Information | Will delete any existing elements in the table. |
Method size%() | |
Returns | The size of the hash table. |
Description | Get the size of the hash table. |
Function Create:HashTable(size%,hashfunc%(key$)=dbgHashKey) | |
Returns | A new hash table. |
Description | Create a new hash table. |
Version | 1.00 |
---|---|
Author | Sophie Kirschner : meapineapple@gmail.com |
License | Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) |
Modserver | pine |