public abstract class Function extends Object
Expression
.Compiler
,
Expression
Constructor and Description |
---|
Function(String name,
int argc)
Constructs a new
Function instance with given name. |
Modifier and Type | Method and Description |
---|---|
protected void |
checkFunctionArgs(List<Expression> args)
Throws an exception if the number of
args is less than the number
of required function arguments (argc ). |
abstract Object |
evaluate(List<Expression> args)
Evaluates this function using the supplied list of arguments.
|
int |
getArgc()
Returns the number of required arguments of this function.
|
String |
getName()
Returns the name of this function.
|
public Function(String name, int argc)
Function
instance with given name.name
- the name of the function.argc
- the number of required function arguments.NullPointerException
- if name
is null
.IllegalArgumentException
- if argc
is negative.public final String getName()
public final int getArgc()
protected final void checkFunctionArgs(List<Expression> args)
args
is less than the number
of required function arguments (argc
). If args
is null
, this method assumes zero arguments.args
- the arguments passed to evaluate
(can be null).ExpressionException
- if number of args
is less than argc
.public abstract Object evaluate(List<Expression> args) throws Exception
args
- the arguments required for the evaluation (can be null).Exception
- if an error occurs evaluating the function.Copyright © OBCOM INGENIERIA S.A. (Chile). All Rights Reserved.