#include <VectorEnumerator.h>
Inheritance diagram for VectorEnumerator:
Public Member Functions | |
VectorEnumerator () | |
Default constructor. | |
VectorEnumerator & | operator++ () |
Compute the next element. | |
vector< int > | operator * () |
Get the current element. | |
bool | end () |
Returns true if there are no more elements to enumerate. | |
ostream & | printSeq (ostream &os) const |
Protected Member Functions | |
virtual bool | seqOK () const =0 |
Check if the currently constructed sequence is legitimate. | |
virtual bool | seqLimit () const =0 |
Returns true if the length-limit on the sequence is passed. | |
virtual bool | seqComplete () const =0 |
Returns true if the current sequence is complete. | |
virtual int | start () const =0 |
Returns the initial value for the current element of the sequence (usually 0). | |
virtual int | next (int cur) const =0 |
Returns the next value for the current element of the sequence (usually cur+1). | |
virtual bool | finish (int cur) const =0 |
int | getLength () const |
Get the length of the current sequence. | |
const vector< int > & | getSeq () const |
Get the current sequence. | |
virtual void | stepTo () |
Function is invoked when the current value of the current element of the sequence is accepted and we go for the next element. | |
virtual void | stepBack (int cur) |
Function is invoked when we go backward from the current element to the previous element. | |
Private Attributes | |
int | curLength |
vector< int > | curVector |
VectorEnumerator provides the ground-level interface for vector-enumerators (for instance it can be used for enumeration of permutations, finite sequences over finite alphabet, etc.).
Definition at line 30 of file VectorEnumerator.h.
|
Default constructor.
Definition at line 42 of file VectorEnumerator.h. |
|
Returns true if there are no more elements to enumerate.
Definition at line 66 of file VectorEnumerator.h. References curLength, and seqComplete(). |
|
Implemented in PermutationEnumerator. |
|
Get the length of the current sequence.
Definition at line 110 of file VectorEnumerator.h. References curLength. Referenced by PermutationEnumerator::seqComplete(), PermutationEnumerator::seqLimit(), PermutationEnumerator::seqOK(), PermutationEnumerator::stepBack(), and PermutationEnumerator::stepTo(). |
|
Get the current sequence.
Definition at line 112 of file VectorEnumerator.h. References curVector. Referenced by PermutationEnumerator::getPermutation(), PermutationEnumerator::seqOK(), PermutationEnumerator::stepBack(), and PermutationEnumerator::stepTo(). |
|
Returns the next value for the current element of the sequence (usually cur+1).
Implemented in PermutationEnumerator. |
|
Get the current element.
|
|
Compute the next element.
|
|
|
|
Returns true if the current sequence is complete.
Implemented in PermutationEnumerator. Referenced by end(). |
|
Returns true if the length-limit on the sequence is passed.
Implemented in PermutationEnumerator. |
|
Check if the currently constructed sequence is legitimate.
Implemented in PermutationEnumerator. |
|
Returns the initial value for the current element of the sequence (usually 0).
Implemented in PermutationEnumerator. |
|
Function is invoked when we go backward from the current element to the previous element. The value of curElement is already decreased, so you are at the previous element Reimplemented in PermutationEnumerator. Definition at line 123 of file VectorEnumerator.h. |
|
Function is invoked when the current value of the current element of the sequence is accepted and we go for the next element. The value of curElement is already increased, so you are at the next element. Reimplemented in PermutationEnumerator. Definition at line 118 of file VectorEnumerator.h. |
|
Definition at line 133 of file VectorEnumerator.h. Referenced by end(), and getLength(). |
|
Definition at line 134 of file VectorEnumerator.h. Referenced by getSeq(). |