The class describing a finite integer interval.
More...
#include <marmoteInterval.h>
|
| marmoteInterval (int min, int max) |
|
bool | isFinite () |
| Test if the set is finite. These sets always are. More...
|
|
bool | isZero (int *buffer) |
| Function that tests whether a state is the first state (state zero) or not. More...
|
|
void | firstState (int *buffer) |
| Initializes some state buffer with the first state of the set. More...
|
|
void | nextState (int *buffer) |
| Procedure to compute the state following a given state in the set order. The new state is computed in place: the original state is erased. By convention, the state following the last state is the first state. More...
|
|
void | decodeState (int index, int *buffer) |
| Procedure that converts an index into a state. The state is written in the buffer provided. The array must have been allocated before. More...
|
|
int | index (int *buffer) |
| Function that computes the number (index) of some state in the order of the set. The base class provides an implementation that uses solely firstState(), nextState(), and state comparison. For efficiency, it is advised to re-implement this method for derived classes. More...
|
|
void | printState (FILE *out, int *buffer) |
| Procedure to print a state, given by its full description, to some file descriptor. More...
|
|
void | enumerate () |
| Enumeration procedure. More...
|
|
The class describing a finite integer interval.
marmoteInterval::marmoteInterval |
( |
int |
min, |
|
|
int |
max |
|
) |
| |
Constructor for an interval. By convention, if max < min, then the interval is empty. Otherwise, both min and max are inside the interval.
- Author
- Alain Jean-Marie
- Parameters
-
min | the low end of the interval |
max | the high end of the interval |
void marmoteInterval::decodeState |
( |
int |
index, |
|
|
int * |
buffer |
|
) |
| |
|
virtual |
Procedure that converts an index into a state. The state is written in the buffer provided. The array must have been allocated before.
- Parameters
-
index | index of the state to be decoded |
buffer | state buffer containing the resulting state |
Reimplemented from marmoteSet.
void marmoteInterval::enumerate |
( |
| ) |
|
|
virtual |
Enumeration procedure.
Reimplemented from marmoteSet.
void marmoteInterval::firstState |
( |
int * |
buffer | ) |
|
|
virtual |
Initializes some state buffer with the first state of the set.
- Parameters
-
buffer | the buffer to be set. |
Reimplemented from marmoteSet.
int marmoteInterval::index |
( |
int * |
buffer | ) |
|
Function that computes the number (index) of some state in the order of the set. The base class provides an implementation that uses solely firstState(), nextState(), and state comparison. For efficiency, it is advised to re-implement this method for derived classes.
- Parameters
-
buffer | state buffer containing the state |
- Returns
- the index of the state
bool marmoteInterval::isFinite |
( |
| ) |
|
|
inlinevirtual |
Test if the set is finite. These sets always are.
- Returns
- true
Implements marmoteSet.
bool marmoteInterval::isZero |
( |
int * |
buffer | ) |
|
|
virtual |
Function that tests whether a state is the first state (state zero) or not.
- Parameters
-
buffer | the state to be tested |
- Returns
- true if the state is zero, false otherwise.
Reimplemented from marmoteSet.
void marmoteInterval::nextState |
( |
int * |
buffer | ) |
|
|
virtual |
Procedure to compute the state following a given state in the set order. The new state is computed in place: the original state is erased. By convention, the state following the last state is the first state.
- Parameters
-
buffer | the reference state |
Reimplemented from marmoteSet.
void marmoteInterval::printState |
( |
FILE * |
out, |
|
|
int * |
buffer |
|
) |
| |
|
virtual |
Procedure to print a state, given by its full description, to some file descriptor.
- Parameters
-
out | the file descriptor to be used |
buffer | the state to be printed |
Reimplemented from marmoteSet.
int marmoteInterval::_max |
|
protected |
the higher end of the interval
int marmoteInterval::_min |
|
protected |
the lower end of the interval
The documentation for this class was generated from the following files: