com.hyperion.essbase.calculator
Class Calculator

java.lang.Object
  |
  +--com.hyperion.essbase.calculator.Calculator
All Implemented Interfaces:
CalculatorConstants

public final class Calculator
extends java.lang.Object
implements CalculatorConstants

This class provides some methods to deal with MISSING values according to Essbase rules. See Essbase docs which define behaviour of missing values in Essbase. Contains:

See Also:
CalcBoolean

Fields inherited from interface com.hyperion.essbase.calculator.CalculatorConstants
MISSG, MISSING, MISSING_BYTE, MISSING_CHAR, MISSING_DOUBLE, MISSING_FLOAT, MISSING_INT, MISSING_LONG, MISSING_SHORT, SKIPBOTH, SKIPMISSG, SKIPNONE, SKIPZERO
 
Method Summary
static double add(double a, double b)
          MISSING-aware double addition.
static double divide(double a, double b)
          MISSING-aware double division.
static double exp(double a)
          MISSING-aware exponential function
static void fillWithMissing(double[] dd)
          Fills a given array with MISSING values
static boolean ge(double x, double y)
          MISSING-aware "greater than or equal to" operator.
 int getSkip(java.lang.String skip)
           
static boolean gt(double x, double y)
          MISSING-aware "greater than" operator.
static boolean isMissing(double d)
          Checks if a given double is MISSING.
static boolean le(double x, double y)
          MISSING-aware "less than or equal to" operator.
static double log(double a)
          MISSING-aware logarithm function
static boolean lt(double x, double y)
          MISSING-aware "less than" operator.
static double multiply(double a, double b)
          MISSING-aware double multiplication.
static double percent(double a, double b)
          MISSING-aware percent (%) operation.
static double pow(double a, double b)
          MISSING-aware power function
static void sort(double[] dd)
          Sorts array of doubles in place.
static void sort(double[] dd, int start, int end)
          Sorts part of an array of doubles in place.
static double sqrt(double a)
          MISSING-aware "square root of" function
static double square(double a)
          MISSING-aware "square of" function
static double subtract(double a, double b)
          MISSING-aware double subtraction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public static double add(double a,
                         double b)
MISSING-aware double addition.
Parameters:
a - operand
b - operand
Returns:
operation result

divide

public static double divide(double a,
                            double b)
MISSING-aware double division.
Parameters:
a - operand
b - operand
Returns:
operation result

exp

public static double exp(double a)
MISSING-aware exponential function
Parameters:
a - argument
Returns:
logarithm of the argument

fillWithMissing

public static void fillWithMissing(double[] dd)
Fills a given array with MISSING values
Parameters:
dd - double array

ge

public static boolean ge(double x,
                         double y)
MISSING-aware "greater than or equal to" operator.
Parameters:
a - operand
b - operand
Returns:
operation result

getSkip

public int getSkip(java.lang.String skip)

gt

public static boolean gt(double x,
                         double y)
MISSING-aware "greater than" operator.
Parameters:
a - operand
b - operand
Returns:
operation result

isMissing

public static boolean isMissing(double d)
Checks if a given double is MISSING.
Parameters:
d - double to check
Returns:
true if d has value #MISSING, false otherwise

le

public static boolean le(double x,
                         double y)
MISSING-aware "less than or equal to" operator.
Parameters:
a - operand
b - operand
Returns:
operation result

log

public static double log(double a)
MISSING-aware logarithm function
Parameters:
a - argument
Returns:
logarithm of the argument

lt

public static boolean lt(double x,
                         double y)
MISSING-aware "less than" operator.
Parameters:
a - operand
b - operand
Returns:
operation result

multiply

public static double multiply(double a,
                              double b)
MISSING-aware double multiplication.
Parameters:
a - operand
b - operand
Returns:
operation result

percent

public static double percent(double a,
                             double b)
MISSING-aware percent (%) operation.
Parameters:
a - operand
b - operand
Returns:
operation result

pow

public static double pow(double a,
                         double b)
MISSING-aware power function
Parameters:
a - base
b - exponent
Returns:
base to the power exponent

sort

public static void sort(double[] dd)
Sorts array of doubles in place. MISSING values will be placed before zeros, but after any negative values.
Parameters:
dd - double array

sort

public static void sort(double[] dd,
                        int start,
                        int end)
Sorts part of an array of doubles in place. MISSING values will be placed before zeros, but after any negative values.
Parameters:
dd - double array
start - index of the start
end - index of the end

sqrt

public static double sqrt(double a)
MISSING-aware "square root of" function
Parameters:
a - argument
Returns:
square root of the argument

square

public static double square(double a)
MISSING-aware "square of" function
Parameters:
a - argument
Returns:
square of the argument

subtract

public static double subtract(double a,
                              double b)
MISSING-aware double subtraction.
Parameters:
a - operand
b - operand
Returns:
operation result