LisaacTM Platform

HASHED_SET


Definition of a mathematical set of hashable objects.
All common operations on mathematical sets are available.
Inherit/Insert Summary
parent_set
parent_traversable No developed.
parent_safe_equal No developed.
 
Constructor Summary
create
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.
create_with_capacity
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.
 
Slot Summary
default_size
Minimum size for storage in number of items.
buckets
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).
cache_user
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
Meaningful only when cache_user is not -1.
cache_buckets
Meaningful only when cache_user is not -1.
make
Creation of an empty SET.
with_capacity
capacity
Of the buckets storage area.
count
Cardinality of the set (i.e. actual count of stored elements). Number of available indices.
See also is_empty, lower, upper.
union
Make the union of the self set with other. Make the union of the Current set with other.
fast_union
Make the union of the self set with other. Make the union of the Current set with other.
is_disjoint
fast_is_disjoint
minus
Make the set self - other. Make the set Current - other.
is_empty
Is the set empty? Is collection empty ?
See also count.
 
Adding and removing:
add
Add a new item to the set:the mathematical definition of adding in a set is followed. Add new item e to the set. 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.
fast_add
Add a new item to the set:the mathematical definition of adding in a set is followed. Same job as add, but uses basic = for comparison.
remove
Remove item e from the set:the mathematical definition of removing from a set is followed. Remove item e from the set: the mathematical definition of removing from a set is followed.
fast_remove
Remove item e from the set:the mathematical definition of removing from a set is followed. Same job as remove, but uses basic = for comparison.
clear
Empty the current set.
clear_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.
clear_count_and_capacity
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.
 
Looking and searching:
has
Is element e in the set? Is element e in the set? 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.
fast_has
Is element e in the set? Is element e actually stored in the set? Warning: this query is using basic = for comparison.
See also has when dealing with reference types.
reference_at
Non Void when e is in the set. In such a situation, Result is the object which is actually stored in the Current set (see ensure assertion).
reference_at with
 
To provide iterating facilities:
item
Return the item indexed by index. Item at the corresponding index i.
See also lower, upper, valid_index.
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. Item at the corresponding index i.
See also lower, upper, valid_index.
lower
Minimum index.
See also upper, valid_index, item.
upper
Maximum index.
See also lower, valid_index, item.
first
The very first item.
See also last, item.
SETs are intrinsically unordered, so there is no guarantee that first after performing an add or remove operation is related in any way to first before that operation. The very first item.
See also last, item.
last
The last item.
See also first, item.
SETs are intrinsically unordered, so there is no guarantee that last after performing an add or remove operation is related in any way to last before that operation. The last item.
See also first, item.
 
Mathematical operations:
intersection
Make the intersection of the self set with other. Make the intersection of the Current set with other.
copy
Copy 'other' into the current set Copy 'other' into the current set
from_collection
Add all items of model.
Infix '+'
Return the union of the Current set with other.
fast_intersection
Make the intersection of the Current set with other.
Infix '^'
Return the intersection of the Current set with other.
Infix '-'
Return the set Current - other.
 
Comparison:
is_subset_of
Is the self set a subset of other? Is the Current set a subset of other?
is_disjoint_from
Is the self set disjoint from other ? Is the Current set disjoint from other ?
Infix '=='
Is the self set equal to other? Is the Current set equal to other?
fast_copy
Copy 'other' into the current set
 
NONE
force
Add a new item to the set: the mathematical definition of adding in a set is followed.
search
Is element e in the set?
get_if with_hash
Is element e in the set?
fast_search
Is element e in the set?
fast_index_of
 
Comparison:
fast_is_disjoint_from
Is the Current set disjoint from other ?
 
Agents based features:
foreach
do_all
Apply action to every item of Self.
See also for_all, exists.
for_all
Do all items satisfy predicate?
See also do_all, exists.
exists
Does at least one item satisfy predicate?
See also do_all, for_all.
 

Inherit/Insert Detail

parent_set

.../base/collection/hashed_set.li line #14

Section:
Inherit

Profile:
+ SelfSELFparent_set :Expanded  SETV)

parent_traversable

.../base/collection/low_level/set.li line #15

Section:
Inherit

Profile:
+ SelfSELFparent_traversable : TRAVERSABLEV)

parent_safe_equal

.../base/collection/low_level/set.li line #17

Section:
Inherit

Profile:
+ SelfSELFparent_safe_equal : SAFE_EQUALV)

Constructor Detail

create

.../base/collection/hashed_set.li line #49

Section:
Public

Profile:
- SelfSELFcreate : SELF

Description:
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.

create_with_capacity

.../base/collection/hashed_set.li line #69

Section:
Public

Profile:
- SelfSELFcreate_with_capacity   sz : INTEGERSELF

Description:
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.

Detail slot

default_size

.../base/collection/hashed_set.li line #18

Section:
Public

Profile:
- SelfSELFdefault_size : INTEGER

Description:
Minimum size for storage in number of items.

buckets

.../base/collection/hashed_set.li line #23

Section:
SET

Profile:
+ SelfSELFbuckets : NATIVE_ARRAYHASHED_SET_NODEV))

