class HASHED_BIJECTIVE_DICTIONARY [V_ -> HASHABLE, K_ -> HASHABLE]
Summary
Class invariant
Overview
creation features
  • make
    Create an empty dictionary.
  • with_capacity (medium_size: INTEGER_32)
    May be used to save some execution time if one is sure that storage size will rapidly become really bigger than Default_size.
features
  • count: INTEGER_32
    Number of available indices.
  • has (k: K_): BOOLEAN
    Is there a value currently associated with key k?
  • at (k: K_): V_
    Return the value associated to key k.
  • reference_at (k: K_): V_
    Return Void or the value associated with key k.
  • fast_has (k: K_): BOOLEAN
    Is there a value currently associated with key k?
  • fast_at (k: K_): V_
    Return the value associated to key k.
  • fast_reference_at (k: K_): V_
    Return Void or the value associated with key k.
  • has_value (v: V_): BOOLEAN
    Is there a value v?
  • key_at (v: V_): K_
    Retrieve the key used for value v using is_equal for comparison.
  • fast_has_value (v: V_): BOOLEAN
    Is there a value v?
  • fast_key_at (v: V_): K_
    Retrieve the key used for value v using = for comparison.
  • put (v: V_, k: K_)
    Change some existing entry or add the new one.
  • add (v: V_, k: K_)
    To add a new entry k with its associated value v.
  • remove (k: K_)
    Remove entry k (which may exist or not before this call).
  • clear_count
    Discard all items (is_empty is True after that call).
  • clear_count_and_capacity
    Discard all items (is_empty is True after that call).
  • item (index: INTEGER_32): V_
    Item at the corresponding index i.
  • key (index: INTEGER_32): K_
  • Default_size: INTEGER_32
    Default size for the storage area in number of items.
  • internal_key (k: K_): K_
    Retrieve the internal key object which correspond to the existing entry k (the one memorized into the Current dictionary).
  • capacity: INTEGER_32
    Approximation of the actual internal storage capacity.
  • copy (other: HASHED_BIJECTIVE_DICTIONARY [V_ -> HASHABLE, K_ -> HASHABLE])
    Reinitialize by copying all associations of other.
