cpsquare.h

00001 //==========================================================================
00002 //  CPSQUARE.H - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Declaration of the following classes:
00008 //    cPSquare : calculates quantile values without storing the observations
00009 //
00010 //  Author: Babak Fakhamzadeh, TU Delft, Dec 1996
00011 //
00012 //==========================================================================
00013 
00014 /*--------------------------------------------------------------*
00015   Copyright (C) 1992-2008 Andras Varga
00016   Copyright (C) 2006-2008 OpenSim Ltd.
00017 
00018   This file is distributed WITHOUT ANY WARRANTY. See the file
00019   `license' for details on this and other legal matters.
00020 *--------------------------------------------------------------*/
00021 
00022 #ifndef __CPSQUARE_H
00023 #define __CPSQUARE_H
00024 
00025 #include "cdensityestbase.h"
00026 
00027 NAMESPACE_BEGIN
00028 
00029 
00036 class SIM_API cPSquare : public cDensityEstBase
00037 {
00038   protected:
00039     int numcells;      // number of observations
00040     long numobs;       // number of cells,
00041     int *n;            // array of positions
00042     double *q;         // array of heights
00043 
00044   protected:
00045     void copy(const cPSquare& other);
00046 
00047   protected:
00048     // abstract method in cDensityEstBase
00049     virtual void doMergeCellValues(const cDensityEstBase *other);
00050 
00051   public:
00054 
00058     cPSquare(const cPSquare& r);
00059 
00063     explicit cPSquare(const char *name=NULL, int cells=10);
00064 
00068     virtual ~cPSquare();
00069 
00073     cPSquare& operator=(const cPSquare& res);
00075 
00078 
00083     virtual cPSquare *dup() const  {return new cPSquare(*this);}
00084 
00089     virtual std::string detailedInfo() const;
00090 
00096     virtual void parsimPack(cCommBuffer *buffer);
00097 
00103     virtual void parsimUnpack(cCommBuffer *buffer);
00105 
00106   private:
00107     // internal: issues error message
00108     void giveError();
00109 
00110   protected:
00115     virtual void collectTransformed(double val);
00116 
00117   public:
00120 
00124     virtual void transform() {}
00125 
00130     virtual void setRange(double,double) {giveError();}
00131 
00136     virtual void setRangeAuto(int,double) {giveError();}
00137 
00142     virtual void setRangeAutoLower(double,int,double) {giveError();}
00143 
00148     virtual void setRangeAutoUpper(double,int,double) {giveError();}
00149 
00154     virtual void setNumFirstVals(int) {giveError();}
00155 
00159     virtual int getNumCells() const;
00160 
00166     virtual double getBasepoint(int k) const;
00167 
00171     virtual double getCellValue(int k) const;
00172 
00176     virtual double getCDF(double x) const;
00177 
00181     virtual double getPDF(double x) const;
00182 
00186     virtual double random() const;
00187 
00191     virtual void merge(const cStatistic *other);
00192 
00196     virtual void saveToFile(FILE *) const;
00197 
00201     virtual void loadFromFile(FILE *);
00203 };
00204 
00205 NAMESPACE_END
00206 
00207 
00208 #endif
00209 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3