com.accountingenhancements.formula
Class FormulaVariable

java.lang.Object
  extended by com.accountingenhancements.formula.FormulaVariable
All Implemented Interfaces:
java.lang.Cloneable

public class FormulaVariable
extends java.lang.Object
implements java.lang.Cloneable

FormulaVariable is used to store variables and mathematical operators. An instance can only be one or the other.
It is used be FormulaVariableList and FormulaVariableStack.
A formula variable that may, or may not, be set.
The variable is stored as a String. and supports return types of String, Long, Double, and Boolean.
If the variable type is boolean and it is being set as a long or boolean type, then 0(+/-.49) = false, non-zero = true.
If the variable type is long then a double is truncated.
If the variable type is Formula then the string should be processed with Formula.solve() to retrieve result which may be String, Long, Double, or Boolean.


Field Summary
protected  FormulaFunction formulaFunction
          If this is TYPE_FUNCTION then this is the function that was created when first solving this variable.
protected  int highestLevel
          If this is TYPE_FORMULA, TYPE_FUNCTION, or TYPE_VARIABLE then this reflects the highest level of variable used in solving for resolvedVariable
static boolean[] IS_COMPARATOR_OPERATOR
          boolean array used to determine whether a TYPE is a comparator operator (!=, >, >=, =, <=, <).
static boolean[] IS_UNARY_OPERATOR
          boolean array used to determine whether a TYPE is a unary operator.
protected  int level
           
static java.lang.String OPERATOR_STRING
           
protected  int precision
           
protected  FormulaVariable resolvedVariable
          If this is TYPE_VARIABLE then this is the value of the resultant value.
protected  int scale
           
protected  FormulaVariableStack stack
          If this is TYPE_FORMULA then this is the stack of the formula as processed by FormulaVariableSack
protected  boolean stripSurroundingQuotesFromStrings
           
protected  boolean treatUnquotedTextAsFormulas
           
static int TYPE_BOOLEAN
          Value is of type Boolean
static int TYPE_DATE
          Value is of type Date
static int TYPE_DOUBLE
          Value is of type Double
static int TYPE_FORMULA
          Value is of type Formula where formula should be run through Formula.solve()
static int TYPE_FUNCTION
          Value is of type Function where this should be solved through the function processing methods
static int TYPE_LONG
          Value is of type Long
static int TYPE_NOTHING
          Undefined variable.
static int TYPE_OPERATOR_AND
          Test previous object for non-zero versus zero.
static int TYPE_OPERATOR_BIT_AND
          Apply a bitwise And of previous object against the next object
static int TYPE_OPERATOR_BIT_OR
          Apply a bitwise Or of previous object against the next object
static int TYPE_OPERATOR_BIT_XOR
          Apply a bitwise Xor of previous object against the next object
static int TYPE_OPERATOR_DIVIDE
          Divide previous object by next object
static int TYPE_OPERATOR_EQUALS
          Compare previous object to next object for identical values, return 1 if true, 0 if false
static int TYPE_OPERATOR_GREATER_THAN
          Compare previous object to next object for whether previous object is greater than next object, return 1 if true, 0 if false
static int TYPE_OPERATOR_GREATER_THAN_OR_EQUAL
          Compare previous object to next object for whether previous object is greater than or equal to next object, return 1 if true, 0 if false
static int TYPE_OPERATOR_LESS_THAN
          Compare previous object to next object for whether previous object is less than next object, return 1 if true, 0 if false
static int TYPE_OPERATOR_LESS_THAN_OR_EQUAL
          Compare previous object to next object for whether previous object is less than or equal to next object, return 1 if true, 0 if false
static int TYPE_OPERATOR_MINUS
          subtract next object from previous object.
static int TYPE_OPERATOR_MODULUS
          Return Remainder of division of previous object by next object.
static int TYPE_OPERATOR_MULTIPLY
          Multiply next object by previous object
static int TYPE_OPERATOR_NOT_EQUAL
          Compare previous object to next object for non-identical values, return 1 if true, 0 if false
static int TYPE_OPERATOR_OR
          Test previous object for non-zero versus zero.
static int TYPE_OPERATOR_PLUS
          Add next object to previous object.
static int TYPE_OPERATOR_UNARY_BIT_NOT
          Unary Bitwise Not (~) to be applied to next object.
static int TYPE_OPERATOR_UNARY_NOT
          Unary Not (!) logical Not to be applied to next object (0=1, non-zero=0)
static int TYPE_STRING
          Value is of type String
