Package net.sf.basedb.util.jep
Class SimpleJepFunction
java.lang.Object
net.sf.basedb.util.jep.SimpleJepFunction
- All Implemented Interfaces:
JepFunction
,org.nfunk.jep.function.PostfixMathCommandI
A simple base class for registering a JEP function by name and number
of parameters. The default implementation will simply return a random
number between 0 and 100. This is intended to be re-implemented by
subclasses.
- Since:
- 3.3
- Author:
- nicklas
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkNumberOfParameters
(int n) Get the name of this function.int
void
void
setCurNumberOfParameters
(int actualParameters)
-
Field Details
-
name
-
numParameters
private final int numParameters -
actualParameters
private int actualParameters
-
-
Constructor Details
-
SimpleJepFunction
-
-
Method Details
-
getFunctionName
Description copied from interface:JepFunction
Get the name of this function. It is used when registering the function with aJEP
parser.- Specified by:
getFunctionName
in interfaceJepFunction
- See Also:
-
getNumberOfParameters
public int getNumberOfParameters()- Specified by:
getNumberOfParameters
in interfaceorg.nfunk.jep.function.PostfixMathCommandI
-
checkNumberOfParameters
public boolean checkNumberOfParameters(int n) - Specified by:
checkNumberOfParameters
in interfaceorg.nfunk.jep.function.PostfixMathCommandI
-
setCurNumberOfParameters
public void setCurNumberOfParameters(int actualParameters) - Specified by:
setCurNumberOfParameters
in interfaceorg.nfunk.jep.function.PostfixMathCommandI
-
run
- Specified by:
run
in interfaceorg.nfunk.jep.function.PostfixMathCommandI
- Throws:
ParseException
-