Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

Number Class Reference

The Number class handles numeric values, ranges of numeric values, and missing values. More...

#include <Number.h>

Inheritance diagram for Number:

Data List of all members.

Public Member Functions

 Number ()
 Default constructor:.
 Number (double value, bool isApproximate=false)
 Constructor for a scaler precise or approximate value:.
 Number (const char *value)
 Number (const std::string &value)
 Number (const Number *)
bool isMissing (void) const
void setMissing (void)
void set (const std::string &value)
void set (const char *value)
const std::string get (void) const
void set (double value)
bool isApproximate (void) const
Number operator+ (const Number &b) const
Numberoperator+= (const Number &b)
Numberoperator++ ()
Number operator++ (int)
Number operator- (const Number &b) const
Numberoperator-= (const Number &b)
Numberoperator-- ()
Number operator-- (int)
Number operator * (const Number &b) const
Numberoperator *= (const Number &b)
Number operator/ (const Number &b) const
Numberoperator/= (const Number &b)
Number getSin () const
Number getCos () const
Number getTan () const
Number getAsin () const
Number getAcos () const
Number getAtan () const
Number getSinh () const
Number getCosh () const
Number getTanh () const
Number getFloor () const
Number getCeiling () const
Number getRound () const
Number getExponent () const
Number getSquareRoot () const
Number getPower (const Number &b) const
Number getAbsoluteValue () const
Number getInverse () const
Number getLog10 () const
Number getLog () const
Number getLod () const
Number haldaneToTheta () const
Number thetaToHaldane () const
Number kosambiToTheta () const
Number thetaToKosambi () const
bool operator== (const Data &b) const
bool operator< (const Data &b) const
bool operator<= (const Number &b) const
bool operator>= (const Number &b) const
bool operator!= (const Number &b) const
bool operator> (const Number &b) const
const DATATYPE getDataType (void) const
virtual Numberclone () const

Static Public Member Functions

static void addNumberMissingValue (std::string value)
static bool isMissingValue (std::string value)
static void displayRangeMeans (bool)
static bool isA (const std::string &s)

Static Public Attributes

static const double PI = M_PI
 Value of PI.
static const double PI_OVER_TWO = M_PI_2
 Value of PI/2.
static const double THREE_PI_OVER_TWO = M_PI+M_PI_2
 Value of 3*PI/2:.
static const double TWO_PI = M_PI*2.0
 Value of 2*PI:.
static const double E = M_E
 Value of E.
static const double NEGATIVE_PI_OVER_TWO = -1*M_PI/2
 Value of -PI/2:.
static const double NEGATIVE_THREE_PI_OVER_TWO = -3*M_PI/2
 Value of -3PI/2:.
static const double SQRT_TWO = M_SQRT2
static const Number MISSING
static const double MINIMUM_DIFFERENCE = 3E-8

Private Member Functions

void _checkSwapLowAndHighValue (void)
double _min (double a, double b, double c, double d) const
double _max (double a, double b, double c, double d) const
double _sin (double v) const
double _haldane_cM_To_Theta (double) const
double _theta_To_Haldane_cM (double) const
double _kosambi_cM_To_Theta (double) const
double _theta_To_Kosambi_cM (double) const
double _lod (double) const
bool _differByLessThanMinimum (const Number &b) const
bool _intersectionIsNotNull (const Number &test) const

Private Attributes

bool _isMissing
double _value
double _highEndValue
bool _isApproximate
bool _isRange

Static Private Attributes

static std::set< std::string > _numberMissingValue
static bool _displayRangeMeans = false

Friends

class Date

Detailed Description

The Number class handles numeric values, ranges of numeric values, and missing values.

