|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.accountingenhancements.formula.FormulaVariableList
public class FormulaVariableList
Manage a list of FormulaVariable
s.
Variables with the highest levels replace variables with lower levels.
When higher levels are removed, the lower levels by the same name return in scope.
This list treats all variable names as ignore-case.
Field Summary | |
---|---|
protected int |
highestLevel
|
protected java.util.ArrayList<FormulaVariable> |
variableArray
|
protected java.util.HashMap<java.lang.String,FormulaVariable> |
variableList
|
Constructor Summary | |
---|---|
FormulaVariableList()
Creates a new instance of FormulaVariableList |
Method Summary | |
---|---|
FormulaVariable |
addValue(java.lang.String variableName,
java.math.BigDecimal value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.math.BigDecimal value,
int scale)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.math.BigDecimal value,
int scale,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
boolean value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
boolean value,
int scale)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
boolean value,
int scale,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.util.Date value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.util.Date value,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
double value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
double value,
int scale)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
double value,
int scale,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
long value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
long value,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.lang.String value)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.lang.String value,
boolean treatUnquotedTextAsFormulas)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.lang.String value,
int level)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.lang.String value,
int level,
boolean treatUnquotedTextAsFormulas)
Add a value to the variable list. |
FormulaVariable |
addValue(java.lang.String variableName,
java.lang.String value,
int scaleIfDouble,
int level,
boolean treatUnquotedTextAsFormulas)
Add a value to the variable list. |
FormulaVariable |
addVariable(FormulaVariable variable)
Add a variable to the list. |
FormulaVariable |
addVariable(java.lang.String variable)
Add a variable where the variable name is part of the string. |
FormulaVariable |
addVariable(java.lang.String variable,
int level)
Add a variable where the variable name is part of the string. |
FormulaVariableStack |
addVariables(java.lang.String variables)
Add a semi-colon separated list of variables in the order, variable name, equals sign, value, semi-colon, etc... |
FormulaVariableStack |
addVariables(java.lang.String variables,
int level)
Add a semi-colon separated list of variables in the order, variable name, equals sign, value, semi-colon, etc... |
protected FormulaVariable |
addVariableToList(FormulaVariable variable)
Adds the specified variable to the HashMap. |
java.math.BigDecimal |
getBigDecimal(java.lang.String variableName)
|
java.lang.Boolean |
getBoolean(java.lang.String variableName)
|
java.util.Date |
getDate(java.lang.String variableName)
|
java.lang.Double |
getDouble(java.lang.String variableName)
|
java.lang.Long |
getLong(java.lang.String variableName)
|
java.lang.String |
getString(java.lang.String variableName)
|
FormulaVariable |
getVariable(java.lang.String variableName)
|
int |
getVariableType(java.lang.String variableName)
|
protected void |
rebuildVariableList()
Rebuild the HashMap to make sure that the variables returned have the highest levels when names are shared. |
void |
removeLevel(int level)
|
void |
removeVariable(FormulaVariable variable)
|
void |
removeVariable(java.lang.String variableName)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap<java.lang.String,FormulaVariable> variableList
protected java.util.ArrayList<FormulaVariable> variableArray
protected int highestLevel
Constructor Detail |
---|
public FormulaVariableList()
Method Detail |
---|
public FormulaVariable getVariable(java.lang.String variableName)
public FormulaVariableStack addVariables(java.lang.String variables) throws java.text.ParseException
variables
- a semi-colon. Example: addVariables("Var1=A+B;Var2=\"Hi There\"");
java.text.ParseException
public FormulaVariableStack addVariables(java.lang.String variables, int level) throws java.text.ParseException
variables
- a semi-colon. Example: addVariables("Var1=A+B;Var2=\"Hi There\"",2);level
- the volatility of the variable.
java.text.ParseException
public FormulaVariable addVariable(java.lang.String variable) throws java.text.ParseException
variable
- variable name and value. Example: addVariable("Var1=A+B");
java.text.ParseException
public FormulaVariable addVariable(java.lang.String variable, int level) throws java.text.ParseException
variable
- variable name and value. Example: addVariable("Var1=A+B",1);level
- the volatility of the variable.
java.text.ParseException
public FormulaVariable addVariable(FormulaVariable variable)
variable
- the variable that is to be assigned to the list.
protected FormulaVariable addVariableToList(FormulaVariable variable)
variable
- the variable to be added to the HashMap.
public FormulaVariable addValue(java.lang.String variableName, java.lang.String value, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable. FormulaVariable will automatically try to determine whether this data represents a TYPE_STRING, TYPE_DOUBLE, TYPE_LONG, or TYPE_DATE.level
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, java.lang.String value, int level, boolean treatUnquotedTextAsFormulas)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable. FormulaVariable will automatically try to determine whether this data represents a TYPE_STRING, TYPE_DOUBLE, TYPE_LONG, or TYPE_DATE.level
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.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.public FormulaVariable addValue(java.lang.String variableName, java.lang.String value, int scaleIfDouble, int level, boolean treatUnquotedTextAsFormulas)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable. FormulaVariable will automatically try to determine whether this data represents a TYPE_STRING, TYPE_DOUBLE, TYPE_LONG, or TYPE_DATE.scaleIfDouble
- the scale of a numberlevel
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.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.public FormulaVariable addValue(java.lang.String variableName, long value, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.level
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, java.util.Date value, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.level
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, double value, int scale, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a numberlevel
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, java.math.BigDecimal value, int scale, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a numberlevel
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, boolean value, int scale, int level)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a number if TYPE_DOUBLE or the sensitivity of a true/false test against a double if TYPE_BOOLEAN.level
- the level of the variable. When variables share the same name (not case sensitive), the highest level is returned.
public FormulaVariable addValue(java.lang.String variableName, java.lang.String value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, java.lang.String value, boolean treatUnquotedTextAsFormulas)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.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.public FormulaVariable addValue(java.lang.String variableName, long value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, java.util.Date value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, double value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, double value, int scale)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a number
public FormulaVariable addValue(java.lang.String variableName, java.math.BigDecimal value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, java.math.BigDecimal value, int scale)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a number
public FormulaVariable addValue(java.lang.String variableName, boolean value)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.
public FormulaVariable addValue(java.lang.String variableName, boolean value, int scale)
variableName
- the name to be assigned to the variable that is to be created.value
- the value that is assigned to the new variable.scale
- the scale of a number if TYPE_DOUBLE or the sensitivity of a true/false test against a double if TYPE_BOOLEAN.
public java.lang.String getString(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public java.lang.Long getLong(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public java.lang.Double getDouble(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public java.lang.Boolean getBoolean(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public java.math.BigDecimal getBigDecimal(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public java.util.Date getDate(java.lang.String variableName) throws java.text.ParseException
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
java.text.ParseException
- if variable value can't be converted to a Date.public int getVariableType(java.lang.String variableName)
variableName
- the name of the variable whose value is to be returned. Note: The name is not case sensitive.
public void removeVariable(FormulaVariable variable)
variable
- remove the specified variable.public void removeVariable(java.lang.String variableName)
variableName
- the name of the variable to be removed. Not case sensitive.
If more than one variable by the same name, then the one with the highest level is remove.public void removeLevel(int level)
level
- the level to be removed from the variable list. Note: All higher levels are removed as well.
Removing level 0 clears everything unless you've been using negative numbers.protected void rebuildVariableList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |