cLongHistogram Class Reference
[Statistical data collection]

#include <chist.h>

Inheritance diagram for cLongHistogram:

cEqdHistogramBase cHistogramBase cDensityEstBase cStdDev cStatistic cObject cPolymorphic List of all members.

Detailed Description

Equidistant histogram for integers.

cLongHistogram is derived from cEqdHistogramBase, which contains most of the functionality.

The histogram will be set up in the following way:

Examples:

This histogram will determine the range from the first few observations, then it will try to keep maintain 1 cell for each integer value in the range. If there would be more than 10,000 cells that way, it will make 2 or 3 or 4 etc. wide cells to reduce the number of cells below 10,000.

 cLongHistogram hist("hist");

The following histogram will maintain one cell for every integer 0,1,...500.

 cLongHistogram hist("hist");
 hist.setRange(0,500);

The next one will set up 100 cells, and the range will be auto-determined from the first few observations. If the range is <100 wide, every cell will be 1 wide; with the range width in 100..200, cells will be 2 wide, etc.

 cLongHistogram hist("hist");
 hist.setNumCells(100);

If you know that the numbers will be nonnegative, but you don't know their ranges, you can use the following (which will set up 20 cells, with the range 0..20, or 0..40, or 0..60 etc, depending on the range of the initial observations):

 cLongHistogram hist("hist");
 hist.setRangeAutoUpper(0);
 hist.setNumCells(20);


Public Member Functions

Constructors, destructor, assignment.
 cLongHistogram (const cLongHistogram &r)
 cLongHistogram (const char *name=NULL, int numcells=-1)
virtual ~cLongHistogram ()
cLongHistogramoperator= (const cLongHistogram &)
Redefined cObject member functions.
virtual cPolymorphicdup () const
Redefined member functions from cStatistic and its subclasses.
virtual void collect (double val)
virtual double random () const

Protected Member Functions

virtual void setupRange ()


Constructor & Destructor Documentation

cLongHistogram::cLongHistogram const cLongHistogram r  )  [inline]
 

Copy constructor.

cLongHistogram::cLongHistogram const char *  name = NULL,
int  numcells = -1
[explicit]
 

Constructor.

virtual cLongHistogram::~cLongHistogram  )  [virtual]
 

Destructor.


Member Function Documentation

virtual void cLongHistogram::collect double  val  )  [virtual]
 

Collects one value.

Internally, the double is converted to long using floor() before everything else.

Reimplemented from cDensityEstBase.

virtual cPolymorphic* cLongHistogram::dup  )  const [inline, virtual]
 

Creates and returns an exact copy of this object.

See cObject for more details.

Reimplemented from cStdDev.

cLongHistogram& cLongHistogram::operator= const cLongHistogram  )  [inline]
 

Assignment is not supported by this class: this method throws a cRuntimeError when called.

virtual double cLongHistogram::random  )  const [virtual]
 

Returns a random number based on the distribution collected.

If no values have been collected, it returns 0; when in initial collection phase, it returns one of the stored observations; after the histogram has been set up, a random integer is returned.

Reimplemented from cStdDev.

virtual void cLongHistogram::setupRange  )  [protected, virtual]
 

Called internally by transform(), this method should determine and set up the histogram range.

Reimplemented from cEqdHistogramBase.


The documentation for this class was generated from the following file:
Generated on Sat Oct 21 17:47:56 2006 for OMNeT++/OMNEST Simulation Library by  doxygen 1.4.6