public abstract class Function extends Object implements FunctionI
It includes a numberOfParameters member, that is checked when parsing the expression. This member should be initialized to an appropriate value for all classes extending this class. If an arbitrary number of parameters should be allowed, initialize this member to -1.
| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
curNumberOfParameters
Number of parameters to be used for the next run() invocation.
|
protected int |
numberOfParameters
Number of parameters a the function requires.
|
| 构造器和说明 |
|---|
Function()
Creates a new PostfixMathCommand class.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
checkStack(Stack inStack)
Check whether the stack is not null, throw a ParseException if it is.
|
int |
getNumberOfParameters()
Return the required number of parameters.
|
abstract void |
run(Stack s)
Throws an exception because this method should never be called under
normal circumstances.
|
void |
setCurNumberOfParameters(int n)
Sets the number of current number of parameters used in the next call
of run().
|
protected int numberOfParameters
protected int curNumberOfParameters
protected void checkStack(Stack inStack) throws ParseException
ParseExceptionpublic int getNumberOfParameters()
getNumberOfParameters 在接口中 FunctionIpublic void setCurNumberOfParameters(int n)
setCurNumberOfParameters 在接口中 FunctionIpublic abstract void run(Stack s) throws ParseException
run 在接口中 FunctionIParseExceptionCopyright © 2023 onecode. All rights reserved.