Maintains a doubly linked list of Entry objects from a single associated Domain and may also be assigned a user-defined value of type V. More...
#include <partition.hpp>
Classes | |
class | ConstIterator |
A bidirectional iterator for traversing the Entry objects of a const Group. More... | |
class | Iterator |
A bidirectional iterator for traversing the Entry objects of a Group. More... | |
Public Types | |
typedef Domain< M, V >::Entry | Entry |
Public Member Functions | |
Group () | |
Constructs an empty Group with no Domain association and a default value. More... | |
Group (Domain< M, V > &d) | |
Constructs an empty Group associated with Domain d and a default value. More... | |
Group (Domain< M, V > &d, const V &v) | |
Constructs an empty Group associated with Domain d and sets the Group's value to v . More... | |
Group (Domain< M, V > &d, const Group &g) | |
Constructs a Group that is a copy of g with the exception that its associated with Domain d . More... | |
template<typename InputIterator > | |
Group (Domain< M, V > &d, const InputIterator &first, const InputIterator &last) | |
Constructs a Group loaded with the IDs listed from first to last . More... | |
virtual | ~Group () |
Destructs the Group, removing all Entry objects from the Group. More... | |
Domain< M, V > * | getDomain () |
Returns a pointer to the Domain associated with this Group (or NULL if this Group has no Domain association). More... | |
const Domain< M, V > * | getDomain () const |
Returns a pointer to the const Domain associated with this Group (or NULL if this Group has no Domain association). More... | |
void | setDomain (Domain< M, V > &d) |
Associates this Group with Domain d . More... | |
V & | getValue () |
Returns a reference to the user provided value associated with this Group. More... | |
const V & | getValue () const |
Returns a const reference to the user provided value associated with this Group. More... | |
void | setValue (const V &v) |
Sets v as this Group's value. More... | |
int | size () const |
Returns the number of Entry objects in this Group's list. More... | |
bool | contains (int id) const |
Returns true if this Group contains the Entry with the given id , and false otherwise. More... | |
Entry & | peekFront () |
Returns a reference to the Entry at the front of the Group list while leaving the list unmodified. More... | |
const Entry & | peekFront () const |
Returns a const reference to the Entry at the front of the Group list while leaving the list unmodified. More... | |
Entry & | peekBack () |
Returns a reference to the Entry at the back of the Group list while leaving the list unmodified. More... | |
const Entry & | peekBack () const |
Returns a const reference to the Entry at the back of the Group list while leaving the list unmodified. More... | |
void | addFront (int id) |
Adds the Entry with the given id from the Group's associated Domain to the front of this Group's list. More... | |
void | addBack (int id) |
Adds the Entry with the given id from the Group's associated Domain to the back of this Group's list. More... | |
void | addFront (Group &g) |
Moves all Entry objects from Group g to the front of this Group's list. More... | |
void | addBack (Group &g) |
Moves all Entry objects from Group g to the back of this Group's list. More... | |
void | addAll () |
Adds all Entry objects from this Group's Domain to this Group's list (simultaneously removing them from the Groups with which they were previously a member). More... | |
Entry & | removeFront () |
Removes the Entry at the front of this Group's list and returns a reference to it. More... | |
Entry & | removeBack () |
Removes the Entry at the back of this Group's list and returns a reference to it. More... | |
Entry & | remove (int id) |
Removes from this Group's list the Entry with the given id and returns reference to it. More... | |
void | removeAll () |
Removes all Entry objects from this Group's list. More... | |
Iterator | front () |
Returns an Iterator pointing to the first Entry of this Group's list. More... | |
ConstIterator | front () const |
Returns a ConstIterator pointing to the first Entry of this Group's list. More... | |
Iterator | back () |
Returns an Iterator pointing to the last Entry of this Group's list. More... | |
ConstIterator | back () const |
Returns a ConstIterator pointing to the last Entry of this Group's list. More... | |
Iterator | beforeFront () |
Returns an Iterator pointing to the position before the first Entry in this Group's list. More... | |
ConstIterator | beforeFront () const |
Returns a ConstIterator pointing to the position before the first Entry in this Group's list. More... | |
Iterator | afterBack () |
Returns an Iterator pointing to the position after the last Entry in this Group's list. More... | |
ConstIterator | afterBack () const |
Returns a ConstIterator pointing to the position after the last Entry in this Group's list. More... | |
Iterator | find (int id) |
Returns an Iterator pointing to the Entry from this list with the given id , or pointing to the afterBack position if this Group does not contain the Entry with the given id . More... | |
ConstIterator | find (int id) const |
Returns an ConstIterator pointing to the Entry from this list with the given id , or pointing to the afterBack position if this Group does not contain the Entry with the given id . More... | |
Iterator | begin () |
Equivalent to front(). More... | |
ConstIterator | begin () const |
Equivalent to front() const. More... | |
Iterator | end () |
Equivalent to afterBack(). More... | |
ConstIterator | end () const |
Equivalent to afterBack() const. More... | |
Friends | |
class | Domain< M, V > |
Maintains a doubly linked list of Entry objects from a single associated Domain and may also be assigned a user-defined value of type V.
Read the package summary for introductory information about Group and its related classes.
An Entry may be added to a Group via add operations typical of linked lists, but each such add has the atypical side-affect of simultaneously removing the Entry from its previous Group membership (if any) all with constant computational complexity.
The following four terms are used consistently throughout to refer to key list posistions:
afterBack - One position after the last entry in the list.
There is no way to copy a Group without destroying the original, so the copy constructor and operator= are both declared private (and left unimplemented). You can, however, copy a group onto a different Domain using Group<M,V>::Group(Domain<M,V>& domain, const Group& group)
.
M | The Entry member type. |
V | The Group value type. |
|
inline |
|
inline |
|
inline |
|
inline |
Constructs a Group that is a copy of g
with the exception that its associated with Domain d
.
Domain d
must not be the same Domain as that associated with g
.
PartitionException | if g is associated with Domain d , orif an Entry of g has an ID not contained in d .These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_CONSTRUCTOR
|
|
inline |
Constructs a Group loaded with the IDs listed from first
to last
.
The iterators first and last should point to the beginning and end of a sequence of integers that are each IDs found in Domain d
.
PartitionException | if an id in the input sequence is not contained in d .Thsi validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inline |
Returns a reference to the user provided value associated with this Group.
|
inline |
Returns a const reference to the user provided value associated with this Group.
|
inline |
Sets v
as this Group's value.
|
inline |
Returns the number of Entry objects in this Group's list.
|
inline |
Returns true
if this Group contains the Entry with the given id
, and false otherwise.
Computational Complexity: Constant.
PartitionException | if this Group has no Domain association; or if id is not a member of the associated Domain.These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Returns a reference to the Entry at the front of the Group list while leaving the list unmodified.
PartitionException | if the Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Returns a const reference to the Entry at the front of the Group list while leaving the list unmodified.
PartitionException | if the Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Returns a reference to the Entry at the back of the Group list while leaving the list unmodified.
PartitionException | if the Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Returns a const reference to the Entry at the back of the Group list while leaving the list unmodified.
PartitionException | if the Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Adds the Entry with the given id
from the Group's associated Domain to the front of this Group's list.
If the Entry was previously a member of a Group, it is first removed from that Group.
Computational Complexity: Constant.
PartitionException | if this Group has no Domain association; or if id is not a member of the associated Domain.These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inline |
Adds the Entry with the given id
from the Group's associated Domain to the back of this Group's list.
If the Entry was previously a member of a Group, it is first removed from that Group.
Computational Complexity: Constant.
PartitionException | if this Group has no Domain association; or if id is not a member of the associated Domain.These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inline |
Moves all Entry objects from Group g
to the front of this Group's list.
Computational Complexity: Linear in the size of g
.
PartitionException | if Group g is not associated with the same Domain as this Group.This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inline |
Moves all Entry objects from Group g to the back of this Group's list.
Computational Complexity: Linear in the size of g
.
PartitionException | if Group g is not associated with the same Domain as this Group.This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inline |
Adds all Entry objects from this Group's Domain to this Group's list (simultaneously removing them from the Groups with which they were previously a member).
Entry objects are listed in ascending ID order.
Computational Complexity: Linear in the size of this Group's Domain.
PartitionException | if this Group has no Domain association This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ADD
|
|
inline |
Removes the Entry at the front of this Group's list and returns a reference to it.
Computational Complexity: Constant.
PartitionException | if this Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_REMOVE
|
|
inline |
Removes the Entry at the back of this Group's list and returns a reference to it.
Computational Complexity: Constant.
PartitionException | if this Group is empty. This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_REMOVE
|
|
inline |
Removes from this Group's list the Entry with the given id
and returns reference to it.
Computational Complexity: Constant.
PartitionException | if this Group has no Domain association; or if this Group does not contain the Entry with the given id .These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_REMOVE
|
|
inline |
|
inline |
|
inline |
Returns a ConstIterator pointing to the first Entry of this Group's list.
If this Group is empty, the returned ConstIterator will point to the afterBack list position.
|
inline |
|
inline |
Returns a ConstIterator pointing to the last Entry of this Group's list.
If this Group is empty, the returned ConstIterator will point to the beforeFront list position.
|
inline |
|
inline |
Returns a ConstIterator pointing to the position before the first Entry in this Group's list.
|
inline |
|
inline |
Returns a ConstIterator pointing to the position after the last Entry in this Group's list.
|
inline |
Returns an Iterator pointing to the Entry from this list with the given id
, or pointing to the afterBack position if this Group does not contain the Entry with the given id
.
PLEASE NOTE THE EXCEPTIONAL CONDITION BELOW.
PartitionException | if this Group has no Domain association; or if id is not a member of the associated Domain.These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Returns an ConstIterator pointing to the Entry from this list with the given id
, or pointing to the afterBack position if this Group does not contain the Entry with the given id
.
PLEASE NOTE THE EXCEPTIONAL CONDITION BELOW.
PartitionException | if this Group has no Domain association; or if id is not a member of the associated Domain.These validations are only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_GROUP_ACCESSOR
|
|
inline |
Equivalent to front().
|
inline |
Equivalent to front() const.
|
inline |
Equivalent to afterBack().
|
inline |
Equivalent to afterBack() const.