static java.lang.String[] TYPE_TO_STRING_ARRAY
          Return the String form of TYPE_, Ex: TYPE_TO_STRING_ARRAY[TYPE_STRING]==String, TO_STRING_ARRAY[TYPE_OPERATOR_PLUS]=="+", etc...
static int TYPE_VARIABLE
          Value is of type Variable where this variable references another variable and should be resolved through a FormulaVariableList
protected  java.lang.String variableName
           
protected  int variableType
           
protected  java.lang.String variableValue
           
 
Constructor Summary
protected FormulaVariable()
          Blank FormulaVariable.
  FormulaVariable(int variableType)
          Creates a new instance of FormulaVariable
  FormulaVariable(int variableType, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(int variableType, int level, boolean stripSurroundingQuotesFromStrings)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variable)
          This constructor pulls the variable name from the first part of the String and the value from the last part.
  FormulaVariable(java.lang.String variableName, java.math.BigDecimal variableValue, int level)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, java.math.BigDecimal variableValue, int scale, int level)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, java.math.BigDecimal variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, boolean variableValue, int level)
          Creates a new instance of FormulaVariable.
  FormulaVariable(java.lang.String variableName, boolean variableValue, int scale, int level)
          Creates a new instance of FormulaVariable.
  FormulaVariable(java.lang.String variableName, boolean variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, java.util.Date variableValue, int level)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, java.util.Date variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, double variableValue, int level)
          Creates a new instance of FormulaVariable.
  FormulaVariable(java.lang.String variableName, double variableValue, int scale, int level)
          Creates a new instance of FormulaVariable.
  FormulaVariable(java.lang.String variableName, double variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variable, int level)
          This constructor pulls the variable name from the first part of the String and the value from the last part.
  FormulaVariable(java.lang.String variableName, int variableType, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, int variableType, int level, boolean stripSurroundingQuotesFromStrings)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, long variableValue, int level)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, long variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
  FormulaVariable(java.lang.String variableName, java.lang.String variableValue, int level)
          Creates a new instance of FormulaVariable.
  FormulaVariable(java.lang.String variableName, java.lang.String variableValue, int level, boolean treatUnquotedTextAsFormulas)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, java.lang.String variableValue, int scaleIfDouble, int level, boolean treatUnquotedTextAsFormulas)
          Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value.
  FormulaVariable(java.lang.String variableName, java.lang.String variableValue, int variableType, int scaleIfDouble, int level)
          Creates a new instance of FormulaVariable
 
Method Summary
protected  boolean booleanValue(java.lang.String value)
           
 FormulaVariable clone()
           
static int detectVariableType(java.lang.String variableValue, boolean treatUnquotedTextAsFormulas)
           
static int findOperatorPrecedence(java.lang.String operator)
          Find the operator precedence of an operator that is handed to this method.
static int findScaleOfDouble(java.lang.String variableValue)
          If variableValue is known to contain an integer or double then what is the scale (integer would be scale=0).
 java.math.BigDecimal getBigDecimal()
           
 java.math.BigDecimal getBigDecimalScaled()
           
 boolean getBoolean()
           
 java.util.Date getDate()
           
 java.lang.Double getDouble()
           
 int getHighestLevel()
           
 int getLevel()
           
 java.lang.Long getLong()
           
 int getOperator()
           
 int getPrecision()
           
 int getScale()
           
 java.lang.String getString()
           
 boolean getStripSurroundingQuotesFromStrings()
           
 java.lang.Object getValue()
           
 java.lang.String getVariableName()
           
 int getVariableType()
           
 boolean isComparatorOperator()
           
 boolean isNonUnaryOperator()
           
 boolean isNull()
           
 boolean isOperator()
           
 boolean isUnaryOperator()
           
protected static java.lang.String padString(java.lang.String orgString, int size, char padChar, boolean padOnLeft)
          Pad a string with repeating characters such that the final string is size long.
Examples:
padString("12",5,'0',true).equals("00012")==true
padString("Hi",4,' ',false).equals("Hi ")==true
 void purgeResultsGreaterThanSpecifiedLevel(int specifiedLevel)
          If the result of a calculation used a value above the specified level, then purge the answer.
 void setHighestLevel(int highestLevel)
           
 void setPrecision(int precision)
           
 void setScale(int scale)
           
 void setStripSurroundingQuotesFromStrings(boolean state)
           
 void setValue(java.math.BigDecimal value)
           
 void setValue(java.math.BigDecimal value, int scale)
          This method updates the scale value then executes setValue(BigDecimal value)
 void setValue(boolean value)
           
 void setValue(java.util.Date value)
           
 void setValue(double value)
           
 void setValue(double value, int scale)
          This method updates the scale value then executes setValue(double value)
 void setValue(long value)
           
 void setValue(java.lang.String value)
           
 FormulaVariable solve(FormulaVariableList variableList, int iteration, SupportParameters supportParameters, FormulaFunctionList functionList, int resolveEverythingAboveLevel)
          IF this variable is of TYPE_FORMULA, TYPE_FUNCTION, or TYPE_VARIABLE then this method solves for the value.
static boolean testIsComparatorOperator(int operator)
           
static boolean testIsOperator(char operator)
          Test whether a character is part of an operator.
static boolean testIsOperator(int operator)
          Test whether a specified TYPE is an operator.
static boolean testIsOperator(java.lang.String operator)
          Test whether a string segment is an operator.
static boolean testIsUnaryOperator(int operator)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

variableName

protected java.lang.String variableName

variableValue

protected java.lang.String variableValue

variableType

protected int variableType

level

protected int level

scale

protected int scale

precision

protected int precision

treatUnquotedTextAsFormulas

protected boolean treatUnquotedTextAsFormulas

stripSurroundingQuotesFromStrings

protected boolean stripSurroundingQuotesFromStrings

stack

protected FormulaVariableStack stack
If this is TYPE_FORMULA then this is the stack of the formula as processed by FormulaVariableSack


resolvedVariable

protected FormulaVariable resolvedVariable
If this is TYPE_VARIABLE then this is the value of the resultant value.


highestLevel

protected int highestLevel
If this is TYPE_FORMULA, TYPE_FUNCTION, or TYPE_VARIABLE then this reflects the highest level of variable used in solving for resolvedVariable


formulaFunction

protected FormulaFunction formulaFunction
If this is TYPE_FUNCTION then this is the function that was created when first solving this variable. It has it's own stack that can be checked for whether the function needs to be re-solved.


TYPE_NOTHING

public static final int TYPE_NOTHING
Undefined variable. Not yet a value or an operator.

See Also:
Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
Value is of type String

See Also:
Constant Field Values

TYPE_LONG

public static final int TYPE_LONG
Value is of type Long

See Also:
Constant Field Values

TYPE_DOUBLE

public static final int TYPE_DOUBLE
Value is of type Double

See Also:
Constant Field Values

TYPE_BOOLEAN

public static final int TYPE_BOOLEAN
Value is of type Boolean

See Also:
Constant Field Values

TYPE_FORMULA

public static final int TYPE_FORMULA
Value is of type Formula where formula should be run through Formula.solve()

See Also:
Constant Field Values

TYPE_VARIABLE

public static final int TYPE_VARIABLE
Value is of type Variable where this variable references another variable and should be resolved through a FormulaVariableList

See Also:
Constant Field Values

TYPE_DATE

public static final int TYPE_DATE
Value is of type Date

See Also:
Constant Field Values

TYPE_FUNCTION

public static final int TYPE_FUNCTION
Value is of type Function where this should be solved through the function processing methods

See Also:
Constant Field Values

TYPE_OPERATOR_UNARY_BIT_NOT

public static final int TYPE_OPERATOR_UNARY_BIT_NOT
Unary Bitwise Not (~) to be applied to next object. Bit patterns are reversed

See Also:
Constant Field Values

TYPE_OPERATOR_UNARY_NOT

public static final int TYPE_OPERATOR_UNARY_NOT
Unary Not (!) logical Not to be applied to next object (0=1, non-zero=0)

See Also:
Constant Field Values

TYPE_OPERATOR_EQUALS

public static final int TYPE_OPERATOR_EQUALS
Compare previous object to next object for identical values, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_NOT_EQUAL

public static final int TYPE_OPERATOR_NOT_EQUAL
Compare previous object to next object for non-identical values, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_LESS_THAN_OR_EQUAL

public static final int TYPE_OPERATOR_LESS_THAN_OR_EQUAL
Compare previous object to next object for whether previous object is less than or equal to next object, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_LESS_THAN

public static final int TYPE_OPERATOR_LESS_THAN
Compare previous object to next object for whether previous object is less than next object, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_GREATER_THAN_OR_EQUAL

public static final int TYPE_OPERATOR_GREATER_THAN_OR_EQUAL
Compare previous object to next object for whether previous object is greater than or equal to next object, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_GREATER_THAN

public static final int TYPE_OPERATOR_GREATER_THAN
Compare previous object to next object for whether previous object is greater than next object, return 1 if true, 0 if false

See Also:
Constant Field Values

TYPE_OPERATOR_OR

