Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

Statistics.hh

Go to the documentation of this file.
00001 // Statistics.hh
00002 
00003 // Created by John Zweck, Feb 7th, 2003.
00004 // Adapted from the StatisticsOfArray class in OCS
00005 
00006 /*
00007 
00008  Every class must have a class definition which has the declarations
00009  of all the functions and methods that make up the class. 
00010 
00011  The definition of MyClass is given in the header (or include) file, 
00012  MyClass.hh.
00013 
00014  Methods and data can be declared to be either public or private.
00015 
00016  Any method in the class has access to any of the private or public data
00017   members of the class. 
00018 
00019  An applications program has access to the public methods and data 
00020   of an instance of the class.
00021 
00022  Generally speaking the definition of the methods in the class goes in
00023  the class source file, MyClass.cc.
00024 
00025  However, if a method is very short it is sometimes defined within the class
00026  definition.
00027 
00028  The idea behind putting the definition of a class in the header file
00029  and the definitions of the methods in the class in the source file
00030  is that if the code is well documented, an applications programmer
00031  should only need to know the contents of the header file and not
00032  have to worry about the way the methods in the class are implemented
00033  in the source code file.
00034 
00035  Class definitions generally have the syntax
00036 
00037  class MyClass
00038   {
00039     public:
00040 
00041      // Declaration of the constructors and destructors
00042 
00043      MyClass(....);
00044      ~MyClass();
00045 
00046      // Declaration of public methods 
00047 
00048      int MyPublicMethod(.......);
00049 
00050      // Declaration of public data (if any) 
00051    
00052      double MyPublicData;
00053 
00054     private:
00055 
00056      // Declaration of private methods (if any) 
00057 
00058      int MyPrivateMethod(.......);
00059 
00060      // Declaration of private data goes here
00061 
00062     double MyPrivateData;
00063 
00064   }; // Note the final ; !!!!
00065 
00066 */
00067 
00068 
00069 #ifndef _STATISTICS_HH
00070 #define _STATISTICS_HH
00071 
00083 
00084 
00085 class Statistics
00086 {
00087 
00088   // ### Public Methods ###
00089 
00090  public:
00091 
00093 
00094 
00140   Statistics(int arrayLengthIn,  double *arrayIn);
00141 
00142 
00144 
00163   ~Statistics();
00164 
00166 
00167   double GetMinimum() {return minimum;}; // Both declaration and definition!! 
00168 
00169   double GetMaximum() {return maximum;};
00170   double GetMean() {return mean;};
00171   double GetStdDev() {return standardDeviation;};
00172   double GetVariance() {return variance;};
00173   double GetMedian() {return median;};
00174 
00175  // ### Private Methods ###
00176 
00177 private:
00178 
00180 
00181   void ComputeMinimum(void);
00182   void ComputeMaximum(void);
00183   void ComputeMean(void);
00184   void ComputeMeanOfSquares(void);
00185   void ComputeVariance(void);
00186   void ComputeMedian(void);
00187  
00189 
00190   void SelectionSort(void);
00191 
00193 
00194   int MaximumIndex(int SubLength);
00195 
00196   // ### Private Data ###
00197 
00198  private:
00199 
00201 
00202   int arrayLength;
00203 
00206 
00207   double * array;
00208 
00210 
00211   double * sortedArray;
00212 
00214 
00215   double minimum;
00216   double maximum;
00217   double mean,meanOfSquares,standardDeviation,variance;
00218   double median;
00219 
00220 
00221 }; // ## end of definition of class  Statistics
00222 
00223 
00224 #endif /* _STATISTICS_HH */
00225 
00226 

Generated at Fri Feb 21 10:29:46 2003 for hello by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000