Implement manifest generic creation:
Counting:
To provide iterating facilities:
Agents based features:
Implement manifest generic creation:
Indexing:
Other features:
Capacity management: ideally we try to keep the dictionary less than 2/3rd filled
Maximum:
Minimum:
Bits:
count: INTEGER_32
writable attribute
Number of available indices.
has (k: K_): BOOLEAN
effective function
Is there a value currently associated with key k?
at (k: K_): V_
effective function
Return the value associated to key k.
reference_at (k: K_): V_
effective function
Return Void or the value associated with key k.
fast_has (k: K_): BOOLEAN
effective function
Is there a value currently associated with key k?
fast_at (k: K_): V_
effective function
Return the value associated to key k.
fast_reference_at (k: K_): V_
effective function
Return Void or the value associated with key k.
has_value (v: V_): BOOLEAN
effective function
Is there a value v?
key_at (v: V_): K_
effective function
Retrieve the key used for value v using is_equal for comparison.
fast_has_value (v: V_): BOOLEAN
effective function
Is there a value v?
fast_key_at (v: V_): K_
effective function
Retrieve the key used for value v using = for comparison.
put (v: V_, k: K_)
effective procedure
Change some existing entry or add the new one.
add (v: V_, k: K_)
effective procedure
To add a new entry k with its associated value v.
remove (k: K_)
effective procedure
Remove entry k (which may exist or not before this call).
clear_count
effective procedure
Discard all items (is_empty is True after that call).
clear_count_and_capacity
effective procedure
Discard all items (is_empty is True after that call).
item (index: INTEGER_32): V_
effective function
Item at the corresponding index i.
key (index: INTEGER_32): K_
effective function
Default_size: INTEGER_32
constant attribute
Default size for the storage area in number of items.
internal_key (k: K_): K_
effective function
Retrieve the internal key object which correspond to the existing entry k (the one memorized into the Current dictionary).
writable attribute
The key_buckets storage area is the primary hash table of capacity elements.
writable attribute
The val_buckets storage area is the primary hash table of capacity elements.
capacity: INTEGER_32
writable attribute
Approximation of the actual internal storage capacity.
copy (other: HASHED_BIJECTIVE_DICTIONARY [V_ -> HASHABLE, K_ -> HASHABLE])
effective procedure
Reinitialize by copying all associations of other.
cache_user: INTEGER_32
writable attribute
The last user's external index in range [1 .. count] (see item and valid_index for example) may be saved in cache_user otherwise -1 to indicate that the cache is not active.
writable attribute
Meaningful only when cache_user is not -1.
cache_buckets: INTEGER_32
writable attribute
Meaningful only when cache_user is not -1.
writable attribute
If any, they are ready to be recycled.
set_cache_user (index: INTEGER_32)
effective procedure
Set the internal memory cache (cache_user, cache_node and cache_buckets) to the appropriate valid value.
make
effective procedure
Create an empty dictionary.
with_capacity (medium_size: INTEGER_32)
effective procedure
May be used to save some execution time if one is sure that storage size will rapidly become really bigger than Default_size.
basic_make (new_capacity: INTEGER_32)
effective procedure
increase_capacity
effective procedure
There is no more free slots: the dictionary must grow.
effective function
Add node in the free_nodes list.
effective function
Recycle from free_nodes or create a new one.
val_buckets_remove (node: HASHED_BIJECTIVE_DICTIONARY_NODE[V_, K_])
effective procedure
manifest_make (needed_capacity: INTEGER_32)
effective procedure
Manifest creation of a dictionary.
is_empty: BOOLEAN
effective function
Is it empty ?
lower: INTEGER_32
constant attribute
Minimum index.
upper: INTEGER_32
effective function
Maximum index.
first: V_
effective function
The very first item.
last: V_
effective function
The last item.
get_new_iterator_on_items: ITERATOR[V_]
effective function
get_new_iterator_on_keys: ITERATOR[K_]
effective function
is_equal (other: HASHED_BIJECTIVE_DICTIONARY [V_ -> HASHABLE, K_ -> HASHABLE]): BOOLEAN
effective function
Do both dictionaries have the same set of associations?
do_all (action: ROUTINE[TUPLE[TUPLE 2[V_, K_]]])
effective procedure
Apply action to every [V_, K_] associations of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 2[V_, K_]]]): BOOLEAN
effective function
Do all [V_, K_] associations satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 2[V_, K_]]]): BOOLEAN
effective function
Does at least one [V_, K_] association satisfy test?
key_safe_equal (k1: K_, k2: K_): BOOLEAN
frozen
effective function
Because keys are never Void, we do not rely on the SAFE_EQUAL class.
val_safe_equal (v1: V_, v2: V_): BOOLEAN
frozen
effective function
Because values are never Void, we do not rely on the SAFE_EQUAL class.
manifest_put (index: INTEGER_32, v: V_, k: K_)
effective procedure
manifest_semicolon_check: INTEGER_32
constant attribute
Put semicolons between successive value-key pairs.
valid_index (i: INTEGER_32): BOOLEAN
effective function
True when i is valid (i.e., inside actual bounds).
get_new_iterator: ITERATOR[E_]
deferred function
prime_number_ceiling (integer: INTEGER_32): INTEGER_32
effective function
A good prime number, large enough, and no smaller than integer.
prime_capacity (a_capacity: INTEGER_32): INTEGER_32
effective function
should_increase_capacity (a_capacity: INTEGER_32, a_count: INTEGER_32): BOOLEAN
effective function
Maximum_character_code: INTEGER_16
Largest supported code for CHARACTER values.
Maximum_integer_8: INTEGER_8
constant attribute
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
constant attribute
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
constant attribute
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
constant attribute
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
constant attribute
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
constant attribute
Largest non-special (no NaNs nor infinity) supported value of type REAL_32.
Maximum_real: REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_64: REAL_64
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Maximum_real_80: REAL_EXTENDED
Largest supported value of type REAL_80.
Minimum_character_code: INTEGER_16
Smallest supported code for CHARACTER values.
Minimum_integer_8: INTEGER_8
constant attribute
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
constant attribute
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
constant attribute
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
constant attribute
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
constant attribute
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
constant attribute
Smallest non-special (no NaNs nor infinity) supported value of type REAL_32.
Minimum_real: REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_64: REAL_64
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Minimum_real_80: REAL_64
Smallest supported value of type REAL_80.
Boolean_bits: INTEGER_32
Number of bits in a value of type BOOLEAN.
Character_bits: INTEGER_32
Number of bits in a value of type CHARACTER.
Integer_bits: INTEGER_32
Number of bits in a value of type INTEGER.
Real_bits: INTEGER_32
constant attribute
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
Number of bits in a value of type POINTER.