String_Hash_Tables
Versatile implementation of hash tables.
• Generic to allow all kinds of content.
• Variable size (always prime).
 |  | type Item_Type |  |
 | Generic type of the items to be stored. |  |
 |  | type Hash_Table_Access |  |
 | Import inner implementation of hash tables. |  |
Construction
 |  | function Create |  |
 | Create a new hash table with the given table size. |  |
|
Storing and retrieving data
 |  | procedure Put |  |
 | Check for available space in the table, grow if necessary, then
insert the key item pair into the table.
Raises Key_Exists if the key is already in use. |  |
Param | Type | Description |
in out This | Hash_Table_Access |
|
|
|
|
 |  | procedure Get |  |
 | Retrieve an item from the table.
Output parameter Found is True if and only if the key was found. |  |
|
 |  | function Get |  |
 | Retrieve an item from the table.
Raises Key_Not_Found if the key is not in the table. |  |
|
Indexed access
 |  | procedure Get_Index |  |
 | Get the index of a given key. |  |
|
 |  | function Get_Index |  |
 | Get the index of a given key. |  |
|
 |  | function Get_Key |  |
 | Get the key at a given index position. |  |
|
 |  | function Get_Item |  |
 | Get the item at a given index position. |  |
|
Iterating
 |  | procedure Next |  |
 | Iterate over the items in the table. You should start with an
Index of 0 and stop iterating as soon as Index is 0 again. |  |
|
Performance debugging
 |  | procedure Print_Usage |  |
 | Print a visual representation of the hash table's usage. Empty
fields are represented by a '-' character, used fields by '#'. |  |
|
|