The Number class handles exact numeric values, approximate numeric values, and missing numeric values. Approximate numeric values can be of two types: numeric ranges and approximate unranged numeric values. Of these, numeric ranges are preferred because they provide inclusive lower and upper bounds on a measurement. (For example, it is more informative if we can say that a patient's fasting blood glucose level is "80-87" g/dl than if we merely say it is "approximately" "~85").

Note that the constructor handles non-ASCII digits seamlessly: See the DigitConverter class for details.

Unranged approximate values are indicated by a "~" prefix. Ranged values are indicated by a dash "-", "r", "R" or arrow separating the inclusive lower and upper bounds.

In addition to standard mathematical and trigonometric methods, some methods useful in linkage analysis, such as obtaining the LOD score from a p-value or converting haldane centiMorgans to a recombination fraction are also provided.


Constructor & Destructor Documentation

Number::Number  )  [inline]
 

Default constructor:.

Number::Number double  value,
bool  isApproximate = false
[inline]
 

Constructor for a scaler precise or approximate value:.

Number::Number const char *  value  )  [inline]
 

Number::Number const std::string &  value  )  [inline]
 

Number::Number const Number n  ) 
 

Number( const Number *n)

Copy construct a number from a const pointer to a number:


Member Function Documentation

void Number::_checkSwapLowAndHighValue void   )  [private]
 

_checkSwapLowAndHighValue(): Only call on ranges where there is a possibility of the low value > high value as the result of a mathematical operation:

bool Number::_differByLessThanMinimum const Number b  )  const [private]
 

double Number::_haldane_cM_To_Theta double   )  const [inline, private]
 

bool Number::_intersectionIsNotNull const Number test  )  const [private]
 

double Number::_kosambi_cM_To_Theta double   )  const [inline, private]
 

double Number::_lod double   )  const [inline, private]
 

double Number::_max double  a,
double  b,
double  c,
double  d
const [inline, private]
 

double Number::_min double  a,
double  b,
double  c,
double  d
const [inline, private]
 

double Number::_sin double  v  )  const [inline, private]
 

double Number::_theta_To_Haldane_cM double   )  const [inline, private]
 

double Number::_theta_To_Kosambi_cM double   )  const [inline, private]
 

static void Number::addNumberMissingValue std::string  value  )  [inline, static]
 

Number * Number::clone  )  const [virtual]
 

clone(): virtual copy constructor:

Implements Data.

void Number::displayRangeMeans bool   )  [static]
 

const std::string Number::get void   )  const [virtual]
 

get(): return a std::string

Implements Data.

Number Number::getAbsoluteValue  )  const
 

abs(): returns the absolute value of a Number

Number Number::getAcos  )  const
 

acos(): Arc cosine

Number Number::getAsin  )  const
 

asin(): Arc sine

Number Number::getAtan  )  const
 

atan(): Arc tangent

Number Number::getCeiling  )  const
 

getCeiling(): returns the ceiling of a Number

Number Number::getCos  )  const
 

getCos()

Number Number::getCosh  )  const
 

cosh(): Hyperbolic cosine

const DATATYPE Number::getDataType void   )  const [inline, virtual]
 

Implements Data.

Number Number::getExponent  )  const
 

getExponent():

Number Number::getFloor  )  const
 

getFloor(): returns the floor of a Number

Number Number::getInverse  )  const
 

inv(): returns the inverse of a Number

Number Number::getLod  )  const
 

Lod(): returns a p-value's equivalent LOD score.

Number Number::getLog  )  const
 

log(): natural logarithm (base e)

Number Number::getLog10  )  const
 

log10(): logarithm base 10

Number Number::getPower const Number e  )  const
 

getPower():

Number Number::getRound  )  const
 

getRound(): rounds a Number

Number Number::getSin  )  const
 

sin():

Number Number::getSinh  )  const
 

sinh(): Hyperbolic sine

Number Number::getSquareRoot  )  const
 

getSquareRoot():

Number Number::getTan  )  const
 

getTan():

Number Number::getTanh  )  const
 

tanh(): Hyperbolic tangent

Number Number::haldaneToTheta  )  const
 

haldaneToTheta():

Converts a Haldane genetic distance in centiMorgans to a recombination fraction.

bool Number::isA const std::string &  s  )  [static]
 