public static final int TYPE_OPERATOR_OR
Test previous object for non-zero versus zero. If zero then remove the previous object and this operator. If non-zero then remove this operator and all following objects and OR operators until the operator is no inter an OR. Ex: 0||2||0||0||3+1 becomes 2||0|0||3+1 which then becomes 2||0||0||3+1 becomes 2+1

See Also:
Constant Field Values

TYPE_OPERATOR_AND

public static final int TYPE_OPERATOR_AND
Test previous object for non-zero versus zero. If non-zero then If this is the first And, track position of the previous object and move forward with testing until all concurrent Ands are tested. If all are true then remove everything from the object following the last And to the first And leaving the object preceeding the first And in place. Ex: 2&&1&&5+1 become 2+1.
If the previous object is zero then remove every object going forward while the And operators continue until removal of the last object following the last And, then work backwards until all objects are removed up to and including the object preceeding the first And. Then add a Zero object. Ex: 3+2&&4&&1&&0&&1&&2+4&&2 becomes 3+0+4&&2 which then becomes 3+0+4 which then becomes 7.

See Also:
Constant Field Values

TYPE_OPERATOR_MULTIPLY

public static final int TYPE_OPERATOR_MULTIPLY
Multiply next object by previous object

See Also:
Constant Field Values

TYPE_OPERATOR_DIVIDE

public static final int TYPE_OPERATOR_DIVIDE
Divide previous object by next object

See Also:
Constant Field Values

TYPE_OPERATOR_MODULUS

public static final int TYPE_OPERATOR_MODULUS
Return Remainder of division of previous object by next object.

See Also:
Constant Field Values

TYPE_OPERATOR_BIT_AND

public static final int TYPE_OPERATOR_BIT_AND
Apply a bitwise And of previous object against the next object

See Also:
Constant Field Values

TYPE_OPERATOR_BIT_OR

public static final int TYPE_OPERATOR_BIT_OR
Apply a bitwise Or of previous object against the next object

See Also:
Constant Field Values

TYPE_OPERATOR_BIT_XOR

public static final int TYPE_OPERATOR_BIT_XOR
Apply a bitwise Xor of previous object against the next object

See Also:
Constant Field Values

TYPE_OPERATOR_PLUS

public static final int TYPE_OPERATOR_PLUS
Add next object to previous object. New object will be Double if either of the objects is Double, Boolean if both objects are Boolean, and in all other cases, Long

See Also:
Constant Field Values

TYPE_OPERATOR_MINUS

public static final int TYPE_OPERATOR_MINUS
subtract next object from previous object. New object will be Double if either of the objects is Double, Boolean if both objects are Boolean, and in all other cases, Long

See Also:
Constant Field Values

TYPE_TO_STRING_ARRAY

public static final java.lang.String[] TYPE_TO_STRING_ARRAY
Return the String form of TYPE_, Ex: TYPE_TO_STRING_ARRAY[TYPE_STRING]==String, TO_STRING_ARRAY[TYPE_OPERATOR_PLUS]=="+", etc...


OPERATOR_STRING

public static final java.lang.String OPERATOR_STRING
See Also:
Constant Field Values

IS_UNARY_OPERATOR

public static final boolean[] IS_UNARY_OPERATOR
boolean array used to determine whether a TYPE is a unary operator.


IS_COMPARATOR_OPERATOR

public static final boolean[] IS_COMPARATOR_OPERATOR
boolean array used to determine whether a TYPE is a comparator operator (!=, >, >=, =, <=, <).

Constructor Detail

FormulaVariable

protected FormulaVariable()
Blank FormulaVariable. Used in Clone


FormulaVariable

public FormulaVariable(java.lang.String variable)
                throws java.text.ParseException
This constructor pulls the variable name from the first part of the String and the value from the last part. There must be an Equals sign separating the name from the value.

Parameters:
variable - the variable name, an equals sign, the value. Example: new FormulaVariable("testVar=\"Hi There\"). Unquoted text is treated as a formula. "testVar=A+B" is formula, "testVar=\"A+B\"" is text string.
Throws:
java.text.ParseException - is equal sign is missing

FormulaVariable

public FormulaVariable(java.lang.String variable,
                       int level)
                throws java.text.ParseException
This constructor pulls the variable name from the first part of the String and the value from the last part. There must be an Equals sign separating the name from the value.

Parameters:
variable - the variable name, an equals sign, the value. Example: new FormulaVariable("testVar=\"Hi There\",1). Unquoted text is treated as a formula. "testVar=A+B" is formula, "testVar=\"A+B\"" is text string.
level - the level to be assigned to the variable.
Throws:
java.text.ParseException - is equal sign is missing

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       int variableType,
                       int level)
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableType - is the type of operator. In this instance is intended for easy creation of operators and scaleIfDouble is set to 0.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       int variableType,
                       int level,
                       boolean stripSurroundingQuotesFromStrings)
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableType - is the type of operator. In this instance is intended for easy creation of operators and scaleIfDouble is set to 0.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
stripSurroundingQuotesFromStrings - causes setValue(String value) to strip surrounding quotes

