Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

ParetoRandomVariable Class Reference

#include <ranvar.h>

Inheritance diagram for ParetoRandomVariable:

Inheritance graph
[legend]
Collaboration diagram for ParetoRandomVariable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual double value ()
 ParetoRandomVariable ()
 ParetoRandomVariable (double, double)
double * avgp ()
double * shapep ()
virtual double avg ()
double shape ()
void setavg (double d)
void setshape (double d)
int command (int argc, const char *const *argv)
int seed (char *)

Protected Attributes

RNGrng_

Private Attributes

double avg_
double shape_
double scale_

Constructor & Destructor Documentation

ParetoRandomVariable::ParetoRandomVariable  ) 
 

Definition at line 132 of file ranvar.cc.

References avg_, and shape_.

00133 {
00134         bind("avg_", &avg_);
00135         bind("shape_", &shape_);
00136 }

ParetoRandomVariable::ParetoRandomVariable double  ,
double 
 

Definition at line 138 of file ranvar.cc.

References avg_, and shape_.

00139 {
00140         avg_ = avg;
00141         shape_ = shape;
00142 }


Member Function Documentation

virtual double ParetoRandomVariable::avg  )  [inline, virtual]
 

Implements RandomVariable.

Definition at line 80 of file ranvar.h.

References avg_.

00080 { return avg_; };

double* ParetoRandomVariable::avgp  )  [inline]
 

Definition at line 78 of file ranvar.h.

References avg_.

00078 { return &avg_; };

int RandomVariable::command int  argc,
const char *const *  argv
[inherited]
 

Reimplemented in EmpiricalRandomVariable.

Definition at line 32 of file ranvar.cc.

References RandomVariable::rng_, and RandomVariable::value().

Referenced by EmpiricalRandomVariable::command().

00033 {
00034         Tcl& tcl = Tcl::instance();
00035 
00036         if (argc == 2) {
00037                 if (strcmp(argv[1], "value") == 0) {
00038                         tcl.resultf("%6e", value());
00039                         return(TCL_OK);
00040                 }
00041         }
00042         if (argc == 3) {
00043                 if (strcmp(argv[1], "use-rng") == 0) {
00044                         rng_ = (RNG*)TclObject::lookup(argv[2]);
00045                         if (rng_ == 0) {
00046                                 tcl.resultf("no such RNG %s", argv[2]);
00047                                 return(TCL_ERROR);
00048                         }
00049                         return(TCL_OK);
00050                 }
00051         }
00052         return(TclObject::command(argc, argv));
00053 }

Here is the call graph for this function:

int RandomVariable::seed char *   )  [inherited]
 

Definition at line 60 of file ranvar.cc.

References RandomVariable::rng_.

Referenced by EXPOO_Traffic::command().

00060                                 {
00061         
00062         Tcl& tcl = Tcl::instance();
00063 
00064                 rng_ = (RNG*)TclObject::lookup(x);
00065                 if (rng_ == 0) {
00066                         tcl.resultf("no such RNG %s", x);
00067                         return(TCL_ERROR);
00068                 }
00069                 return(TCL_OK);
00070  
00071 }

void ParetoRandomVariable::setavg double  d  )  [inline]
 

Definition at line 82 of file ranvar.h.

References avg_.

00082 { avg_ = d; };

void ParetoRandomVariable::setshape double  d  )  [inline]
 

Definition at line 83 of file ranvar.h.

References shape_.

00083 { shape_ = d; };

double ParetoRandomVariable::shape  )  [inline]
 

Definition at line 81 of file ranvar.h.

References shape_.

00081 { return shape_; };

double* ParetoRandomVariable::shapep  )  [inline]
 

Definition at line 79 of file ranvar.h.

References shape_.

00079 { return &shape_; };

double ParetoRandomVariable::value  )  [virtual]
 

Implements RandomVariable.

Definition at line 144 of file ranvar.cc.

References avg_, RNG::pareto(), RandomVariable::rng_, and shape_.

00145 {
00146         /* yuck, user wants to specify shape and avg, but the
00147          * computation here is simpler if we know the 'scale'
00148          * parameter.  right thing is to probably do away with
00149          * the use of 'bind' and provide an API such that we
00150          * can update the scale everytime the user updates shape
00151          * or avg.
00152          */
00153         return(rng_->pareto(avg_ * (shape_ -1)/shape_, shape_));
00154 }

Here is the call graph for this function:


Member Data Documentation

double ParetoRandomVariable::avg_ [private]
 

Definition at line 85 of file ranvar.h.

Referenced by avg(), avgp(), ParetoRandomVariable(), setavg(), and value().

RNG* RandomVariable::rng_ [protected, inherited]
 

Definition at line 41 of file ranvar.h.

Referenced by RandomVariable::command(), RandomVariable::RandomVariable(), RandomVariable::seed(), EmpiricalRandomVariable::value(), LogNormalRandomVariable::value(), NormalRandomVariable::value(), ParetoIIRandomVariable::value(), value(), ExponentialRandomVariable::value(), and UniformRandomVariable::value().

double ParetoRandomVariable::scale_ [private]
 

Definition at line 87 of file ranvar.h.

double ParetoRandomVariable::shape_ [private]
 

Definition at line 86 of file ranvar.h.

Referenced by ParetoRandomVariable(), setshape(), shape(), shapep(), and value().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:07:03 2004 for NS2.26SourcesOriginal by doxygen 1.3.3