isA(): This is a static method: Determines whether an input string fits the pattern for a Number.

bool Number::isApproximate void   )  const [inline]
 

bool Number::isMissing void   )  const [inline, virtual]
 

Implements Data.

bool Number::isMissingValue std::string  value  )  [static]
 

isMissingValue() determines whether an input string is present in the missing value lookup table and should therefore be treated as a missing value.

Number Number::kosambiToTheta  )  const
 

kosambiToTheta(): converts Kosambi genetic distance in cM to recombination fraction.

Number Number::operator * const Number b  )  const
 

operator*():

Number & Number::operator *= const Number b  ) 
 

operator*=():

bool Number::operator!= const Number b  )  const
 

operator !=

Number Number::operator+ const Number b  )  const
 

operator+():

Number Number::operator++ int   ) 
 

Postfix ++

Number & Number::operator++  ) 
 

Prefix ++

Number & Number::operator+= const Number b  ) 
 

operator+=():

Number Number::operator- const Number b  )  const
 

operator-():

Number Number::operator-- int   ) 
 

Postfix --

Number & Number::operator--  ) 
 

Prefix --

Number & Number::operator-= const Number b  ) 
 

operator-=():

Number Number::operator/ const Number b  )  const
 

operator/():

Number & Number::operator/= const Number b  ) 
 

operator/=():

bool Number::operator< const Data b  )  const [virtual]
 

operator <

NOTA BENE: This is used for SORTING ONLY

Implements Data.

bool Number::operator<= const Number b  )  const
 

operator <=

bool Number::operator== const Data b  )  const [virtual]
 

operator ==

Implements Data.

bool Number::operator> const Number b  )  const
 

operator >

bool Number::operator>= const Number b  )  const
 

operator >=

void Number::set double  value  ) 
 

set() from double:

void Number::set const char *  value  )  [virtual]
 

set() from const char *:

This method accepts : (1) An ordinary number string (2) An approximate number string indicated by using "~" as a prefix. (3) A range string following the pattern shown below:

Pattern: " ~ [ + 123.456e+2 - + 123.589e+2 ]" " - E- r - E- "

Implements Data.

void Number::set const std::string &  value  )  [virtual]
 

set() from std::string:

Implements Data.

void Number::setMissing void   )  [virtual]
 

setMissing(): set a Number to missing.

Implements Data.

Number Number::thetaToHaldane  )  const
 

thetaToHaldane(): converts recombination fraction to Haldane distance in cM.

Number Number::thetaToKosambi  )  const
 

thetaToKosambi(): converts a recombination fraction to Kosambi genetic distance in cM.


Friends And Related Function Documentation

friend class Date [friend]
 


Member Data Documentation

bool Number::_displayRangeMeans = false [static, private]
 

double Number::_highEndValue [private]
 

bool Number::_isApproximate [private]
 

bool Number::_isMissing [private]
 

bool Number::_isRange [private]
 

std::set< std::string > Number::_numberMissingValue [static, private]
 

double Number::_value [private]
 

const double Number::E = M_E [static]
 

Value of E.

const double Number::MINIMUM_DIFFERENCE = 3E-8 [static]
 

const Number Number::MISSING [static]
 

const double Number::NEGATIVE_PI_OVER_TWO = -1*M_PI/2 [static]
 

Value of -PI/2:.

const double Number::NEGATIVE_THREE_PI_OVER_TWO = -3*M_PI/2 [static]
 

Value of -3PI/2:.

const double Number::PI = M_PI [static]
 

Value of PI.

const double Number::PI_OVER_TWO = M_PI_2 [static]
 

Value of PI/2.

const double Number::SQRT_TWO = M_SQRT2 [static]
 

const double Number::THREE_PI_OVER_TWO = M_PI+M_PI_2 [static]
 

Value of 3*PI/2:.

const double Number::TWO_PI = M_PI*2.0 [static]
 

Value of 2*PI:.


The documentation for this class was generated from the following files:
Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4