FormulaVariable

public FormulaVariable(int variableType,
                       int level)
Creates a new instance of FormulaVariable

Parameters:
variableType - is the type of operator. In this instance is intended for easy creation of operators and scaleIfDouble is set to 0.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.

FormulaVariable

public FormulaVariable(int variableType,
                       int level,
                       boolean stripSurroundingQuotesFromStrings)
Creates a new instance of FormulaVariable

Parameters:
variableType - is the type of operator. In this instance is intended for easy creation of operators and scaleIfDouble is set to 0.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
stripSurroundingQuotesFromStrings - causes setValue(String value) to strip surrounding quotes

FormulaVariable

public FormulaVariable(int variableType)
Creates a new instance of FormulaVariable

Parameters:
variableType - is the type of operator. In this instance is intended for easy creation of operators. ScaleIfDouble and level are set to 0.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       int variableType,
                       int scaleIfDouble,
                       int level)
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableType - is the type of variable or operator (TYPE_STRING, TYPE_OPERATOR_PLUS, etc..). If not an operator type then the value is null until setValue() is used.
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.lang.String variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       long variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       double variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       boolean variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.util.Date variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.math.BigDecimal variableValue,
                       int variableType,
                       int scaleIfDouble,
                       int level)
                throws java.lang.NumberFormatException
Creates a new instance of FormulaVariable

Parameters:
variableName - is used by the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
variableValue - the value of the varaible. It should match the variableType.
variableType - is the type of variable (TYPE_STRING, etc...). shouldn't be a TYPE_OPERATOR such as TYPE_OPERATOR_ADD, etc...
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - is used when purging variables from the FormulaVariableList and by the FormulaVariableStack to determine whether various variables need to be resolved.
Throws:
java.lang.NumberFormatException - if variableType wrong compared to variable value (As in variableType being of the TYPE_OPERATOR set).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.lang.String variableValue,
                       int level)
Creates a new instance of FormulaVariable. Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point. If a string is not surrounded by quotes, then this will assume that it is a formula.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       long variableValue,
                       int level)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       double variableValue,
                       int level)
Creates a new instance of FormulaVariable. scale defaults to 4 in this constructor. Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       double variableValue,
                       int scale,
                       int level)
Creates a new instance of FormulaVariable. scale defaults to 4 in this constructor. Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable.
scale - This is the number of digits kept to the right of the decimal point before rounding.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       boolean variableValue,
                       int level)
Creates a new instance of FormulaVariable. Scale defaults to 4 in this constructor Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       boolean variableValue,
                       int scale,
                       int level)
Creates a new instance of FormulaVariable. Scale defaults to 4 in this constructor Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable.
scale - When Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.util.Date variableValue,
                       int level)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.math.BigDecimal variableValue,
                       int level)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.math.BigDecimal variableValue,
                       int scale,
                       int level)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
scale - This is the number of digits kept to the right of the decimal point before rounding.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.lang.String variableValue,
                       int level,
                       boolean treatUnquotedTextAsFormulas)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.
treatUnquotedTextAsFormulas - If true then if the variable value has beginning and ending quotes, they will be removed and the variable will be of TYPE_STRING, If unquoted only made up of letters, numbers, and underscores with no spaces, then the variable type will be TYPE_VARIABLE, else the variable type will be TYPE_FORMULA or TYPE_FUNCTION.
If treatUnquotedTextAsFormula is false then the variable type will be TYPE_STRING if it is determined not to be TYPE_LONG, TYPE_BOOLEAN, or TYPE_DOUBLE and the value will be left as-is (no quotes removed).

FormulaVariable

public FormulaVariable(java.lang.String variableName,
                       java.lang.String variableValue,
                       int scaleIfDouble,
                       int level,
                       boolean treatUnquotedTextAsFormulas)
Creates a new instance of FormulaVariable Tries to determine type of variable based on contents of value. If Double, then scale is set to the number of digits to the right of the decimal point.

