#include <PermutationEnumerator.h>
Public Member Functions | |
PermutationEnumerator (int L) | |
Constructor. | |
PermutationEnumerator | operator= (const PermutationEnumerator &) |
No assignment operator. | |
PermutationEnumerator (const PermutationEnumerator &) | |
No copy constructor. | |
Permutation | getPermutation () const |
virtual bool | seqOK () const |
Check if the currently constructed sequence is legitimate. | |
virtual bool | seqLimit () const |
Returns true if the length-limit on the sequence is passed. | |
virtual bool | seqComplete () const |
Returns true if the current sequence is complete. | |
virtual int | start () const |
Returns the initial value for the current element of the sequence (usually 0). | |
virtual int | next (int cur) const |
Returns the next value for the current element of the sequence (usually cur+1). | |
virtual bool | finish (int cur) const |
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 | theLength |
The length of a permutation. | |
vector< bool > | theUsedElements |
Array of flags - elements used in already constructed part of a permutation. |
Definition at line 14 of file PermutationEnumerator.h.
PermutationEnumerator::PermutationEnumerator | ( | int | L | ) | [inline] |
Constructor.
Definition at line 26 of file PermutationEnumerator.h.
PermutationEnumerator::PermutationEnumerator | ( | const PermutationEnumerator & | ) |
No copy constructor.
virtual bool PermutationEnumerator::finish | ( | int | cur | ) | const [inline, virtual] |
Implements VectorEnumerator.
Definition at line 64 of file PermutationEnumerator.h.
References theLength.
Permutation PermutationEnumerator::getPermutation | ( | ) | const [inline] |
Definition at line 44 of file PermutationEnumerator.h.
References VectorEnumerator::getSeq(), and theLength.
virtual int PermutationEnumerator::next | ( | int | cur | ) | const [inline, virtual] |
Returns the next value for the current element of the sequence (usually cur+1).
Implements VectorEnumerator.
Definition at line 61 of file PermutationEnumerator.h.
PermutationEnumerator PermutationEnumerator::operator= | ( | const PermutationEnumerator & | ) |
No assignment operator.
virtual bool PermutationEnumerator::seqComplete | ( | ) | const [inline, virtual] |
Returns true if the current sequence is complete.
Implements VectorEnumerator.
Definition at line 54 of file PermutationEnumerator.h.
References VectorEnumerator::getLength(), and theLength.
virtual bool PermutationEnumerator::seqLimit | ( | ) | const [inline, virtual] |
Returns true if the length-limit on the sequence is passed.
Implements VectorEnumerator.
Definition at line 51 of file PermutationEnumerator.h.
References VectorEnumerator::getLength(), and theLength.
virtual bool PermutationEnumerator::seqOK | ( | ) | const [inline, virtual] |
Check if the currently constructed sequence is legitimate.
Implements VectorEnumerator.
Definition at line 46 of file PermutationEnumerator.h.
References VectorEnumerator::getLength(), VectorEnumerator::getSeq(), theLength, and theUsedElements.
virtual int PermutationEnumerator::start | ( | ) | const [inline, virtual] |
Returns the initial value for the current element of the sequence (usually 0).
Implements VectorEnumerator.
Definition at line 58 of file PermutationEnumerator.h.
virtual void PermutationEnumerator::stepBack | ( | int | cur | ) | [inline, virtual] |
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 from VectorEnumerator.
Definition at line 72 of file PermutationEnumerator.h.
References VectorEnumerator::getLength(), VectorEnumerator::getSeq(), and theUsedElements.
virtual void PermutationEnumerator::stepTo | ( | ) | [inline, virtual] |
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 from VectorEnumerator.
Definition at line 68 of file PermutationEnumerator.h.
References VectorEnumerator::getLength(), VectorEnumerator::getSeq(), and theUsedElements.
int PermutationEnumerator::theLength [private] |
The length of a permutation.
Definition at line 87 of file PermutationEnumerator.h.
Referenced by finish(), getPermutation(), seqComplete(), seqLimit(), and seqOK().
vector< bool > PermutationEnumerator::theUsedElements [private] |
Array of flags - elements used in already constructed part of a permutation.
Definition at line 90 of file PermutationEnumerator.h.
Referenced by seqOK(), stepBack(), and stepTo().