Grafalgo
Library of useful data structures and algorithms
grafalgo::StairFunc Class Reference

This class implements a "staircase function". More...

#include <StairFunc.h>

Inheritance diagram for grafalgo::StairFunc:
Collaboration diagram for grafalgo::StairFunc:

List of all members.

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

DkBstSetpoints
Listfree

Detailed Description

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.


Constructor & Destructor Documentation

grafalgo::StairFunc::StairFunc ( int  size)

Constructor for StairFunc class.

Parameters:
sizedefines the index range for the constructed object.

Definition at line 16 of file StairFunc.cpp.

Here is the call graph for this function:

grafalgo::StairFunc::~StairFunc ( )

Destructor for StairFunc class.

Definition at line 21 of file StairFunc.cpp.

Here is the call graph for this function:


Member Function Documentation

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.

Here is the call graph for this function:

Here is the caller graph for this function:

void grafalgo::StairFunc::copyFrom ( const StairFunc source)

Copy another object to this one.

Parameters:
sourceis object to be copied to this one

Definition at line 76 of file StairFunc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void grafalgo::StairFunc::expand ( int  size) [virtual]

Expand the space available for this ojbect.

Rebuilds old value in new space.

Parameters:
sizeis the size of the expanded object.

Implements grafalgo::Adt.

Definition at line 67 of file StairFunc.cpp.

Here is the call graph for this function:

void grafalgo::StairFunc::freeSpace ( ) [protected]

Free dynamic storage used by StairFunc.

Definition at line 40 of file StairFunc.cpp.

Here is the caller graph for this function:

void grafalgo::StairFunc::makeSpace ( int  size) [protected]

Allocate and initialize space for StairFunc.

Parameters:
sizeis number of index values to provide space for

Definition at line 26 of file StairFunc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void grafalgo::StairFunc::resize ( int  size) [virtual]

Resize a StairFunc object, discarding old value.

Parameters:
sizeis the size of the resized object.

Implements grafalgo::Adt.

Definition at line 55 of file StairFunc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends