com.jstatcom.parser
Class CalcFunctions
- java.lang.Object
-
- com.jstatcom.parser.CalcFunctions
-
public abstract class CalcFunctions extends java.lang.ObjectEnumeration of all functions that are used byCalcEngine. The defined functions objects overrideexecute(int argNum, Stack argStack)to provide the respective functionality. All functions get their arguments from a stack and put the results back on the stack after successful computation.
-
-
Field Summary
Fields Modifier and Type Field and Description static CalcFunctionsCOScos(a), computes cosinus function for all elements of an array.static CalcFunctionsFRACDIFFfracdiff(a, d), fractional differences of a.static CalcFunctionsLAGNlagn(a,b), lags the array by b elements and fills the resulting free slots withDouble.NaN.static CalcFunctionsLOGlog(a), computes natural logarithm for all elements of an array.static CalcFunctionsMAXmax(a,b), returns an array with the maximum elements ofaandbfor each row.static CalcFunctionsMEANCmeanc(a), computes the mean of all elements in an array.static CalcFunctionsMINmin(a,b), returns an array with the minimum elements ofaandbfor each row.static CalcFunctionsONESones(a), creates an array of ones with dimension(a x 1).static CalcFunctionsREVERSEreverse(a), reverses the order of an array, starting from observation T to 1.static CalcFunctionsRNDNrndn(a), creates an array ofarandom numbers between 0 and 1.static CalcFunctionsROWSrows(a), gets the rows of an array.static CalcFunctionsSINsin(a), computes sinus function for all elements of an array.static CalcFunctionsSQRTsqrt(a), computes square root for all elements of an array.static CalcFunctionsSTANDstand(a), creates a normalized version if the array by subtracting the mean and dividing by the standard deviation.static CalcFunctionsSTDCstdc(a), computes the standard deviation of all elements in an array.static CalcFunctionsSUMCsumc(a), computes the sum of all elements in an array.static CalcFunctionsTANtan(a), computes tangens function for all elements of an array.static CalcFunctionsTRENDtrend(a), creates an array of numbers incremented by 1 with dimension(a x 1), starting from 1.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description static voidcallFunctionForName(java.lang.String functionName, int argNum, java.util.Stack<double[]> argStack)Executes a function specified with a name.booleanequals(java.lang.Object o)Override prevention method to enforcea.equals(b)if and onlyif a==b.abstract voidexecute(int argNum, java.util.Stack<double[]> argStack)This defines the operation that is actually carried out by the function.static intgetLength(double[] aa, double[] bb)Computes the correct length when 2 array are combined.inthashCode()Override prevention method invokes super method.java.lang.StringtoString()Returns the name of the runtype, do not use for comparisons.
-
-
-
Field Detail
-
FRACDIFF
public static final CalcFunctions FRACDIFF
fracdiff(a, d), fractional differences of a.
-
SIN
public static final CalcFunctions SIN
sin(a), computes sinus function for all elements of an array.
-
COS
public static final CalcFunctions COS
cos(a), computes cosinus function for all elements of an array.
-
TAN
public static final CalcFunctions TAN
tan(a), computes tangens function for all elements of an array.
-
SQRT
public static final CalcFunctions SQRT
sqrt(a), computes square root for all elements of an array.
-
LOG
public static final CalcFunctions LOG
log(a), computes natural logarithm for all elements of an array. Fails, if the array contains values smaller or equal to zero.
-
LAGN
public static final CalcFunctions LAGN
lagn(a,b), lags the array by b elements and fills the resulting free slots withDouble.NaN. Lagging means, that every elementiis replaced by the element ini-b. The argumentbcan also be negative, which would result in a forward shift.
-
ROWS
public static final CalcFunctions ROWS
rows(a), gets the rows of an array.
-
ONES
public static final CalcFunctions ONES
ones(a), creates an array of ones with dimension(a x 1).
-
TREND
public static final CalcFunctions TREND
trend(a), creates an array of numbers incremented by 1 with dimension(a x 1), starting from 1.
-
RNDN
public static final CalcFunctions RNDN
rndn(a), creates an array ofarandom numbers between 0 and 1.
-
SUMC
public static final CalcFunctions SUMC
sumc(a), computes the sum of all elements in an array.
-
MEANC
public static final CalcFunctions MEANC
meanc(a), computes the mean of all elements in an array.
-
STDC
public static final CalcFunctions STDC
stdc(a), computes the standard deviation of all elements in an array.
-
STAND
public static final CalcFunctions STAND
stand(a), creates a normalized version if the array by subtracting the mean and dividing by the standard deviation.
-
REVERSE
public static final CalcFunctions REVERSE
reverse(a), reverses the order of an array, starting from observation T to 1.
-
MIN
public static final CalcFunctions MIN
min(a,b), returns an array with the minimum elements ofaandbfor each row.
-
MAX
public static final CalcFunctions MAX
max(a,b), returns an array with the maximum elements ofaandbfor each row.
-
-
Method Detail
-
callFunctionForName
public static void callFunctionForName(java.lang.String functionName, int argNum, java.util.Stack<double[]> argStack) throws java.lang.IllegalArgumentExceptionExecutes a function specified with a name.- Parameters:
functionName- a case insensitive String with the name of the function to callargNum- the number of arguments to the functionargStack- the current Stack to store the input as well as the result- Throws:
java.lang.IllegalArgumentException- in case the function does not exist or the arguments are wrong
-
equals
public final boolean equals(java.lang.Object o)
Override prevention method to enforcea.equals(b)if and onlyif a==b.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- object to compare with- Returns:
trueif equal,falseotherwise
-
execute
public abstract void execute(int argNum, java.util.Stack<double[]> argStack)This defines the operation that is actually carried out by the function. The method must be overridden if you define a new function. Input parameters as well as results are contained in the argStack.- Parameters:
argNum- the number of arguments to the functionargStack- the current Stack to store the input as well as the result
-
getLength
public static int getLength(double[] aa, double[] bb) throws java.lang.IllegalArgumentExceptionComputes the correct length when 2 array are combined.- Parameters:
aa- double arraybb- double array- Returns:
- the length for the result array
- Throws:
ParseException- if (aa.length != bb.length) && (aa.length != 1) && (bb.length != 1)java.lang.IllegalArgumentException
-
hashCode
public final int hashCode()
Override prevention method invokes super method.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hash code
-
toString
public final java.lang.String toString()
Returns the name of the runtype, do not use for comparisons.- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG