ratio Class Reference

Provides a ratio class. More...

List of all members.

Public Member Functions

 ratio (void)
 ratio (const ratio &r)
ratiooperator+= (const ratio &r)
ratiooperator+= (const double d)
ratiooperator/= (const ratio &r)
ratiooperator/= (double d)
ratiooperator= (const ratio &r)
bool operator== (const ratio &r) const
bool operator!= (const ratio &r) const
double make_double (void) const
double Top (void) const
double Bottom (void) const


Detailed Description

Provides a ratio class.

The ratio class allows numerators and denominators to be summed separately. Access to each is provided.

Definition at line 34 of file ratio.h.


Constructor & Destructor Documentation

ratio::ratio ( void   ) 

Default constructor.

Initializes private variables

Definition at line 42 of file ratio.cpp.

ratio::ratio ( const ratio r  ) 

Copy constructor.

Initializes private variables from existing ratio

Definition at line 50 of file ratio.cpp.


Member Function Documentation

ratio & ratio::operator+= ( const ratio r  ) 

Add ratio to current ratio.

Parameters:
r The ratio to add

Definition at line 59 of file ratio.cpp.

References bottom_, and top_.

ratio & ratio::operator+= ( const double  d  ) 

Add double to current ratio.

Adds the d to both numerator and denominator

Parameters:
d The double value to add

Definition at line 72 of file ratio.cpp.

ratio & ratio::operator/= ( const ratio r  ) 

Divide one ratio by another.

Numerator divided by numerator. Denominator divided by denominator.

Parameters:
r The ratio to be used in the "denominator" of the division

Definition at line 85 of file ratio.cpp.

References bottom_, and top_.

ratio & ratio::operator/= ( double  d  ) 

Divide a ratio by a double.

Numerator and denominator both divided by d.

Parameters:
d 

Definition at line 98 of file ratio.cpp.

ratio & ratio::operator= ( const ratio r  ) 

Assignment operator.

Parameters:
r The value being assigned

Definition at line 109 of file ratio.cpp.

References bottom_, and top_.

bool ratio::operator== ( const ratio r  )  const

Equality test.

Equal if and only if top_ and bottom_ of both ratios are equal.

Parameters:
r The value being compared

Definition at line 122 of file ratio.cpp.

References bottom_, and top_.

bool ratio::operator!= ( const ratio r  )  const

Inequality test.

Not equal if top_s or bottom_s are unequal

Parameters:
r The value being compared

Definition at line 133 of file ratio.cpp.

References bottom_, and top_.

double ratio::make_double ( void   )  const

Value of ratio

Definition at line 140 of file ratio.cpp.

References Util::long_max, and Util::long_min.

double ratio::Top ( void   )  const

Numerator of ratio

Definition at line 155 of file ratio.cpp.

Referenced by Statistic::Add().

double ratio::Bottom ( void   )  const

Denominator of ratio

Definition at line 162 of file ratio.cpp.

Referenced by Statistic::Add().


The documentation for this class was generated from the following files:
Generated on Tue Mar 27 16:03:51 2007 for mcmc by  doxygen 1.5.1