Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members

Sets::PairSet Class Reference

List of all members.

Detailed Description

Set for storing pairs of objects.

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


Member Function Documentation

void Sets::PairSet::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 Sets::PairSet::add Object  o1,
Object  o2
 

Add object pair (o1,o2) to the set.

bool Sets::PairSet::contains Pair  p  ) 
 

Return whether given object pair is contained in the set.

bool Sets::PairSet::contains Object  o1,
Object  o2
 

Return whether given object pair (o1,o2) is contained in the set.

IEnumerator Sets::PairSet::GetEnumerator  ) 
 

Return an enumerator over all possible values.

bool Sets::PairSet::isEmpty  ) 
 

Return whether set is empty.

void Sets::PairSet::remove Pair  p  ) 
 

Remove object pair from the set.

void Sets::PairSet::remove Object  o1,
Object  o2
 

Remove object pair (o1,o2) from the set.

void Sets::PairSet::removeWhereLeft Object  o  ) 
 

Remove all elements whose left part equals to o.

void Sets::PairSet::removeWhereRight Object  o  ) 
 

Remove all elements whose right part equals to o.

Pair Sets::PairSet::take  ) 
 

Choose an element, remove it from the set and return it. Do not use on empty sets (this returns a (null,null) pair)!

override string Sets::PairSet::ToString  ) 
 

Return the set in mathematical syntax.


Property Documentation

int Sets::PairSet::Count [get]
 

Number of elements in the set.

Hashtable Sets::PairSet::elems = new Hashtable() [private]
 

Stores the elements in this set in two cascaded hashtables (Object -> Object -> null).


The documentation for this class was generated from the following file:
Generated on Mon Jun 21 01:20:50 2004 for cs2ccmb by doxygen 1.3.7