+
Point of view
All features
class HASHED_SET [E_ -> HASHABLE]
Summary
Class invariant
Overview
creation features
features
Internal cache handling:
  • cache_user: INTEGER_32
    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.
  • cache_node: HASHED_SET_NODE[E_]
    Meaningful only when cache_user is not -1.
  • cache_buckets: INTEGER_32
    Meaningful only when cache_user is not -1.
  • add (e: E_)
    Add new item e to the set.
  • fast_add (e: E_)
    Same job as add, but uses basic = for comparison.
  • remove (e: E_)
    Remove item e from the set: the mathematical definition of removing from a set is followed.
  • fast_remove (e: E_)
    Same job as remove, but uses basic = for comparison.
  • clear_count
    Empty the current set (is_empty is True after that call).
  • clear_count_and_capacity
    Empty the current set (is_empty is True after that call).
  • has (e: E_): BOOLEAN
    Is element e in the set?
  • fast_has (e: E_): BOOLEAN
    Is element e actually stored in the set?
  • reference_at (e: E_): E_
    Non Void when e is in the set.
  • item (index: INTEGER_32): E_
    Item at the corresponding index i.
  • intersection (other: HASHED_SET [E_ -> HASHABLE])
    Make the intersection of the Current set with other.
  • copy (other: HASHED_SET [E_ -> HASHABLE])
    Copy 'other' into the current set
  • from_collection (model: COLLECTION[E_])
    Add all items of model.
Implement manifest generic creation:
Counting:
To provide iterating facilities:
Mathematical operations:
  • union (other: HASHED_SET [E_ -> HASHABLE])
    Make the union of the Current set with other.
  • infix "+" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
    Return the union of the Current set with other.
  • infix "^" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
    Return the intersection of the Current set with other.
  • minus (other: HASHED_SET [E_ -> HASHABLE])
    Make the set Current - other.
  • infix "-" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
    Return the set Current - other.
Comparison:
Agents based features:
Implement manifest generic creation:
Indexing:
  • test (e1: E_, e2: E_): BOOLEAN
    In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
  • safe_equal (e1: E_, e2: E_): BOOLEAN
    In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
Capacity management: ideally we try to keep the dictionary less than 2/3rd filled
Maximum:
Minimum:
Bits:
Default_size: INTEGER_32
constant attribute
Minimum size for storage in number of items.
writable attribute
The buckets storage area is the primary hash table of capacity elements.
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.
cache_node: HASHED_SET_NODE[E_]
writable attribute
Meaningful only when cache_user is not -1.
cache_buckets: INTEGER_32
writable attribute
Meaningful only when cache_user is not -1.
create_with_capacity (new_capacity: INTEGER_32)
effective procedure
make
effective procedure
Create an empty set.
with_capacity (medium_size: INTEGER_32)
effective procedure
Create an empty set using medium_size as an appropriate value to help initialization of capacity.
capacity: INTEGER_32
writable attribute
Of the buckets storage area.
count: INTEGER_32
writable attribute
Number of available indices.
add (e: E_)
effective procedure
Add new item e to the set.
fast_add (e: E_)
effective procedure
Same job as add, but uses basic = for comparison.
remove (e: E_)
effective procedure
Remove item e from the set: the mathematical definition of removing from a set is followed.
fast_remove (e: E_)
effective procedure
Same job as remove, but uses basic = for comparison.
clear_count
effective procedure
Empty the current set (is_empty is True after that call).
clear_count_and_capacity
effective procedure
Empty the current set (is_empty is True after that call).
has (e: E_): BOOLEAN
effective function
Is element e in the set?
fast_has (e: E_): BOOLEAN
effective function
Is element e actually stored in the set?
reference_at (e: E_): E_
effective function
Non Void when e is in the set.
item (index: INTEGER_32): E_
effective function
Item at the corresponding index i.
intersection (other: HASHED_SET [E_ -> HASHABLE])
effective procedure
Make the intersection of the Current set with other.
copy (other: HASHED_SET [E_ -> HASHABLE])
effective procedure
Copy 'other' into the current set
from_collection (model: COLLECTION[E_])
effective procedure
Add all items of model.
manifest_make (needed_capacity: INTEGER_32)
effective procedure
Manifest creation of a HASHED_SET.
writable attribute
If any, they are ready to be recycled.
once function
dispose_node (node: HASHED_SET_NODE[E_]): HASHED_SET_NODE[E_]
effective function
Clear and add node in the free_nodes list.
new_node (e: E_, next: HASHED_SET_NODE[E_]): HASHED_SET_NODE[E_]
effective function
Recycle from free_nodes or create a new one.
increase_capacity
effective procedure
There are not enough free slots: the set must grow.
set_cache_user (index: INTEGER_32)
effective procedure
is_empty: BOOLEAN
effective function
Is the set empty?
lower: INTEGER_32
constant attribute
Minimum index.
upper: INTEGER_32
effective function
Maximum index.
first: E_
effective function
The very first item.
last: E_
effective function
The last item.
get_new_iterator: ITERATOR[E_]
effective function
union (other: HASHED_SET [E_ -> HASHABLE])
effective procedure
Make the union of the Current set with other.
infix "+" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
effective function
Return the union of the Current set with other.
infix "^" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
effective function
Return the intersection of the Current set with other.
minus (other: HASHED_SET [E_ -> HASHABLE])
effective procedure
Make the set Current - other.
infix "-" (other: HASHED_SET [E_ -> HASHABLE]): HASHED_SET [E_ -> HASHABLE]
effective function
Return the set Current - other.
is_subset_of (other: HASHED_SET [E_ -> HASHABLE]): BOOLEAN
effective function
Is the Current set a subset of other?
is_disjoint_from (other: HASHED_SET [E_ -> HASHABLE]): BOOLEAN
effective function
Is the Current set disjoint from other ?
is_equal (other: HASHED_SET [E_ -> HASHABLE]): BOOLEAN
effective function
Is the Current set equal to other?
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
effective procedure
Apply action to every item of Current.
for_all (predicate: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Do all items satisfy predicate?
exists (predicate: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Does at least one item satisfy predicate?
manifest_put (index: INTEGER_32, element: E_)
effective procedure
manifest_semicolon_check: BOOLEAN
constant attribute
valid_index (i: INTEGER_32): BOOLEAN
effective function
True when i is valid (i.e., inside actual bounds).
test (e1: E_, e2: E_): BOOLEAN
effective function
In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
safe_equal (e1: E_, e2: E_): BOOLEAN
effective function
In order to avoid run-time type errors, feature safe_equal calls is_equal only when e1 and e2 have exactly the same dynamic type.
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.