+
Point of view
All features
deferred class BIJECTIVE_DICTIONARY [V_, K_]
Summary
Bijective associative memory. As for ordinary DICTIONARY, Values of type V_ are stored using Keys of type K_, but, in a BIJECTIVE_DICTIONARY, given one value of type V_, you can retrieve the unique corresponding key of type K_. In other words, with a BIJECTIVE_DICTIONARY, one key of type K_ gives you access to one value of type V_ which can be used to retrieve back the same unique original key.
At time being, the only one available implementation is the HASHED_BIJECTIVE_DICTIONARY class.
See also DICTIONARY class if you do not have a unique value for each key. By the way, also note that the interface of DICTIONARY is similar to the interface of BIJECTIVE_DICTIONARY in order to allow you to move from one to the other.
Direct parents
Inherit list: MAP
Known children
Inherit list: BIJECTIVE_DICTIONARY_REVERSER, HASHED_BIJECTIVE_DICTIONARY
Overview
Features
Basic access:
{ANY}
Looking and searching some value:
{ANY}
{ANY}
  • put (v: V_, k: K_) assign at
    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.
Removing:
{ANY}
To provide iterating facilities:
{ANY}
Other features:
{ANY}
  • internal_key (k: K_): K_
    Retrieve the internal key object which correspond to the existing entry k (the one memorized into the Current dictionary).
{}
Implement manifest generic creation:
{}
Counting:
{ANY}
Basic access:
{ANY}
  • has (k: K_): BOOLEAN
    Is there a value currently associated with key k?
  • at (k: K_): V_
    Return the value associated to key k.
  • infix "@" (k: K_): V_
    The infix notation which is actually a synonym for at.
  • 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 using basic = for comparison.
  • fast_reference_at (k: K_): V_
    Same work as reference_at, but basic = is used for comparison.
Looking and searching some value:
{ANY}
  • key_at (v: V_): K_
    Retrieve the key used for value v using is_equal for comparison.
  • fast_key_at (v: V_): K_
    Retrieve the key used for value v using = for comparison.
To provide iterating facilities:
{ANY}
  • lower: INTEGER_32
    Minimum index.
  • upper: INTEGER_32
    Maximum index.
  • item (index: INTEGER_32): V_
    Item at the corresponding index i.
  • key (index: INTEGER_32): K_
  • first: V_
    The very first item.
  • last: V_
    The last item.
  • key_map_in (buffer: COLLECTION[K_])
    Append in buffer, all available keys (this may be useful to speed up the traversal).
  • item_map_in (buffer: COLLECTION[V_])
    Append in buffer, all available items (this may be useful to speed up the traversal).
  • keys: TRAVERSABLE[K_]
    An iterable of this map keys
  • items: TRAVERSABLE[V_]
    An iterable of this map values Usually returns Current because MAP is TRAVERSABLE.
{ANY}
  • fast_is_equal (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
    Do both dictionaries have the same set of associations?
  • is_equal (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
    Do both dictionaries have the same set of associations?
  • is_equal_map (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
    Do both collections have the same lower, upper, and items?
Display support:
{ANY}
Agents based features:
{ANY}
{}
{}
{ANY}
Other features:
{ANY}
{ANY}
{}
Counting:
{ANY}
{}
Indexing:
{ANY}
has_value (v: V_): BOOLEAN
deferred function
{ANY}
Is there a value v?
fast_has_value (v: V_): BOOLEAN
deferred function
{ANY}
Is there a value v?
occurrences (v: V_): INTEGER_32
effective function
{ANY}
Number of occurrences using is_equal for comparison.
fast_occurrences (v: V_): INTEGER_32
effective function
{ANY}
Number of occurrences using basic = for comparison.
put (v: V_, k: K_) assign at
deferred procedure
{ANY}
Change some existing entry or add the new one.
add (v: V_, k: K_)
deferred procedure
{ANY}
To add a new entry k with its associated value v.
remove (k: K_)
deferred procedure
{ANY}
Remove entry k (which may exist or not before this call).
clear_count
deferred procedure
{ANY}
Discard all items (is_empty is True after that call).
clear_count_and_capacity
deferred procedure
{ANY}
Discard all items (is_empty is True after that call).
capacity: INTEGER_32
deferred function
{ANY}
Approximation of the actual internal storage capacity.
new_iterator_on_items: ITERATOR[V_]
effective function
{ANY}
new_iterator_on_keys: ITERATOR[K_]
effective function
{ANY}
new_iterator: ITERATOR[TUPLE 2[V_, K_]]
effective function
{ANY}
internal_key (k: K_): K_
deferred function
{ANY}
Retrieve the internal key object which correspond to the existing entry k (the one memorized into the Current dictionary).
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
is 2
constant attribute
{}
Put semicolons between successive value-key pairs.
is_empty: BOOLEAN
effective function
{ANY}
Is it empty?
has (k: K_): BOOLEAN
deferred function
{ANY}
Is there a value currently associated with key k?
at (k: K_): V_
deferred function
{ANY}
Return the value associated to key k.
infix "@" (k: K_): V_
frozen
effective function
{ANY}
The infix notation which is actually a synonym for at.
reference_at (k: K_): V_
deferred function
{ANY}
Return Void or the value associated with key k.
fast_has (k: K_): BOOLEAN
deferred function
{ANY}
Is there a value currently associated with key k?
fast_at (k: K_): V_
deferred function
{ANY}
Return the value associated to key k using basic = for comparison.
fast_reference_at (k: K_): V_
deferred function
{ANY}
Same work as reference_at, but basic = is used for comparison.
key_at (v: V_): K_
effective function
{ANY}
Retrieve the key used for value v using is_equal for comparison.
fast_key_at (v: V_): K_
effective function
{ANY}
Retrieve the key used for value v using = for comparison.
lower: INTEGER_32
is 1
constant attribute
{ANY}
Minimum index.
upper: INTEGER_32
effective function
{ANY}
Maximum index.
item (index: INTEGER_32): V_
deferred function
{ANY}
Item at the corresponding index i.
key (index: INTEGER_32): K_
deferred function
{ANY}
first: V_
effective function
{ANY}
The very first item.
last: V_
effective function
{ANY}
The last item.
key_map_in (buffer: COLLECTION[K_])
effective procedure
{ANY}
Append in buffer, all available keys (this may be useful to speed up the traversal).
item_map_in (buffer: COLLECTION[V_])
effective procedure
{ANY}
Append in buffer, all available items (this may be useful to speed up the traversal).
keys: TRAVERSABLE[K_]
effective function
{ANY}
An iterable of this map keys
items: TRAVERSABLE[V_]
effective function
{ANY}
An iterable of this map values Usually returns Current because MAP is TRAVERSABLE.
fast_is_equal (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
effective function
{ANY}
Do both dictionaries have the same set of associations?
is_equal (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
effective function
{ANY}
Do both dictionaries have the same set of associations?
is_equal_map (other: BIJECTIVE_DICTIONARY [V_, K_]): BOOLEAN
effective function
{ANY}
Do both collections have the same lower, upper, and items?
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
for_each (action: PROCEDURE[TUPLE[TUPLE 2[V_, K_]]])
effective procedure
{ANY}
Apply action to every [V_, K_] associations of Current.
do_all (action: ROUTINE[TUPLE[TUPLE 2[V_, K_]]])
frozen
effective procedure
{ANY}
Apply action to every [V_, K_] associations of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 2[V_, K_]]]): BOOLEAN
effective function
{ANY}
Do all [V_, K_] associations satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 2[V_, K_]]]): BOOLEAN
effective function
{ANY}
Does at least one [V_, K_] association satisfy test?
aggregate (action: FUNCTION[TUPLE[TUPLE 3[V_, V_, K_], V_]], initial: V_): V_
effective function
{ANY}
Aggregate all the elements starting from the initial value.
keys_memory: DICTIONARY_KEY_TRAVERSER[V_, K_]
writable attribute
{}
_inline_agent43 (v: V_, k: K_)
frozen
effective procedure
{}
enumerate: ENUMERATE[E_]
effective function
{ANY}
get_new_iterator: ITERATOR[E_]
frozen
effective function
{ANY}
generation: INTEGER_32
writable attribute
{ANY}
next_generation
effective procedure
{}
count: INTEGER_32
deferred function
{ANY}
Number of available items in the hoard.
_inline_agent1 (a: ROUTINE[TUPLE[TUPLE 1[E_]]], e: E_)
frozen
effective procedure
{}
valid_index (i: INTEGER_32): BOOLEAN
effective function
{ANY}
True when i is valid (i.e., inside actual bounds).