Grafalgo
Library of useful data structures and algorithms
|
This class implements a "staircase function". More...
#include <StairFunc.h>
Public Member Functions | |
StairFunc (int) | |
Constructor for StairFunc class. | |
~StairFunc () | |
Destructor for StairFunc class. | |
void | clear () |
Reinitialize data structure, creating single node trees. | |
void | resize (int) |
Resize a StairFunc object, discarding old value. | |
void | expand (int) |
Expand the space available for this ojbect. | |
void | copyFrom (const StairFunc &) |
Copy another object to this one. | |
int | value (int) |
int | findmin (int, int) |
void | change (int, int, int) |
string & | toString (string &) const |
Static Public Attributes | |
static const int | MAXY = Util::BIGINT32-1 |
Protected Member Functions | |
void | makeSpace (int) |
Allocate and initialize space for StairFunc. | |
void | freeSpace () |
Free dynamic storage used by StairFunc. | |
Protected Attributes | |
DkBstSet * | points |
List * | free |
This class implements a "staircase function".
It provides methods for efficiently finding the minimum function value within a specified range and modifying the function value in a range by some constant.
It is implemented using a dual key binary search tree, where the first key represents the x-coordinate of a "step" in the function and the y-coordinate represents the value from that point to the next point.
Definition at line 24 of file StairFunc.h.
grafalgo::StairFunc::StairFunc | ( | int | size | ) |
Constructor for StairFunc class.
size | defines the index range for the constructed object. |
Definition at line 16 of file StairFunc.cpp.
grafalgo::StairFunc::~StairFunc | ( | ) |
Destructor for StairFunc class.
Definition at line 21 of file StairFunc.cpp.
void grafalgo::StairFunc::clear | ( | ) | [virtual] |
Reinitialize data structure, creating single node trees.
The initial search tree is formed using a single node with both keys equal to zero.
Implements grafalgo::Adt.
Definition at line 46 of file StairFunc.cpp.
void grafalgo::StairFunc::copyFrom | ( | const StairFunc & | source | ) |
Copy another object to this one.
source | is object to be copied to this one |
Definition at line 76 of file StairFunc.cpp.
void grafalgo::StairFunc::expand | ( | int | size | ) | [virtual] |
Expand the space available for this ojbect.
Rebuilds old value in new space.
size | is the size of the expanded object. |
Implements grafalgo::Adt.
Definition at line 67 of file StairFunc.cpp.
void grafalgo::StairFunc::freeSpace | ( | ) | [protected] |
Free dynamic storage used by StairFunc.
Definition at line 40 of file StairFunc.cpp.
void grafalgo::StairFunc::makeSpace | ( | int | size | ) | [protected] |
Allocate and initialize space for StairFunc.
size | is number of index values to provide space for |
Definition at line 26 of file StairFunc.cpp.
void grafalgo::StairFunc::resize | ( | int | size | ) | [virtual] |
Resize a StairFunc object, discarding old value.
size | is the size of the resized object. |
Implements grafalgo::Adt.
Definition at line 55 of file StairFunc.cpp.