Implemented with two cascading hashtables for O(log(size)) performance. Implements IEnumerable to enable iteration.
Public Member Functions | |
void | add (Object o1, Object o2) |
Add object pair (o1,o2) to the set. | |
void | add (Pair p) |
Add given object pair to the set. Attention: the pair itself is not stored, so do not rely on Pair object identity on iteration. | |
void | remove (Object o1, Object o2) |
Remove object pair (o1,o2) from the set. | |
void | remove (Pair p) |
Remove object pair from the set. | |
void | removeWhereLeft (Object o) |
Remove all elements whose left part equals to o. | |
void | removeWhereRight (Object o) |
Remove all elements whose right part equals to o. | |
bool | contains (Object o1, Object o2) |
Return whether given object pair (o1,o2) is contained in the set. | |
bool | contains (Pair p) |
Return whether given object pair is contained in the set. | |
bool | isEmpty () |
Return whether set is empty. | |
Pair | take () |
Choose an element, remove it from the set and return it. Do not use on empty sets (this returns a (null,null) pair)! | |
IEnumerator | GetEnumerator () |
Return an enumerator over all possible values. | |
override string | ToString () |
Return the set in mathematical syntax. | |
Properties | |
int | Count |
Number of elements in the set. | |
Hashtable | elems = new Hashtable() |
Stores the elements in this set in two cascaded hashtables (Object -> Object -> null). |
|
Add given object pair to the set. Attention: the pair itself is not stored, so do not rely on Pair object identity on iteration.
|
|
Add object pair (o1,o2) to the set.
|
|
Return whether given object pair is contained in the set.
|
|
Return whether given object pair (o1,o2) is contained in the set.
|
|
Return an enumerator over all possible values.
|
|
Return whether set is empty.
|
|
Remove object pair from the set.
|
|
Remove object pair (o1,o2) from the set.
|
|
Remove all elements whose left part equals to o.
|
|
Remove all elements whose right part equals to o.
|
|
Choose an element, remove it from the set and return it. Do not use on empty sets (this returns a (null,null) pair)!
|
|
Return the set in mathematical syntax.
|
|
Number of elements in the set.
|
|
Stores the elements in this set in two cascaded hashtables (Object -> Object -> null).
|