container.set - Palamecia/mint GitHub Wiki
Module
load container.set
This module provides the Container.Set class which store unique objects and provides fast lookup of a value.
Packages
Classes
Container.Set
This class create a set based on Container.RedBlackTree which stores a liste of unique values.
When iterating over a Container.Set, the elements are always sorted. A
comparator
function must be provided to the class instances to be used to
sort values. The values inserted in the instances must provide the operator
used by the function.
Members
Modifiers | Member | Description |
---|---|---|
+ const |
clear | Removes all the elements of the set. |
+ const |
each | Apply the func function to each elements of the set. |
+ const |
in | Returns an iterator on each element of the set. |
+ const |
insert | Inserts value in the set. If value is already contained in the set, this ... |
+ const |
isEmpty | Returns true if the set is empty; otherwise returns false . |
+ const |
new | Creates a new instance of Container.Set. If values is given, the set will b... |
+ const |
remove | Removes value from the set. If value is not contained in the set, false ... |
- final |
root | Root element node. |
+ const |
size | Returns the number of elements in the set. |
+ const |
toArray | Converts the set to an array . |
+ const |
values | Returns an array containing each elements of the set. |
Descriptions
Container.Set.clear
def (self)
Removes all the elements of the set.
Container.Set.each
def (const self, func)
Apply the func
function to each elements of the set.
Container.Set.in
def (const self)
Returns an iterator
on each element of the set.
def (const self, const value)
Returns true
if the set contains the value
value; otherwise returns
false
.
Container.Set.insert
def (self, value)
Inserts value
in the set. If value
is already contained in the set,
this method has no effect.
Container.Set.isEmpty
def (const self)
Returns true
if the set is empty; otherwise returns false
.
Container.Set.new
def (self, values = (), comparator = hashKeyCompareOperator)
Creates a new instance of Container.Set. If values
is given, the set
will be initialized with the given values. The comparator
function can
be overloaded to change the value sorting behaviour of the set. By default,
the same behaviour than the hash
keys is used.
Container.Set.remove
def (self, value)
Removes value
from the set.
If value
is not contained in the set, false
is returned; otherwise
true
is returned.
Container.Set.root
null
Root element node.
Container.Set.size
def (const self)
Returns the number of elements in the set.
Container.Set.toArray
def (const self)
Converts the set to an array
.
Container.Set.values
def (const self)
Returns an array
containing each elements of the set.