next up previous contents index
Next: Input multiplexing Up: Support components Previous: Dictionaries for registrations   Contents   Index

Sets

Sets are collections of objects with no duplicates. A set is usually implemented using similar data structures as a dictionary. For a very simple implementation an array or a linked list can be used, but for better performance a balanced tree or a hash table are more suitable choices. The tree alternative requires that the elements of the set can be ordered though. The most important operations on a set is the following:

add(object)

Adds object to the set.
contains(object) -> boolean

Checks if the set contains the given object.
remove(object)

Removes an object from the set.

As with dictionaries sets are often available in some library ready to be used. For implementation details see a data structures book.



Marcus Bergner 2003-06-10