Description:
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).

cache_user

.../base/collection/hashed_set.li line #34

Section:
SET

Profile:
+ SelfSELFcache_user : INTEGER

Description:
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

.../base/collection/hashed_set.li line #41

Section:
SET

Profile:
+ SelfSELFcache_node : HASHED_SET_NODEV)

Description:
Meaningful only when cache_user is not -1.

cache_buckets

.../base/collection/hashed_set.li line #44

Section:
SET

Profile:
+ SelfSELFcache_buckets : INTEGER

Description:
Meaningful only when cache_user is not -1.

make

.../base/collection/hashed_set.li line #61

Section:
Public

Profile:
- SelfSELFmake 

Description:
Creation of an empty SET.

with_capacity

.../base/collection/hashed_set.li line #85

Section:
Public

Profile:
- SelfSELFwith_capacity   medium_size : INTEGER

capacity

.../base/collection/hashed_set.li line #106

Section:
Public

Profile:
+ SelfSELFcapacity : INTEGER

Description:
Of the buckets storage area.

count

.../base/collection/hashed_set.li line #108

Section:
Public

Profile:
+ SelfSELFcount : INTEGER

Description:
Cardinality of the set (i.e. actual count of stored elements). Number of available indices.
See also is_empty, lower, upper.

union

.../base/collection/hashed_set.li line #452

Section:
Public

Profile:
- SelfSELFunion   other : SELF

Description:
Make the union of the self set with other. Make the union of the Current set with other.

fast_union

.../base/collection/hashed_set.li line #467

Section:
Public

Profile:
- SelfSELFfast_union   other : SELF

Description:
Make the union of the self set with other. Make the union of the Current set with other.

is_disjoint

.../base/collection/hashed_set.li line #500

Section:
Public

Profile:
- SelfSELFis_disjoint   other : SELFBOOLEAN

fast_is_disjoint

.../base/collection/hashed_set.li line #516

Section:
Public

Profile:
- SelfSELFfast_is_disjoint   other : SELFBOOLEAN

minus

.../base/collection/hashed_set.li line #545

Section:
Public

Profile:
- SelfSELFminus   other : SELF

Description:
Make the set self - other. Make the set Current - other.

is_empty

.../base/collection/low_level/set.li line #31

Section:
Public

Profile:
- SelfSELFis_empty : BOOLEAN

Description:
Is the set empty? Is collection empty ?
See also count.

Adding and removing:

add

.../base/collection/hashed_set.li line #114

Section:
Public

Profile:
- SelfSELFadd   e : V

Description:
Add a new item to the set:the mathematical definition of adding in a set is followed. Add new item e to the set. 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.

fast_add

.../base/collection/hashed_set.li line #138

Section:
Public

Profile:
- SelfSELFfast_add   e : V

Description:
Add a new item to the set:the mathematical definition of adding in a set is followed. Same job as add, but uses basic = for comparison.

remove

.../base/collection/hashed_set.li line #162

Section:
Public

Profile:
- SelfSELFremove   e : V

Description:
Remove item e from the set:the mathematical definition of removing from a set is followed. Remove item e from the set: the mathematical definition of removing from a set is followed.

fast_remove

.../base/collection/hashed_set.li line #192

Section:
Public

Profile:
- SelfSELFfast_remove   e : V

Description:
Remove item e from the set:the mathematical definition of removing from a set is followed. Same job as remove, but uses basic = for comparison.

clear

.../base/collection/hashed_set.li line #222

Section:
Public

Profile:
- SelfSELFclear 

Description:
Empty the current set.

clear_count

.../base/collection/low_level/set.li line #102

Section:
Public

Profile:
- SelfSELFclear_count 

Description:
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.

clear_count_and_capacity

.../base/collection/low_level/set.li line #116

Section:
Public

Profile:
- SelfSELFclear_count_and_capacity 

Description:
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.

Looking and searching:

has

.../base/collection/hashed_set.li line #237

Section:
Public

Profile:
- SelfSELFhas   e : VBOOLEAN

Description:
Is element e in the set? Is element e in the set? 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.

fast_has

.../base/collection/hashed_set.li line #250

Section:
Public

Profile:
- SelfSELFfast_has   e : VBOOLEAN

Description:
Is element e in the set? Is element e actually stored in the set? Warning: this query is using basic = for comparison.
See also has when dealing with reference types.

reference_at

.../base/collection/hashed_set.li line #263

Section:
Public

Profile:
- SelfSELFreference_at   e : VV

Description:
Non Void when e is in the set. In such a situation, Result is the object which is actually stored in the Current set (see ensure assertion).

reference_at with

.../base/collection/hashed_set.li line #279

Section:
Public

Profile:
- SelfSELFreference_at   e : V  with   cmp :{VV);  BOOLEAN}V

To provide iterating facilities:

item

.../base/collection/hashed_set.li line #299

Section:
Public

Profile:
- SelfSELFitem   i : INTEGERV

Description:
Return the item indexed by index. Item at the corresponding index i.
See also lower, upper, valid_index.
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. Item at the corresponding index i.
See also lower, upper, valid_index.

lower

