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.
The buckets storage area is the primary hash table of capacity elements.
To search some
element, the first access is done in buckets using the remainder of the division of the key
hash_code by capacity. In order to try to avoid clashes, capacity is always a prime number
(selected using HASHED_CAPACITY).
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.
When the cache
is active, the corresponding index in buckets is save in cache_buckets and the corresponding
node in cache_node.
Internal storage capacity of the set is initialized using the
Default_size value. Then, tuning of needed storage size is done automatically according to
usage. If you are really sure that your set is always really bigger than Default_size, you may
use with_capacity to save some execution time.
Create an empty set using medium_size as an appropriate value to help initialization of
capacity.
Thus, this feature may be used in place of make to save some execution time if one
is sure that storage size will rapidly become really bigger than Default_size (if not sure,
simply use make). Anyway, the initial medium_size value is just an indication and never a
limit for the possible capacity. Keep in mind that the capacity tuning is done automatically
according to usage.
The mathematical definition of adding in a set is followed, i.e. the
element e is added only and only if it is not yet present in the set.
As this add feature is actually using is_equal, you may consider to use fast_add for expanded
objects as well while trying to get the very best performances.
require
e /= Void
ensure
added: has(e)
not_in_then_added: not old has(e) implies count = old count + 1
in_then_not_added: old has(e) implies count = old count
Empty the current set (is_empty is True after that call).
If possible, the actual implementation
is supposed to keep its internal storage area in order to refill Current in an efficient way.
See also clear_count_and_capacity to select the most appropriate.
Empty the current set (is_empty is True after that call).
If possible, the actual implementation
is supposed to release its internal storage area for this memory to be used by other objects.
See also clear_count to select the most appropriate.
As this query is actually using is_equal, you may consider to use fast_has for expanded
objects as well while trying to get the very best performances.
SETs are intrinsically unordered, so there is no guarantee that item(i) after performing an add
or remove operation is related in any way to item(i) before that operation.