Class Set

Storage for uniquely defined items (and ordering criterion).

class Set( ... ) \ from Sequence( ... )

more...

Summary

initStorage for uniquely defined items (and ordering criterion).
contains()Checks if a certain item is in the set.
find()Checks if a certain item is in the set.
insert()Adds an item to the set.
len()Returns the number of items stored in this set.
remove()Removes an item from a set.

Inherited methods

append from Sequence Adds an item at the end of the sequence.
back from Sequence Returns the last item in the Sequence.
clear from Sequence Removes all the items from the Sequence.
comp from Sequence Appends elements to this sequence through a filter.
empty from Sequence Checks if the Sequence is empty or not.
first from Sequence Returns an iterator to the first element of the Sequence.
front from Sequence Returns the first item in the Sequence.
last from Sequence Returns an iterator to the last element of the Sequence.
prepend from Sequence Adds an item in front of the sequence

Detailed description

Storage for uniquely defined items (and ordering criterion).

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.

Init Block

Storage for uniquely defined items (and ordering criterion).

init Set( ... )

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

Methods

contains()

Checks if a certain item is in the set.

Set.contains( item )

itemThe item to be found.
Returns:True if the item is in the set, false otherwise.

find()

Checks if a certain item is in the set.

Set.find( item )

itemThe item to be found.
Returns:True if the item is in the set, false otherwise.

insert()

Adds an item to the set.

Set.insert( item )

itemThe 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( )

Returns:Count of items in the set.

remove()

Removes an item from a set.

Set.remove( item )

itemThe item to be removed.
Returns:True if the item was removed, false if it wasn't found.

Made with faldoc 2.1.0