Class Function
java.lang.Object
cl.obcom.desktopfx.expr.Function
Function evaluator that can be used in an
Expression.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidcheckFunctionArgs(List<Expression> args) Throws an exception if the number ofargsis less than the number of required function arguments (argc).abstract Objectevaluate(List<Expression> args) Evaluates this function using the supplied list of arguments.final intgetArgc()Returns the number of required arguments of this function.final StringgetName()Returns the name of this function.
-
Constructor Details
-
Function
Constructs a newFunctioninstance with given name.- Parameters:
name- the name of the function.argc- the number of required function arguments.- Throws:
NullPointerException- ifnameisnull.IllegalArgumentException- ifargcis negative.
-
-
Method Details
-
getName
Returns the name of this function.- Returns:
- the name of this function.
-
getArgc
public final int getArgc()Returns the number of required arguments of this function.- Returns:
- the number of required arguments of this function.
-
checkFunctionArgs
Throws an exception if the number ofargsis less than the number of required function arguments (argc). Ifargsisnull, this method assumes zero arguments.- Parameters:
args- the arguments passed toevaluate(can be null).- Throws:
ExpressionException- if number ofargsis less thanargc.
-
evaluate
Evaluates this function using the supplied list of arguments.- Parameters:
args- the arguments required for the evaluation (can be null).- Returns:
- the result of evaluating this function with supplied arguments.
- Throws:
Exception- if an error occurs evaluating the function.
-