LisaacTM Platform

SET


Definition of a mathematical set of objects.
All common operations on mathematical sets are available. Well knowned implementations are HASHED_SET and AVL_SET.
Inherit/Insert Summary
parent_traversable No developed.
parent_safe_equal No developed.
 
Constructor Summary
create
 
Slot Summary
count
Cardinality of the set (i.e. actual count of stored elements). Number of available indices.
See also is_empty, lower, upper.
is_empty
Is the set empty? Is collection empty ?
See also count.
 
Adding and removing:
add
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
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.
fast_remove
Same job as remove, but uses basic = for comparison.
clear
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? 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 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).
 
To provide iterating facilities:
lower
Minimum index.
See also upper, valid_index, item.
upper
Maximum index.
See also lower, valid_index, item.
item
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.
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:
union
Make the union of the Current set with other.
fast_union
Make the union of the Current set with other.
Infix '+'
Return the union of the Current set with other.
intersection
Make the intersection 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.
minus
Make the set Current - other.
Infix '-'
Return the set Current - other.
 
Comparison:
is_subset_of
Is the Current set a subset of other?
is_disjoint_from
Is the Current set disjoint from other ?
fast_is_disjoint_from
Is the Current set disjoint from other ?
Infix '=='
Is the Current set equal to other?
 
Duplication.
copy
Copy 'other' into the current set
from_collection
Add all items of model.
 
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.
 
Creation.
make
Creation of an empty SET.
 

Inherit/Insert Detail

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/low_level/set.li line #579

Section:
Public

Profile:
- SelfSELFcreate : SELF

Detail slot

count

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

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.

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/low_level/set.li line #38

Section:
Public

Profile:
- SelfSELFadd   e : V

Description:
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/low_level/set.li line #57

Section:
Public

Profile:
- SelfSELFfast_add   e : V

Description:
Same job as add, but uses basic = for comparison.

remove

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

Section:
Public

Profile:
- SelfSELFremove   e : V

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

fast_remove

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

Section:
Public

Profile:
- SelfSELFfast_remove   e : V

Description:
Same job as remove, but uses basic = for comparison.

clear

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

Section:
Public

Profile:
- SelfSELFclear 

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/low_level/set.li line #133

Section:
Public

Profile:
- SelfSELFhas   e : VBOOLEAN

Description:
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/low_level/set.li line #149

Section:
Public

Profile:
- SelfSELFfast_has   e : VBOOLEAN

Description:
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/low_level/set.li line #164

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

To provide iterating facilities:

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.

item

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

Section:
Public

Profile:
- SelfSELFitem   i : INTEGERV

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

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:

union

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

Section:
Public

Profile:
- SelfSELFunion   other : SELF

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

fast_union

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

Section:
Public

Profile:
- SelfSELFfast_union   other : SELF

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

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.

intersection

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

Section:
Public

Profile:
- SelfSELFintersection   other : SELF

Description:
Make the intersection 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.

minus

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

Section:
Public

Profile:
- SelfSELFminus   other : SELF

Description:
Make the set Current - 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/low_level/set.li line #387

Section:
Public

Profile:
- SelfSELFis_subset_of   other : SELFBOOLEAN

Description:
Is the Current set a subset of other?

is_disjoint_from

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

Section:
Public

Profile:
- SelfSELFis_disjoint_from   other : SELFBOOLEAN

Description:
Is the Current set disjoint from other ?

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 ?

Infix '=='

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

Section:
Public

Profile:
- SelfSELF== '  other : SELFBOOLEAN

Description:
Is the Current set equal to other?

Duplication.

copy

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

Section:
Public

Profile:
- SelfSELFcopy   other : SELF

Description:
Copy 'other' into the current set

from_collection

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

Section:
Public

Profile:
- SelfSELFfrom_collection   model : COLLECTIONV)

Description:
Add all items of model.

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.

Creation.

make

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

Section:
Public

Profile:
- SelfSELFmake 

Description:
Creation of an empty SET.