class WORDS
Summary
An hashed set of words, usually read from a file
Direct parents
Inherit list: HASHED_SET
Class invariant
Overview
Creation features
Features
{ANY}
{}
{ANY}
{SET}
  • buckets: NATIVE_ARRAY[HASHED_SET_NODE[E_]]
    The buckets storage area is the primary hash table of capacity elements.
Internal cache handling:
{SET}
{}
{ANY}
{ANY}
  • 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: WORDS)
    Make the intersection of the Current set with other.
  • copy (other: WORDS)
    Copy 'other' into the current set
  • from_collection (model: COLLECTION[E_])
    Add all items of model.
Implement manifest generic creation:
{}
{}
Counting:
{ANY}
To provide iterating facilities:
{ANY}
Mathematical operations:
{ANY}
  • union (other: WORDS)
    Make the union of the Current set with other.
  • fast_union (other: WORDS)
    Make the union of the Current set with other.
  • infix "+" (other: WORDS): WORDS
    Return the union of the Current set with other.
  • fast_intersection (other: WORDS)
    Make the intersection of the Current set with other.
  • infix "^" (other: WORDS): WORDS
    Return the intersection of the Current set with other.
  • minus (other: WORDS)
    Make the set Current - other.
  • fast_minus (other: WORDS)
    Make the set Current - other.
  • infix "-" (other: WORDS): WORDS
    Return the set Current - other.
Comparison:
{ANY}
Implement manifest generic creation:
{}
{ANY}
Other features:
{ANY}
Agent-based features:
{ANY}
Printing:
{ANY}
{ANY}
{}
Agent-based features:
{ANY}
{}
Indexing:
{ANY}
{ANY}
  • 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:
{}
add_from_file (a_file_name: STRING)
effective procedure
{ANY}
Add to Current the words read from the file named a_file_name.
print_all
effective procedure
{ANY}
hash_code (e: E_): INTEGER_32
effective function
{}
Default_size: INTEGER_32
is 53
constant attribute
{ANY}
Minimum size for storage in number of items.
buckets: NATIVE_ARRAY[HASHED_SET_NODE[E_]]
writable attribute
{SET}
The buckets storage area is the primary hash table of capacity elements.
cache_user: INTEGER_32
writable attribute
{SET}
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
{SET}
Meaningful only when cache_user is not -1.
cache_buckets: INTEGER_32
writable attribute
{SET}
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
{ANY}
Of the buckets storage area.
count: INTEGER_32
writable attribute
{ANY}
Number of available items in the hoard.
add (e: E_)
effective procedure
{ANY}
Add new item e to the set.
fast_add (e: E_)
effective procedure
{ANY}
Same job as add, but uses basic = for comparison.
remove (e: E_)
effective procedure
{ANY}
Remove item e from the set: the mathematical definition of removing from a set is followed.
fast_remove (e: E_)
effective procedure
{ANY}
Same job as remove, but uses basic = for comparison.
clear_count
effective procedure
{ANY}
Empty the current set (is_empty is True after that call).
clear_count_and_capacity
effective procedure
{ANY}
Empty the current set (is_empty is True after that call).
has (e: E_): BOOLEAN
effective function
{ANY}
Is element e in the set?
fast_has (e: E_): BOOLEAN
effective function
{ANY}
Is element e actually stored in the set?
reference_at (e: E_): E_
effective function
{ANY}
Non Void when e is in the set.
item (index: INTEGER_32): E_
effective function
{ANY}
Item at the corresponding index i.
intersection (other: WORDS)
effective procedure
{ANY}
Make the intersection of the Current set with other.
copy (other: WORDS)
effective procedure
{ANY}
Copy 'other' into the current set
from_collection (model: COLLECTION[E_])
effective procedure
{ANY}
Add all items of model.
manifest_make (needed_capacity: INTEGER_32)
effective procedure
{}
Manifest creation of a HASHED_SET.
free_nodes: WEAK_REFERENCE[HASHED_SET_NODE[E_]]
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
{ANY}
Is the set empty?
lower: INTEGER_32
is 1
constant attribute
{ANY}
Minimum index.
upper: INTEGER_32
effective function
{ANY}
Maximum index.
first: E_
effective function
{ANY}
The very first item.
last: E_
effective function
{ANY}
The last item.
new_iterator: ITERATOR[E_]
effective function
{ANY}
union (other: WORDS)
effective procedure
{ANY}
Make the union of the Current set with other.
fast_union (other: WORDS)
effective procedure
{ANY}
Make the union of the Current set with other.
infix "+" (other: WORDS): WORDS
effective function
{ANY}
Return the union of the Current set with other.
fast_intersection (other: WORDS)
effective procedure
{ANY}
Make the intersection of the Current set with other.
infix "^" (other: WORDS): WORDS
effective function
{ANY}
Return the intersection of the Current set with other.
minus (other: WORDS)
effective procedure
{ANY}
Make the set Current - other.
fast_minus (other: WORDS)
effective procedure
{ANY}
Make the set Current - other.
infix "-" (other: WORDS): WORDS
effective function
{ANY}
Return the set Current - other.
is_subset_of (other: WORDS): BOOLEAN
effective function
{ANY}
Is the Current set a subset of other?
is_disjoint_from (other: WORDS): BOOLEAN
effective function
{ANY}
Is the Current set disjoint from other ?
is_equal (other: WORDS): BOOLEAN
effective function
{ANY}
Is the Current set equal to other?
manifest_put (index: INTEGER_32, element: E_)
effective procedure
{}
manifest_semicolon_check: BOOLEAN
is False
constant attribute
{}
enumerate: ENUMERATE[E_]
effective function
{ANY}
get_new_iterator: ITERATOR[E_]
frozen
effective function
{ANY}
for_each (action: PROCEDURE[TUPLE[TUPLE 1[E_]]])
effective procedure
{ANY}
Apply action to every item of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Do all items satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
{ANY}
Does at least one item satisfy test?
aggregate (action: FUNCTION[TUPLE[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
{ANY}
Aggregate all the elements starting from the initial value.
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
generation: INTEGER_32
writable attribute
{ANY}
next_generation
effective procedure
{}
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
frozen
effective procedure
{ANY}
Apply action to every item of Current.
_inline_agent2 (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).
test (e1: E_, e2: E_): BOOLEAN
effective function
{ANY}
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
{ANY}
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
is 127
constant attribute
{}
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
is 32767
constant attribute
{}
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
is 9223372036854775807
constant attribute
{}
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
is {REAL_32 3.4028234663852885981170418348451692544e+38}
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
is -128
constant attribute
{}
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
is -32768
constant attribute
{}
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
is -9223372036854775808
constant attribute
{}
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
is {REAL_32 -3.40282346638528859811704183484516925440e+38}
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
is 64
constant attribute
{}
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
{}
Number of bits in a value of type POINTER.