1.33Class Set

Storage for uniquely defined items (and ordering criterion).

Class Set( ... ) from \
                 Sequence( ... )
... An arbitrary list of parameters.

The Set class implements a binary tree, uniquely and orderly storing a set of generic Falcon items. Instances of the Set class can be used as parameters for the Iterator constructor, and an iterator can be generated for them using first() and last() BOM methods. Also, instances of the Set class can be used as any other sequence in for/in loops.

Items in the set are ordered using the Falcon standard comparison algorithm; if they are instances of classes (or blessed dictionaries) implementing the compare() method, that method is used as a comparison criterion.

If the set constructor is given some parameters, it will be initially filled with those items; if some of them is duplicated, only one item will be then found in the set.

Methods
containsChecks if a certain item is in the set.
findChecks if a certain item is in the set.
insertAdds an item to the set.
lenReturns the number of items stored in this set.
removeRemoves an item from a set.
Methods inherited from class Sequence
appendAdds an item at the end of the sequence.
backReturns the last item in the Sequence.
clearRemoves all the items from the Sequence.
compAppends elements to this sequence through a filter.
emptyChecks if the Sequence is empty or not.
firstReturns an iterator to the first element of the Sequence.
frontReturns the first item in the Sequence.
lastReturns an iterator to the last element of the Sequence.
mcompAppends elements to this sequence from multiple sources.
mfcompAppends elements to this sequence from multiple sources through a filter.
prependAdds an item in front of the sequence

Methods

contains

Checks if a certain item is in the set.

Set.contains( item )
item The item to be found.
ReturnTrue if the item is in the set, false otherwise.

find

Checks if a certain item is in the set.

Set.find( item )
item The item to be found.
ReturnTrue if the item is in the set, false otherwise.

insert

Adds an item to the set.

Set.insert( item )
item The item to be added.

If an item considered equal to the added one exists, the previously set item is destroyed.

len

Returns the number of items stored in this set.

Set.len()
ReturnCount of items in the set.

remove

Removes an item from a set.

Set.remove( item )
item The item to be removed.
ReturnTrue if the item was removed, false if it wasn't found.
Made with http://www.falconpl.org