Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
Public Member Functions | Protected Attributes | List of all members
marmoteInterval Class Reference

The class describing a finite integer interval. More...

#include <marmoteInterval.h>

Inheritance diagram for marmoteInterval:
marmoteSet

Public Member Functions

 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...
 

Protected Attributes

int _min
 
int _max
 

Detailed Description

The class describing a finite integer interval.

Constructor & Destructor Documentation

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
minthe low end of the interval
maxthe high end of the interval

Member Function Documentation

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
indexindex of the state to be decoded
bufferstate 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
bufferthe 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
bufferstate 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
bufferthe 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
bufferthe 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
outthe file descriptor to be used
bufferthe state to be printed

Reimplemented from marmoteSet.

Member Data Documentation

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: