#include <miscfunctions.h>
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. | |
Represents helper class with methods needed for conversion and mathematical calculations.
Definition at line 77 of file miscfunctions.h.
| static long double MiscFunctions::getDivisionFrom | ( | long double | numerator, | |
| long double | denominator | |||
| ) | [static] |
Calculates the division of two numbers.
Calculates the division of two numbers.
| [in] | numerator | The numerator. |
| [in] | denominator | The denominator. |
| InvalidCastException | If calculation fails. |
| 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.
| [in] | str | Pointer to a char object (string to be converted). |
| InvalidCastException | If conversion fails. |
| 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.
| [in] | base | The base. |
| [in] | exponent | The exponent. |
| InvalidCastException | If calculation fails. |
| 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.
| [in] | base | The base. |
| [in] | radix | The radix. |
| InvalidCastException | If calculation fails. |
| 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] |
Rounds a number to a specific number of decimal places.
Rounds a number to a specific number of decimal places.
| [in] | num | The number to be rounded. |
| [in] | places | The number of decimal places: |
| InvalidCastException | If calculation fails. |
| long | double The (rounded) result. |
Definition at line 268 of file miscfunctions.cpp.
Referenced by FunctRoundHalfToEvenExpression::calculateValue(), FunctRoundExpression::calculateValue(), AggregateFunctVarSampExpression::calculateValue(), AggregateFunctVarPopExpression::calculateValue(), AggregateFunctSumExpression::calculateValue(), AggregateFunctStdDevSampExpression::calculateValue(), AggregateFunctStdDevPopExpression::calculateValue(), AggregateFunctMinExpression::calculateValue(), AggregateFunctMedianExpression::calculateValue(), AggregateFunctMaxExpression::calculateValue(), AggregateFunctCountExpression::calculateValue(), and AggregateFunctAvgExpression::calculateValue().
| static const char * MiscFunctions::getStringFromNumerical | ( | long double | num | ) | [static] |
Converts a numeric value into a string.
Converts a numeric value into a string.
| [in] | num | Numeric value to be converted. |
| InvalidCastException | If conversion fails. |
| const | char* The converted string value. |
Definition at line 110 of file miscfunctions.cpp.
References REPLACE_DECIMAL_POINT_AFTER.
Referenced by FunctTruncateExpression::eval(), FunctRoundHalfToEvenExpression::eval(), FunctRoundExpression::eval(), FunctFloorExpression::eval(), FunctCoverExpression::eval(), FunctCeilingExpression::eval(), FunctAbsExpression::eval(), AggregateFunctVarSampExpression::eval(), AggregateFunctVarPopExpression::eval(), AggregateFunctSumExpression::eval(), AggregateFunctStdDevSampExpression::eval(), AggregateFunctStdDevPopExpression::eval(), AggregateFunctMinExpression::eval(), AggregateFunctMedianExpression::eval(), AggregateFunctMaxExpression::eval(), AggregateFunctCountExpression::eval(), and AggregateFunctAvgExpression::eval().
| 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.
| [in] | left | The subtrahend on the left hand side. |
| [in] | right | The subtrahend on the right hand side. |
| InvalidCastException | If calculation fails. |
| 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.
| [in] | left | The summand on the left hand side. |
| [in] | right | The summand on the right hand side. |
| InvalidCastException | If calculation fails. |
| 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.
| [in] | s | Pointer to a char object (string to be checked). |
| 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.
| [in] | s | Pointer to a char object (string to be trimmed). |
| const | char* The trimmed string. |
Definition at line 283 of file miscfunctions.cpp.
1.5.9