HASTY class of hash table.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=I4P), | private, | parameter | :: | HT_BUCKETS_NUMBER_DEF | = | 557_I4P | Default number of buckets of hash table. |
Overload len
builtin for accepting a hash_table.
Return the number of (actually stored) nodes of the hash table, namely the hash table length.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(hash_table), | intent(in) | :: | self | The hash table. |
||
logical, | intent(in), | optional | :: | global | Check the global values on all CAF images rather only on the local image. |
The hash table length.
Hash table class to storage any contents by means of generic dictionary buckets.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(dictionary), | private, | allocatable | :: | bucket(:) | Hash table buckets. |
||
integer(kind=I8P), | private, | allocatable | :: | ids_(:,:) | Minimum and maximum id values actually stored into each bucket. |
||
integer(kind=I4P), | private | :: | nodes_number_ | = | 0_I4P | Number of nodes actually stored, namely the hash table length. |
|
integer(kind=I4P), | private | :: | me | = | 0 | Index of current CAF image. |
|
integer(kind=I4P), | private | :: | images_number | = | 0 | Number of CAF images. |
|
integer(kind=I4P), | private | :: | buckets_number | = | 0_I4P | Number of buckets used. |
|
logical, | private | :: | is_homogeneous_ | = | .false. | Homogeneity status-guardian. |
|
logical, | private | :: | is_initialized_ | = | .false. | Initialization status. |
|
class(*), | private, | allocatable | :: | typeguard_key | Key type guard (mold) for homogeneous keys check. |
||
class(*), | private, | allocatable | :: | typeguard_content | Content type guard (mold) for homogeneous contents check. |
final :: finalize | Finalize the hash table. |
procedure, public, pass(self) :: add_pointer | Add a node pointer to the hash table. |
procedure, public, pass(self) :: add_clone | Add a node to the hash table cloning contents (non pointer add). |
procedure, public, pass(self) :: destroy | Destroy the hash table. |
procedure, public, pass(self) :: get_clone | Return a node's content in the hash table by cloning. |
procedure, public, pass(self) :: get_pointer | Return a pointer to a node's content in the hash table. |
procedure, public, pass(self) :: has_key | Check if the key is present in the hash table. |
procedure, public, pass(self) :: ids | Return the list of ids actually stored. |
procedure, public, pass(self) :: initialize | Initialize the hash table. |
procedure, public, pass(self) :: is_homogeneous | Return homogeneity status. |
procedure, public, pass(self) :: is_initialized | Return initialization status. |
procedure, public, pass(self) :: print_keys | Print the hash table keys. |
procedure, public, pass(self) :: remove | Remove a node from the hash table, given the key. |
procedure, public, pass(self) :: traverse | Traverse hash table calling the iterator procedure. |
procedure, private, pass(self) :: allocate_members | Allocate dynamic memory members. |
procedure, private, pass(self) :: check_type | Check type consistency. |
procedure, private, pass(self) :: get_bucket_image_indexes | Get the bucket and image indexes corresponding to the given key. |
procedure, private, pass(self) :: hash | Hash the key. |
procedure, private, pass(self) :: set_buckets_number | Set buckets number. |
procedure, private, pass(self) :: set_caf_dimensions | Set CAF dimensions by means of intrinsic inquiring functions. |
procedure, private, pass(self) :: set_homogeneous | Set homogeneity flag. |
procedure, private, pass(self) :: synchronize_images | Syncrhonize CAF images. |
Return the number of (actually stored) nodes of the hash table, namely the hash table length.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(hash_table), | intent(in) | :: | self | The hash table. |
||
logical, | intent(in), | optional | :: | global | Check the global values on all CAF images rather only on the local image. |
The hash table length.
Return a pointer to a node's content in the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
Content pointer of the queried node.
Check if the key is present in the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
Check result.
Return the minimum and maximum unique key id values actually stored.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
logical, | intent(in), | optional | :: | global | Check the global values on all CAF images rather only on the local image. |
Minimum and maximum id values actually stored.
Return homogeneity status.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
Homogeneity status.
Return initialization status.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
Initialization status.
Hash the key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | Key to hash. |
Bucket index corresponding to the key.
Return true if n
is prime accordingly division test, false if n
is composite.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4P), | intent(in) | :: | n | Number inquired. |
Result of the test.
Return the next prime after n
accordingly division test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4P), | intent(in) | :: | n | Number inquired. |
Next prime after n
.
Add a node pointer to the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
class(*), | intent(in), | pointer | :: | content | The content. |
Add a node to the hash table cloning content (non pointer add).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
class(*), | intent(in) | :: | content | The content. |
Destroy the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
Return a node's content in the hash table by cloning.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
class(*), | intent(out), | allocatable | :: | content | Content of the queried node. |
Initialize the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
integer(kind=I4P), | intent(in), | optional | :: | buckets_number | Number of buckets for initialize the hash table. |
|
logical, | intent(in), | optional | :: | use_prime | If true the buckets number is rendered prime. |
|
logical, | intent(in), | optional | :: | homogeneous | If true the hash is supposed to accept only homogeneous nodes. |
|
class(*), | intent(in), | optional | :: | typeguard_key | Key type guard (mold) for homogeneous keys check. |
|
class(*), | intent(in), | optional | :: | typeguard_content | content type guard (mold) for homogeneous contents check. |
Print the hash table keys.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
Remove a node from the hash table, given the key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
Traverse hash table calling the iterator procedure.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash_table. |
||
procedure(key_iterator_interface) | :: | iterator | The (key) iterator procedure to call for each node. |
Allocate dynamic memory members.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in), | optional | :: | typeguard_key | Key type guard (mold) for homogeneous keys check. |
|
class(*), | intent(in), | optional | :: | typeguard_content | content type guard (mold) for homogeneous contents check. |
Check type consistency.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
class(*), | intent(in) | :: | content | The content. |
Get the bucket and image indexes corresponding to the given key.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(in) | :: | self | The hash table. |
||
class(*), | intent(in) | :: | key | The key. |
||
integer(kind=I4P), | intent(out) | :: | bucket | Bucket index. |
||
integer(kind=I4P), | intent(out) | :: | image | Image index. |
Set buckets number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
integer(kind=I4P), | intent(in), | optional | :: | buckets_number | Number of buckets for initialize the hash table. |
|
logical, | intent(in), | optional | :: | use_prime | If true the buckets number is rendered prime. |
Set CAF dimensions by means of intrinsic inquiring functions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
Set homogeneity flag.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
||
logical, | intent(in), | optional | :: | homogeneous | If true the hash is supposed to accept only homogeneous nodes. |
Synchronize CAF images.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(hash_table), | intent(inout) | :: | self | The hash table. |
Finalize the hash table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(hash_table), | intent(inout) | :: | self | The hash table. |