|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.accountingenhancements.formula.FormulaVariableMath
public class FormulaVariableMath
Constructor Summary | |
---|---|
FormulaVariableMath()
Creates a new instance of FormulaVariableMath |
Method Summary | |
---|---|
static boolean |
applyOperatorToCompareDates(java.util.Date left,
int operator,
java.util.Date right)
Compares two dates. Note: Ignores Time portion of date so new Date(1151064000000L) equals new Date(1151064006000L) |
static boolean |
applyOperatorToCompareStrings(java.lang.String left,
int operator,
java.lang.String right)
|
static boolean |
applyOperatorToTwoVariables(boolean left,
int operator,
boolean right)
|
static long |
applyOperatorToTwoVariables(java.util.Date left,
int operator,
java.util.Date right)
Find out the number of days between two dates. |
static java.util.Date |
applyOperatorToTwoVariables(java.util.Date left,
int operator,
long right)
|
static double |
applyOperatorToTwoVariables(double left,
int operator,
double right)
|
static FormulaVariable |
applyOperatorToTwoVariables(FormulaVariable leftVariable,
int operator,
FormulaVariable rightVariable,
FormulaVariableList variableList,
SupportParameters supportParameters,
FormulaFunctionList functionList,
int resolveEverythingAboveLevel)
Please The lowest precision determines the number of digits to the right of the decimal point. Ex: Assuming the precision of 10 is 2 (Not overriden by user so 2 digits long) .234 * 10 = 2.3 therefore scale=1 However, differing from real math, 12.345 * 10 = 123 (scale=0) instead of 120 (scale=-1) as regular math requires it because I am assuming user intent is that accuracy is always at least to the 1's place. On a related note if one variable is a TYPE_LONG or TYPE_BOOLEAN , that variable defaults to a precision of 17, so in this case the precision ends up being the same as the precision of the only double value. |
static FormulaVariable |
applyOperatorToTwoVariables(java.lang.Integer optionalLeftUnaryOperator,
FormulaVariable leftVariable,
int operator,
java.lang.Integer optionalRightUnaryOperator,
FormulaVariable rightVariable,
FormulaVariableList variableList,
SupportParameters supportParameters,
FormulaFunctionList functionList,
int resolveEverythingAboveLevel)
Please The lowest precision determines the number of digits to the right of the decimal point. Ex: Assuming the precision of 10 is 2 (Not overriden by user so 2 digits long) .234 * 10 = 2.3 therefore scale=1 However, differing from real math, 12.345 * 10 = 123 (scale=0) instead of 120 (scale=-1) as regular math requires it because I am assuming user intent is that accuracy is always at least to the 1's place. On a related note if one variable is a TYPE_LONG or TYPE_BOOLEAN , that variable defaults to a precision of 17, so in this case the precision ends up being the same as the precision of the only double value. This means (Assuming scale of 12.345 is 5) that 12.345 * 10 = 123.45 and scale=2. |
static long |
applyOperatorToTwoVariables(long left,
int operator,
long right)
|
static java.lang.String |
applyOperatorToTwoVariables(java.lang.String left,
int operator,
java.lang.String right)
|
static FormulaVariable |
solveUnaryOfVariable(int unaryOperator,
FormulaVariable variable,
FormulaVariableList variableList,
SupportParameters supportParameters,
FormulaFunctionList functionList,
int resolveEverythingAboveLevel)
Apply unary operations to variable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FormulaVariableMath()
Method Detail |
---|
public static FormulaVariable solveUnaryOfVariable(int unaryOperator, FormulaVariable variable, FormulaVariableList variableList, SupportParameters supportParameters, FormulaFunctionList functionList, int resolveEverythingAboveLevel) throws java.text.ParseException, java.lang.ArithmeticException, java.lang.ClassNotFoundException
unaryOperator
- FormulaVariable.TYPE_OPERATOR_UNARY_BIT_NOT or FormulaVariable.TYPE_OPERATOR_UNARY_NOTvariable
- the variable to which the unary operation is to be appliedvariableList
- a list of variables, used to resolve variable if variable is of TYPE_VARIABLE, TYPE_FUNCTION, or TYPE_FORMULAsupportParameters
- a list of function parameters, used to resolve variable if variable is of TYPE_FORMULA or TYPE_FUNCTIONfunctionList
- a list of functions, used to resolve variable if variable is of TYPE_FORMULA or TYPE_FUNCTIONresolveEverythingAboveLevel
- reflects level at which TYPE_VARIABLE, TYPE_FUNCTION, and TYPE_FORMULA variables need to be re-solved.
ParseException,
- ArithmeticException, ClassNotFoundException
java.text.ParseException
java.lang.ArithmeticException
java.lang.ClassNotFoundException
public static FormulaVariable applyOperatorToTwoVariables(FormulaVariable leftVariable, int operator, FormulaVariable rightVariable, FormulaVariableList variableList, SupportParameters supportParameters, FormulaFunctionList functionList, int resolveEverythingAboveLevel) throws java.text.ParseException, java.lang.ArithmeticException, java.lang.ClassNotFoundException
java.text.ParseException
java.lang.ArithmeticException
java.lang.ClassNotFoundException
public static FormulaVariable applyOperatorToTwoVariables(java.lang.Integer optionalLeftUnaryOperator, FormulaVariable leftVariable, int operator, java.lang.Integer optionalRightUnaryOperator, FormulaVariable rightVariable, FormulaVariableList variableList, SupportParameters supportParameters, FormulaFunctionList functionList, int resolveEverythingAboveLevel) throws java.text.ParseException, java.lang.ArithmeticException, java.lang.ClassNotFoundException
java.text.ParseException
java.lang.ArithmeticException
java.lang.ClassNotFoundException
public static boolean applyOperatorToTwoVariables(boolean left, int operator, boolean right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static long applyOperatorToTwoVariables(long left, int operator, long right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static long applyOperatorToTwoVariables(java.util.Date left, int operator, java.util.Date right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right values. Only allowed to TYPE_OPERATOR_MINUS two dates.right
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static java.util.Date applyOperatorToTwoVariables(java.util.Date left, int operator, long right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value in days
java.lang.ArithmeticException
- if operation is invalid for these values.public static double applyOperatorToTwoVariables(double left, int operator, double right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static boolean applyOperatorToCompareDates(java.util.Date left, int operator, java.util.Date right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static boolean applyOperatorToCompareStrings(java.lang.String left, int operator, java.lang.String right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right valuesright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.public static java.lang.String applyOperatorToTwoVariables(java.lang.String left, int operator, java.lang.String right) throws java.lang.ArithmeticException
left
- left valueoperator
- operation to be applied to left and right values. Only allowed to TYPE_OPERATOR_PLUS two stringsright
- right value
java.lang.ArithmeticException
- if operation is invalid for these values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |