com.accountingenhancements.formula
Class FormulaFunction_IIF
java.lang.Object
com.accountingenhancements.formula.FormulaFunction
com.accountingenhancements.formula.FormulaFunction_IIF
public class FormulaFunction_IIF
- extends FormulaFunction
Constructor Summary |
FormulaFunction_IIF(FormulaVariable functionVariable)
Create a new FormulaFunction from the functionVariable (A FormulaVariable of TYPE_FUNCTION).
This is the most common constructor used. |
FormulaFunction_IIF(FormulaVariableStack functionArgumentStack)
Create a new FormulaFunction with an already defined functionArgumentStack. |
FormulaFunction_IIF(java.lang.String functionArgumentString)
Create a new FormulaFunction with a comma-delimited string representing the arguments needed by the function |
FormulaFunction_IIF(java.lang.String functionArgumentString,
int level)
Create a new FormulaFunction with a comma-delimited string representing the arguments needed by the function |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
requiredArguments
protected static java.lang.String[][] requiredArguments
returnValueDescription
protected static java.lang.String[] returnValueDescription
FormulaFunction_IIF
public FormulaFunction_IIF(FormulaVariableStack functionArgumentStack)
- Create a new FormulaFunction with an already defined functionArgumentStack.
- Parameters:
functionArgumentStack
- a list of FormulaVariable
s that are needed by the function.
FormulaFunction_IIF
public FormulaFunction_IIF(java.lang.String functionArgumentString)
throws java.text.ParseException
- Create a new FormulaFunction with a comma-delimited string representing the arguments needed by the function
- Parameters:
functionArgumentString
- the string representing the functions arguments. The outer parentheses must be removed.
Example: If the function is IIF(AThrows:
java.text.ParseException
- if arguments can't be parsed using parseCommaDelimitedFunctionFields(String,int)
FormulaFunction_IIF
public FormulaFunction_IIF(java.lang.String functionArgumentString,
int level)
throws java.text.ParseException
- Create a new FormulaFunction with a comma-delimited string representing the arguments needed by the function
- Parameters:
functionArgumentString
- the string representing the functions arguments. The outer parentheses must be removed.
Example: If the function is IIF(Alevel
- the level applied to the creation of FormulaVariables for the arguments.
- Throws:
java.text.ParseException
- if arguments can't be parsed using parseCommaDelimitedFunctionFields(String,int)
FormulaFunction_IIF
public FormulaFunction_IIF(FormulaVariable functionVariable)
throws java.text.ParseException
- Create a new FormulaFunction from the functionVariable (A FormulaVariable of TYPE_FUNCTION).
This is the most common constructor used.
- Parameters:
functionVariable
- a FormulaVariable of TYPE_FUNCTION
- Throws:
java.text.ParseException
- if arguments can't be parsed using parseCommaDelimitedFunctionFields(String,int)
function
public FormulaVariable function(FormulaVariableList variableList,
int iteration,
SupportParameters supportParameters,
FormulaFunctionList functionList,
int resolveEverythingAboveLevel)
throws java.text.ParseException,
java.lang.ArithmeticException,
java.lang.ClassNotFoundException
- IIF Function
Based on the truth of a test, a FormulaVariable is returned by following the result of the true branch or the false branch. Ex: IIF(testVariable!=0,"Not Zero","Zero");
This class expects ARG1 to be the test, ARG2 to be the true result, and ARG3 to be the false result.
- Overrides:
function
in class FormulaFunction
- Parameters:
variableList
- the variable list used when solving for various variables.iteration
- used to prevent infinite loops.supportParameters
- a list of objects that this method may need to solve itself. One example is if this were an SQL function, one of the objects could be an sql connection.functionList
- list of functions that may be necessary when solving FormulaVariables on the functionArgumentStack.resolveEverythingAboveLevel
- reflects level at which TYPE_VARIABLE, TYPE_FUNCTION, and TYPE_FORMULA variables need to be re-solved.
- Returns:
- FormulaVariable containing the result
- Throws:
java.lang.ArithmeticException
- or ParseException as handed through from FormulaVariableStack and if caused by various solutions in certain
functions. SQL functions and the like will have to throw ArithmeticExceptions since we are faily generic here.
If you add your own exceptions in your functions, note that it is up to you to support the exception if it fails when being
solved in the FormulaVariableStack because it will be thrown as an unexpected exception. You are better off using the Arithmetic Exception
in your defined function and setting the return message such that your external code can react appropriately to the error..
java.text.ParseException
java.lang.ClassNotFoundException
getName
public static final java.lang.String getName()
- Returns:
- the name of this function
getRequiredArguments
public static java.lang.String[][] getRequiredArguments()
- Returns:
- String[][] of needed arguments and their dataTypes which as {{"Test Argument ARG1","TYPE_BOOLEAN"},{"True Argument ARG2","TYPE_?"},{"False Argument ARG3","TYPE_?"}}
If handing this routine a FormulaVariableStack functionArgumentStack then the FormulaVariable arguments should be named, ARG1, ARG2, etc...
getReturnValueDescription
public static java.lang.String[] getReturnValueDescription()
- Returns:
- String[] description of the return value as well as it's data type