smjg.libs.util.setbase.Set< T >.Set Class Reference

The Set class is the abstract base class from which set classes can be derived. More...

List of all members.

Operators

typedef opIn_r opIndex
 Implementation of this[elem].
deprecated typedef opIn_r contains
intBool opEquals (Object o)
 Determines whether this set is equal to another.
bool opIndexAssign (bool b, T elem)
 Adds or removes an element to or from the set.
Set opAnd (Set s)
 Returns the intersection of this set and s.
Set opOr (Set s)
 Returns the union of this set and s.
Set opSub (Set s)
 Returns a set containing the elements of this set that are not in s.
Set opXor (Set s)
 Returns the symmetric difference between this set and s.
Set opAnd (bool public(*dg)(T))
 Returns a set containing the elements of this set that for which dg returns true.
Set opSub (bool public(*dg)(T))
 Returns a set containing the elements of this set that for which dg returns false.
Set opAndAssign (Set s)
 Removes from this set those elements that are not in s.
Set opOrAssign (Set s)
 Adds to this set the elements of s.
Set opSubAssign (Set s)
 Removes from this set the elements of s.
Set opXorAssign (Set s)
 Toggles the presence in this set of each of the elements of s.
Set opAndAssign (bool public(*dg)(T))
 Removes from this set the elements for which dg returns false.
Set opSubAssign (bool public(*dg)(T))
 Removes from this set the elements for which dg returns true.

Public Member Functions

abstract void add (T elem)
 Adds an element to the set.
abstract void remove (T elem)
 Removes an element from the set.
abstract void removeCurrent ()
 Removes the element currently active in the innermost active foreach loop on this set.
bool subsetOf (Set s)
 Determines whether this set is a subset of another.
Set remove (bool public(*dg)(T))
 Removes from this set all elements for which dg returns true, and returns a set of the elements removed.
Set remove (Set s)
 Removes from this set all elements that are in s, and returns a set of the elements removed.
Properties
abstract size_t length ()
 Returns the number of elements in the set.
abstract Set dup ()
 Returns an exact copy of this set.
abstract T[] data ()
 Returns an array of the set's elements.
Operators
abstract bool opIn_r (T elem)
 Determines whether the set contains the given element.
abstract int opApply (int public abstract(*dg)(inout T))
 Iterates over the elements of the set.
Properties
string toString ()
 Returns a string representation of this set.
hash_t toHash ()
 Returns the hash value of this set.


Detailed Description

The Set class is the abstract base class from which set classes can be derived.

Default implementations of several methods are given. These may be overridden to provide an implementation optimised to the internal data structure used by the specific set implementation.


Member Typedef Documentation

typedef opIn_r smjg.libs.util.setbase.Set< T >.Set.opIndex

Implementation of this[elem].


Member Function Documentation

abstract void smjg.libs.util.setbase.Set< T >.Set.add ( elem  )  [pure virtual]

Adds an element to the set.

Parameters:
elem the element to add.

abstract void smjg.libs.util.setbase.Set< T >.Set.remove ( elem  )  [pure virtual]

Removes an element from the set.

Parameters:
elem the element to remove.

abstract void smjg.libs.util.setbase.Set< T >.Set.removeCurrent (  )  [pure virtual]

Removes the element currently active in the innermost active foreach loop on this set.

Precondition:
A foreach loop must be active on this set.
Warning:
The time at which the removal takes effect may depend on the implementation: it might take effect immediately, or not until the iteration of the foreach loop exits. It is also possible that, if within one foreach loop another is initiated on the same set after a removeCurrent statement, the wrong element may be removed.

abstract size_t smjg.libs.util.setbase.Set< T >.Set.length (  )  [pure virtual]

Returns the number of elements in the set.

abstract Set smjg.libs.util.setbase.Set< T >.Set.dup (  )  [pure virtual]

Returns an exact copy of this set.

abstract T [] smjg.libs.util.setbase.Set< T >.Set.data (  )  [pure virtual]

Returns an array of the set's elements.

abstract bool smjg.libs.util.setbase.Set< T >.Set.opIn_r ( elem  )  [pure virtual]

Determines whether the set contains the given element.

(Implementation of T in this.)

Parameters:
elem element to look up.
Returns:
true if the set contains the given element.

abstract int smjg.libs.util.setbase.Set< T >.Set.opApply ( int public abstract(*)(inout T)  dg  )  [pure virtual]

Iterates over the elements of the set.

(Implementation of foreach(T; this).)

Modifying the set while foreach is in progress, except by the removeCurrent method, may lead to undefined behaviour.

bool smjg.libs.util.setbase.Set< T >.Set.subsetOf ( Set< T >  s  ) 

Determines whether this set is a subset of another.

Parameters:
s set of which this may or may not be a subset.
Returns:
whether this set is a subset of s.

Set smjg.libs.util.setbase.Set< T >.Set.remove ( bool public(*)(T)  dg  ) 

Removes from this set all elements for which dg returns true, and returns a set of the elements removed.

Since:
0.5

Set smjg.libs.util.setbase.Set< T >.Set.remove ( Set< T >  s  ) 

Removes from this set all elements that are in s, and returns a set of the elements removed.

Since:
0.5

string smjg.libs.util.setbase.Set< T >.Set.toString (  ) 

Returns a string representation of this set.

Returns:
a string of the form { element, element, ... } where the elements are formatted according to the s format specifier.

hash_t smjg.libs.util.setbase.Set< T >.Set.toHash (  ) 

Returns the hash value of this set.

Returns:
the hash value, calculated by XORing together the hash values of all the elements.

intBool smjg.libs.util.setbase.Set< T >.Set.opEquals ( Object  o  ) 

Determines whether this set is equal to another.

bool smjg.libs.util.setbase.Set< T >.Set.opIndexAssign ( bool  b,
elem 
)

Adds or removes an element to or from the set.

(Implementation of this[elem] = b.)

Parameters:
elem the element to add or remove.
b true to add the element, or false to remove it.
Returns:
b.

Set smjg.libs.util.setbase.Set< T >.Set.opAnd ( Set< T >  s  ) 

Returns the intersection of this set and s.

Set smjg.libs.util.setbase.Set< T >.Set.opOr ( Set< T >  s  ) 

Returns the union of this set and s.

Set smjg.libs.util.setbase.Set< T >.Set.opSub ( Set< T >  s  ) 

Returns a set containing the elements of this set that are not in s.

Set smjg.libs.util.setbase.Set< T >.Set.opXor ( Set< T >  s  ) 

Returns the symmetric difference between this set and s.

Set smjg.libs.util.setbase.Set< T >.Set.opAnd ( bool public(*)(T)  dg  ) 

Returns a set containing the elements of this set that for which dg returns true.

Set smjg.libs.util.setbase.Set< T >.Set.opSub ( bool public(*)(T)  dg  ) 

Returns a set containing the elements of this set that for which dg returns false.

Set smjg.libs.util.setbase.Set< T >.Set.opAndAssign ( Set< T >  s  ) 

Removes from this set those elements that are not in s.

Set smjg.libs.util.setbase.Set< T >.Set.opOrAssign ( Set< T >  s  ) 

Adds to this set the elements of s.

Set smjg.libs.util.setbase.Set< T >.Set.opSubAssign ( Set< T >  s  ) 

Removes from this set the elements of s.

Set smjg.libs.util.setbase.Set< T >.Set.opXorAssign ( Set< T >  s  ) 

Toggles the presence in this set of each of the elements of s.

Set smjg.libs.util.setbase.Set< T >.Set.opAndAssign ( bool public(*)(T)  dg  ) 

Removes from this set the elements for which dg returns false.

Set smjg.libs.util.setbase.Set< T >.Set.opSubAssign ( bool public(*)(T)  dg  ) 

Removes from this set the elements for which dg returns true.


Member Data Documentation

deprecated typedef opIn_r smjg.libs.util.setbase.Set< T >.Set.contains


The documentation for this class was generated from the following file:
Generated on Sun Sep 13 19:50:38 2009 for Stewart's Utility Library by  doxygen 1.5.4