.../base/collection/low_level/set.li line #183

Section:
Public

Profile:
- SelfSELFlower : INTEGER

Description:
Minimum index.
See also upper, valid_index, item.

upper

.../base/collection/low_level/set.li line #185

Section:
Public

Profile:
- SelfSELFupper : INTEGER

Description:
Maximum index.
See also lower, valid_index, item.

first

.../base/collection/low_level/set.li line #208

Section:
Public

Profile:
- SelfSELFfirst : V

Description:
The very first item.
See also last, item.
SETs are intrinsically unordered, so there is no guarantee that first after performing an add or remove operation is related in any way to first before that operation. The very first item.
See also last, item.

last

.../base/collection/low_level/set.li line #217

Section:
Public

Profile:
- SelfSELFlast : V

Description:
The last item.
See also first, item.
SETs are intrinsically unordered, so there is no guarantee that last after performing an add or remove operation is related in any way to last before that operation. The last item.
See also first, item.

Mathematical operations:

intersection

.../base/collection/hashed_set.li line #310

Section:
Public

Profile:
- SelfSELFintersection   other : SELF

Description:
Make the intersection of the self set with other. Make the intersection of the Current set with other.

copy

.../base/collection/hashed_set.li line #344

Section:
Public

Profile:
- SelfSELFcopy   other : SELF

Description:
Copy 'other' into the current set Copy 'other' into the current set

from_collection

.../base/collection/hashed_set.li line #360

Section:
Public

Profile:
- SelfSELFfrom_collection   model : COLLECTIONV)

Description:
Add all items of model.

Infix '+'

.../base/collection/low_level/set.li line #272

Section:
Public

Profile:
- SelfSELF+ '  other : SELFSELF

Description:
Return the union of the Current set with other.

fast_intersection

.../base/collection/low_level/set.li line #309

Section:
Public

Profile:
- SelfSELFfast_intersection   other : SELF

Description:
Make the intersection of the Current set with other.

Infix '^'

.../base/collection/low_level/set.li line #330

Section:
Public

Profile:
- SelfSELF^ '  other : SELFSELF

Description:
Return the intersection of the Current set with other.

Infix '-'

.../base/collection/low_level/set.li line #367

Section:
Public

Profile:
- SelfSELF- '  other : SELFSELF

Description:
Return the set Current - other.

Comparison:

is_subset_of

.../base/collection/hashed_set.li line #580

Section:
Public

Profile:
- SelfSELFis_subset_of   other : SELFBOOLEAN

Description:
Is the self set a subset of other? Is the Current set a subset of other?

is_disjoint_from

.../base/collection/hashed_set.li line #605

Section:
Public

Profile:
- SelfSELFis_disjoint_from   other : SELFBOOLEAN

Description:
Is the self set disjoint from other ? Is the Current set disjoint from other ?

Infix '=='

.../base/collection/hashed_set.li line #636

Section:
Public

Profile:
- SelfSELF== ' Right 60  other : SELFBOOLEAN

Description:
Is the self set equal to other? Is the Current set equal to other?

fast_copy

.../base/collection/hashed_set.li line #661

Section:
Public

Profile:
- SelfSELFfast_copy   other : SELF

Description:
Copy 'other' into the current set

NONE

force

.../base/collection/hashed_set.li line #681

Section:
Public

Profile:
- SelfSELFforce   e : V

Description:
Add a new item to the set: the mathematical definition of adding in a set is followed.

search

.../base/collection/hashed_set.li line #699

Section:
Public

Profile:
- SelfSELFsearch   e : VV

Description:
Is element e in the set?

get_if with_hash

.../base/collection/hashed_set.li line #716

Section:
Public

Profile:
- SelfSELFget_if   cmp : BLOCK  with_hash   h : INTEGERV

Description:
Is element e in the set?

fast_search

.../base/collection/hashed_set.li line #733

Section:
Public

Profile:
- SelfSELFfast_search   e : VV

Description:
Is element e in the set?

fast_index_of

.../base/collection/hashed_set.li line #750

Section:
Public

Profile:
- SelfSELFfast_index_of   elt : VINTEGER

Comparison:

fast_is_disjoint_from

.../base/collection/low_level/set.li line #440

Section:
Public

Profile:
- SelfSELFfast_is_disjoint_from   other : SELFBOOLEAN

Description:
Is the Current set disjoint from other ?

Agents based features:

foreach

.../base/collection/low_level/set.li line #529

Section:
Public

Profile:
- SelfSELFforeach   action :{ V; }

do_all

.../base/collection/low_level/set.li line #531

Section:
Public

Profile:
- SelfSELFdo_all   action :{ V; }

Description:
Apply action to every item of Self.
See also for_all, exists.

for_all

.../base/collection/low_level/set.li line #544

Section:
Public

Profile:
- SelfSELFfor_all   predicate : BLOCKBOOLEAN

Description:
Do all items satisfy predicate?
See also do_all, exists.

exists

.../base/collection/low_level/set.li line #560

Section:
Public

Profile:
- SelfSELFexists   predicate : BLOCKBOOLEAN

Description:
Does at least one item satisfy predicate?
See also do_all, for_all.