Lisaac prototype interface

Section Header
+ name := HASHED_SET[E];
- comment := "Definition of a mathematical set of hashable objects.";
All common operations on mathematical sets are available.
Section Inherit
+ parent_set:Expanded SET[E];
Section Public
- default_size:INTEGER :=
Minimum size for storage in number of items.
Section SET
+ buckets:NATIVE_ARRAY[HASHED_SET_NODE[E]];
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 HASH_TABLE_SIZE).
Internal cache handling:
+ cache_user:INTEGER;
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'.
+ cache_node:HASHED_SET_NODE[E];
Meaningful only when `cache_user' is not -1.
+ cache_buckets:INTEGER;
Meaningful only when `cache_user' is not -1.
Section Public
- create:SELF <-
Create an empty set. 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.
- make <-
- create_with_capacity sz:INTEGER :SELF <-
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.
- with_capacity medium_size:INTEGER <-
Counting:
+ capacity:INTEGER;
Of the `buckets' storage area.
+ count:INTEGER;
Adding and removing:
- add e:E <-
Add a new item to the set:the mathematical definition of
adding in a set is followed.
- fast_add e:E <-
Add a new item to the set:the mathematical definition of
adding in a set is followed.
- remove e:E <-
Remove item `e' from the set:the mathematical definition of
removing from a set is followed.
- fast_remove e:E <-
Remove item `e' from the set:the mathematical definition of
removing from a set is followed.
- clear <-
Empty the current set.
Looking and searching:
- has e:E :BOOLEAN <-
Is element `e' in the set?
- fast_has e:E :BOOLEAN <-
Is element `e' in the set?
- reference_at e:E :E <-
To provide iterating facilities:
- item i:INTEGER :E <-
Return the item indexed by `index'.
Mathematical operations:
- intersection other:SELF <-
Make the intersection of the `self' set with `other'.
- copy other:SELF <-
Copy 'other' into the current set
- from_collection model:COLLECTION[E] <-