Parameters:
variableName - Needed by FormulaVariableList, but not by MathStack.
variableValue - the value of the variable. if numeric with a decimal point then Double, if numeric then Integer, if true or alse then boolean, else string.
scaleIfDouble - If variableType==TYPE_DOUBLE then this is the number of digits kept to the right of the decimal point before rounding. If Boolean and setValue(Double value) is used and this value sets the rounding sensitivity when determining true from false. newValue=Round(value*pow(10,scaleIfDouble).intValue)/pow(10,scaleIfDouble).intValue.
level - Used by FormulaVariableList to determine when variable can be desposed. Not used by MathStack.
treatUnquotedTextAsFormulas - If true then if the variable value has beginning and ending quotes, they will be removed and the variable will be of TYPE_STRING, If unquoted only made up of letters, numbers, and underscores with no spaces, then the variable type will be TYPE_VARIABLE, else the variable type will be TYPE_FORMULA or TYPE_FUNCTION.
If treatUnquotedTextAsFormula is false then the variable type will be TYPE_STRING if it is determined not to be TYPE_LONG, TYPE_BOOLEAN, or TYPE_DOUBLE and the value will be left as-is (no quotes removed).
Method Detail

findScaleOfDouble

public static int findScaleOfDouble(java.lang.String variableValue)
If variableValue is known to contain an integer or double then what is the scale (integer would be scale=0).

Parameters:
variableValue - value tested to figure out scale.
Returns:
scale the number of characters to the right of the decimal point.

detectVariableType

public static int detectVariableType(java.lang.String variableValue,
                                     boolean treatUnquotedTextAsFormulas)

setValue

public void setValue(java.lang.String value)
              throws java.lang.NumberFormatException
Parameters:
value - a string value that is to be the new value. If this is TYPE_DOUBLE, then it will be rounded to the specified scale as defined when this was created.
Throws:
java.lang.NumberFormatException - if the variableType is of the TYPE_OPERATOR set or if variableType is TYPE_INTEGER or TYPE_DOUBLE and the value can't be converted.

setValue

public void setValue(long value)
              throws java.lang.NumberFormatException
Parameters:
value - the new long value. If TYPE_BOOLEAN then long value will be converted to 1 or 0 meaning that setValue((long)103) then getLong()==1. If TYPE_DATE then java.util.Date(long value) is used to get the date.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

setValue

public void setValue(double value)
              throws java.lang.NumberFormatException
Parameters:
value - the new double value. If TYPE_BOOLEAN then double value. scale will be used to set the sensitivity of true versus false. scale==2 means false is 0 +-.0049. If TYPE_DATE then java.util.Date(long value) is used to get the date.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

setValue

public void setValue(double value,
                     int scale)
              throws java.lang.NumberFormatException
This method updates the scale value then executes setValue(double value)

Parameters:
value - the new double value for this variable. If TYPE_DATE then java.util.Date(long value) is used to get the date.
scale - rounding scale where 1 = Tenths, 2 = OneHundreths, etc. Setting this value only makes sense for TYPE_DOUBLE and TYPE_BOOLEAN variableTypes.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

setValue

public void setValue(java.math.BigDecimal value)
              throws java.lang.NumberFormatException
Parameters:
value - the new BigDecimal value. If TYPE_BOOLEAN then double value. scale will be used to set the sensitivity of true versus false. scale==2 means false is 0 +-.0049. If TYPE_DATE then java.util.Date(long value) is used to get the date.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

setValue

public void setValue(java.math.BigDecimal value,
                     int scale)
              throws java.lang.NumberFormatException
This method updates the scale value then executes setValue(BigDecimal value)

Parameters:
value - the new BigDecimal value for this variable. If TYPE_DATE then java.util.Date(long value) is used to get the date.
scale - rounding scale where 1 = Tenths, 2 = OneHundreths, etc. Setting this value only makes sense for TYPE_DOUBLE and TYPE_BOOLEAN variableTypes.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

setValue

public void setValue(java.util.Date value)
              throws java.lang.NumberFormatException
Parameters:
value - the Date value for this variable. If TYPE_LONG or TYPE_DOUBLE then value.toTime() is used.
Throws:
java.lang.NumberFormatException - if TYPE_BOOLEAN, TYPE_FORMULA, TYPE_FUNCTION, or TYPE_VARIABLE.

setValue

public void setValue(boolean value)
              throws java.lang.NumberFormatException
Parameters:
value - becomes a 0 if false, 1 if true if variableType is TYPE_BOOLEAN, TYPE_LONG, or TYPE_DOUBLE. TYPE_STRING will be "true" or "false"
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getString

public java.lang.String getString()
Returns:
the string form of the value. If variableType is an Operator type then the symbol for the operator is returned (ie: variableType=TYPE_OPERATOR_PLUS then "+" is returned).

getLong

