MiscFunctions Class Reference

Represents helper class with methods needed for conversion and mathematical calculations. More...

#include <miscfunctions.h>

List of all members.

Static Public Member Functions

static long double getNumericFromString (const char *str)
 Converts a string into a numeric value.
static const char * getStringFromNumerical (long double num)
 Converts a numeric value into a string.
static long double getSummationFrom (long double left, long double right)
 Calculates the summation of two numeric values.
static long double getSubtractionFrom (long double left, long double right)
 Calculates the subtraction of two numeric values.
static long double getPowerFrom (long double base, long double exponent)
 Calculates the power of a number (base) to an exponent.
static long double getRadicalFrom (long double base, long double radix)
 Calculates the radical of a number (base) to an radix.
static long double getDivisionFrom (long double numerator, long double denominator)
 Calculates the division of two numbers.
static long double getRoundFrom (long double num, unsigned places=ROUND_TO_DECIMAL_PLACE)
 Rounds a number to a specific number of decimal places.
static bool needsTrim (const char *s)
 Returns if a string needs to be trimmed.
static const char * trim (const char *s)
 Returns a string without all spaces at the beginning and/or the end of it.


Detailed Description

Represents helper class with methods needed for conversion and mathematical calculations.

Represents helper class with methods needed for conversion and mathematical calculations.

Author:
Michael Schmidt

Gunnar Jehl

Version:
2.1
License:
Software License Agreement (BSD License)

Definition at line 77 of file miscfunctions.h.


Member Function Documentation

static long double MiscFunctions::getDivisionFrom ( long double  numerator,
long double  denominator 
) [static]

Calculates the division of two numbers.

Calculates the division of two numbers.

Parameters:
[in] numerator The numerator.
[in] denominator The denominator.
Exceptions:
InvalidCastException If calculation fails.
Return values:
long double The result of the division.

Definition at line 227 of file miscfunctions.cpp.

Referenced by AggregateFunctVarSampExpression::calculateValue(), AggregateFunctVarPopExpression::calculateValue(), AggregateFunctStdDevSampExpression::calculateValue(), and AggregateFunctStdDevPopExpression::calculateValue().

static long double MiscFunctions::getNumericFromString ( const char *  str  )  [static]

Converts a string into a numeric value.

Converts a string into a numeric value.

Parameters:
[in] str Pointer to a char object (string to be converted).
Exceptions:
InvalidCastException If conversion fails.
Return values:
long double The converted numeric value.

Definition at line 43 of file miscfunctions.cpp.

References REPLACE_DECIMAL_POINT_BEFORE.

Referenced by AggregateFunctVarSampExpression::calculateValue(), AggregateFunctVarPopExpression::calculateValue(), AggregateFunctStdDevSampExpression::calculateValue(), AggregateFunctStdDevPopExpression::calculateValue(), AggregateFunctMinExpression::calculateValue(), AggregateFunctMedianExpression::calculateValue(), and AggregateFunctMaxExpression::calculateValue().

static long double MiscFunctions::getPowerFrom ( long double  base,
long double  exponent 
) [static]

Calculates the power of a number (base) to an exponent.

Calculates the power of a number (base) to an exponent.

Parameters:
[in] base The base.
[in] exponent The exponent.
Exceptions:
InvalidCastException If calculation fails.
Return values:
long double The result.

Definition at line 173 of file miscfunctions.cpp.

Referenced by AggregateFunctVarSampExpression::calculateValue(), AggregateFunctVarPopExpression::calculateValue(), AggregateFunctStdDevSampExpression::calculateValue(), AggregateFunctStdDevPopExpression::calculateValue(), and getRadicalFrom().

static long double MiscFunctions::getRadicalFrom ( long double  base,
long double  radix 
) [static]

Calculates the radical of a number (base) to an radix.

Calculates the radical of a number (base) to an radix.

Parameters:
[in] base The base.
[in] radix The radix.
Exceptions:
InvalidCastException If calculation fails.
Return values:
long double The result.

Definition at line 211 of file miscfunctions.cpp.

References getPowerFrom().

Referenced by AggregateFunctStdDevSampExpression::calculateValue(), and AggregateFunctStdDevPopExpression::calculateValue().

static long double MiscFunctions::getRoundFrom ( long double  num,
unsigned  places = ROUND_TO_DECIMAL_PLACE 
) [static]

static const char * MiscFunctions::getStringFromNumerical ( long double  num  )  [static]

static long double MiscFunctions::getSubtractionFrom ( long double  left,
long double  right 
) [static]

Calculates the subtraction of two numeric values.

Calculates the subtraction of two numeric values.

Parameters:
[in] left The subtrahend on the left hand side.
[in] right The subtrahend on the right hand side.
Exceptions:
InvalidCastException If calculation fails.
Return values:
long double The result of the subtraction.

Definition at line 168 of file miscfunctions.cpp.

References getSummationFrom().

static long double MiscFunctions::getSummationFrom ( long double  left,
long double  right 
) [static]

Calculates the summation of two numeric values.

Calculates the summation of two numeric values.

Parameters:
[in] left The summand on the left hand side.
[in] right The summand on the right hand side.
Exceptions:
InvalidCastException If calculation fails.
Return values:
long double The result of the summation.

Definition at line 135 of file miscfunctions.cpp.

Referenced by AggregateFunctVarSampExpression::calculateValue(), AggregateFunctVarPopExpression::calculateValue(), AggregateFunctSumExpression::calculateValue(), AggregateFunctStdDevSampExpression::calculateValue(), AggregateFunctStdDevPopExpression::calculateValue(), AggregateFunctMedianExpression::calculateValue(), AggregateFunctAvgExpression::calculateValue(), and getSubtractionFrom().

static bool MiscFunctions::needsTrim ( const char *  s  )  [static]

Returns if a string needs to be trimmed.

Returns if a string needs to be trimmed, i.e. returns true if there is a space character at the first or last position in it.

Parameters:
[in] s Pointer to a char object (string to be checked).
Return values:
bool true if there is a space character at the first or last position in it, false otherwise.

Definition at line 277 of file miscfunctions.cpp.

static const char * MiscFunctions::trim ( const char *  s  )  [static]

Returns a string without all spaces at the beginning and/or the end of it.

Returns a string without all spaces at the beginning and/or the end of it.

Parameters:
[in] s Pointer to a char object (string to be trimmed).
Return values:
const char* The trimmed string.

Definition at line 283 of file miscfunctions.cpp.


Generated on Sun May 24 20:20:25 2009 for G(arbage) C(ollected) X(Query) Engine by  doxygen 1.5.9