public java.lang.Long getLong()
                       throws java.lang.NumberFormatException
Returns:
Long value. Round Half Up is used if of Type Double. If Type Boolean then False = 0, True = 1. If this is TYPE_DATE, the Date.getTime() method is used to retrieve a value.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getDouble

public java.lang.Double getDouble()
                           throws java.lang.NumberFormatException
Returns:
Double value. If Type Boolean then False = 0, True = 1. If TYPE_DATE then Date value.getTime() is used.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getBigDecimal

public java.math.BigDecimal getBigDecimal()
                                   throws java.lang.NumberFormatException
Returns:
BigDecimal representation of value unscaled with rounding unset. If TYPE_DATE then Date value.getTime() is used.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getBigDecimalScaled

public java.math.BigDecimal getBigDecimalScaled()
                                         throws java.lang.NumberFormatException
Returns:
BigDecimal representation of value scaled as appropriate with Round Half Up such that returnValue.toPlainString() will return correct value. If TYPE_DATE then Date value.getTime() is used.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getBoolean

public boolean getBoolean()
                   throws java.lang.NumberFormatException
Returns:
Boolean value, if value is zero (within specified scale), or a string matching the case-insensitive words f, false, n, or no then return false, else return true.
Throws:
java.lang.NumberFormatException - if variableType is of the TYPE_OPERATOR_ set.

getDate

public java.util.Date getDate()
                       throws java.text.ParseException
Returns:
Date value, if value is TYPE_DOUBLE or TYPE_LONG then returns new Date(long value).
Throws:
java.text.ParseException - if date can't be created from variableValue

booleanValue

protected boolean booleanValue(java.lang.String value)
Parameters:
value - a string that considered true unless the value is null, an empty string, or matches (case-insensitive) the words false, f, no, n, or is zero when converted to long (If this is of TYPE_BOOLEAN or TYPE_DOUBLE, and the value can be converted into a Double, then it is rounded based on the scale).
Returns:
boolean value of result.

getVariableType

public int getVariableType()
Returns:
the type of variable or operator. Matches to the values of TYPE_INTEGER, TYPE_STRING, TYPE_OPERATOR_PLUS, etc...

getValue

public java.lang.Object getValue()
Returns:
the value in the appropriate class as specified in variableType()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the string representation of the object. Same as getString()

getVariableName

public java.lang.String getVariableName()
Returns:
the name of the variable as defined when it was created

getLevel

public int getLevel()
Returns:
the level of the variable as defined when it was created

getScale

public int getScale()
Returns:
scale of number. Returns zero for everything except Double or Boolean. This reflects number of digits to right of decimal point

setScale

public void setScale(int scale)
Parameters:
scale - the number of digits to the right of the decimal point.

setHighestLevel

public void setHighestLevel(int highestLevel)
Parameters:
highestLevel - the highest level used when solving this variable. It gets set automatically, however, you may want to update it if you determined it's use based on a variable with a higher level than the one recorded here.

isOperator

public boolean isOperator()
Returns:
true if this is an operator instead of a value (belonging to the TYPE_OPERATOR_<...> set)

isNonUnaryOperator

public boolean isNonUnaryOperator()
Returns:
true if this is an operator instead of a value (belonging to the TYPE_OPERATOR_<...> set), but not a unary operator. Used while processing stack to determine variables that are operators that operate on two operands

isUnaryOperator

public boolean isUnaryOperator()
Returns:
true if this is a unary operator

isComparatorOperator

public boolean isComparatorOperator()
Returns:
true if this is a comparator operator (!=, <, <=, =, >=, or >).

testIsOperator

public static boolean testIsOperator(java.lang.String operator)
Test whether a string segment is an operator.

Parameters:
operator - String containing suspected operator (<, <=, =, >=, >, *, /, etc...).
Returns:
true if it matches a valid operator or false if it doesn't match.

testIsOperator

public static boolean testIsOperator(char operator)
Test whether a character is part of an operator.

Parameters:
operator - String containing suspected operator (<, <=, =, >=, >, *, /, etc...).
Returns:
true if it matches a valid operator or false if it doesn't match.

testIsOperator

public static boolean testIsOperator(int operator)
Test whether a specified TYPE is an operator.

Parameters:
operator - the operator number.
Returns:
true if it is an operator. TYPE_STRING, TYPE_DOUBLE, etc... aren't operators.

findOperatorPrecedence

public static int findOperatorPrecedence(java.lang.String operator)
Find the operator precedence of an operator that is handed to this method.

Parameters:
operator - String containing a possible operator (<, <=, =, >=, >, *, /, etc...).
Returns:
int value of operator. The lower the precedence the higher the priority. * is lower than +.

testIsUnaryOperator

public static boolean testIsUnaryOperator(int operator)
Parameters:
operator - an int operator that is to be tested. Only Unary Operators at time of this writing were the exclamation point(NOT) and tilda(BIT NOT).
Returns:
true if operator is a Unary Operator.

testIsComparatorOperator

public static boolean testIsComparatorOperator(int operator)
Parameters:
operator - an int operator that is to be tested. Only Comparator Operators at time of this writing were !=, <. <=, =, >=, and >.
Returns:
true if operator is a Comparator Operator.

getOperator

public int getOperator()
Returns:
the operator type. This is the same as getVariableType().

clone

public FormulaVariable clone()
Overrides:
clone in class java.lang.Object
Returns:
a clone of this object

getHighestLevel

public int getHighestLevel()
Returns:
If TYPE_VARIABLE, TYPE_FUNCTION, or TYPE_FORMULA then return highest level variable used in resolving this variable else return this variable's level.

solve

public FormulaVariable solve(FormulaVariableList variableList,
                             int iteration,
                             SupportParameters supportParameters,
                             FormulaFunctionList functionList,
                             int resolveEverythingAboveLevel)
                      throws java.text.ParseException,
                             java.lang.ArithmeticException,
                             java.lang.ClassNotFoundException
IF this variable is of TYPE_FORMULA, TYPE_FUNCTION, or TYPE_VARIABLE then this method solves for the value. Once solved the get...() methods return the value of the solved formula or variable else it just returns a clone of this variable.

Throws:
java.text.ParseException
java.lang.ArithmeticException
java.lang.ClassNotFoundException

isNull

public boolean isNull()
Returns:
true if value is currenty null

padString

protected static java.lang.String padString(java.lang.String orgString,
                                            int size,
                                            char padChar,
                                            boolean padOnLeft)
Pad a string with repeating characters such that the final string is size long.
Examples:
padString("12",5,'0',true).equals("00012")==true
padString("Hi",4,' ',false).equals("Hi ")==true

Parameters:
orgString - the original String
size - the final size of the returned String
padChar - the fill character used when padding the String
padOnLeft - If true the pad string from left else pad string from right.
Returns:
padded String

getPrecision

public int getPrecision()
Returns:
the mathematical precision of the number. In doubles, this value defaults to the number of digits to the left of the decimal point + the scale since Doubles have 17 significant digits of precision. This is used in multiplication and division to determine the precision of the result (The lesser precision of two doubles). Ex: 10.2 would have a Precision of 3, 10.24 would have a precision of 4, 101 would have a precision of 3, 1.23456789098765432 would have a precision of 17.

setPrecision

public void setPrecision(int precision)
Parameters:
precision - the mathematical precision of the number. In doubles, this value defaults to the number of digits to the left of the decimal point + the scale since Doubles have 17 significant digits of precision. This is used in multiplication and division to determine the precision of the result (The lesser precision of two doubles). Ex: 10.2 would have a Precision of 3, 10.24 would have a precision of 4, 101 would have a precision of 3, 1.23456789098765432 would have a precision of 17.

setStripSurroundingQuotesFromStrings

public void setStripSurroundingQuotesFromStrings(boolean state)
Parameters:
state - If true then setValue(String value) will strip surrounding quotes from the value. This defaults to false unless treatUnquotedTextAsFormulas is set true, then this defaults to true as well.

getStripSurroundingQuotesFromStrings

public boolean getStripSurroundingQuotesFromStrings()
Returns:
status. If true then setValue(String value) will strip surrounding quotes from the value. This defaults to false unless treatUnquotedTextAsFormulas is set true, then this defaults to true as well.

purgeResultsGreaterThanSpecifiedLevel

public void purgeResultsGreaterThanSpecifiedLevel(int specifiedLevel)
If the result of a calculation used a value above the specified level, then purge the answer. If there is a stack then go through entries in the stack and purge the results of any functions, formulas, or variable references, that used variables with a level higher than the specified level. go down into the stacks of variables that have their own stacks.
This does not delete the formulas them-selves. It just forces the variables to be re-solved during the next solve regardless of the resolveEverythingAboveLevel value. It is important to use this when a lower level value has changed and you wouldn't have run across these re-calculations during the lower level process. An example would be, while processing deduction codes, and employee number changed. The deduction code formulas are performed at a level 2 and the employee data is performed at a level 1. Once the level 1 stuff was processed, the level two routines wouldn't know that a level 1 value has changed and would continue to use old values.

Parameters:
specifiedLevel - the level above which all results are to be purged.