com.eteks.parser.node
Class CommonFunctionNode
java.lang.Object
|
+--com.eteks.parser.node.ConstantNode
|
+--com.eteks.parser.node.CommonFunctionNode
- All Implemented Interfaces:
- ExpressionNode, ParameterizedNode, java.io.Serializable
- public class CommonFunctionNode
- extends ConstantNode
- implements ParameterizedNode
Node matching a common function.
- Since:
- Jeks 1.0
- Version:
- 1.0
- Author:
- Emmanuel Puybaret
- See Also:
- Serialized Form
Constructor Summary |
CommonFunctionNode(java.lang.Object functionKey)
Creates the node of a common function. |
Method Summary |
void |
addParameter(ExpressionNode parameter)
Stores the parameter of this function. |
double |
computeExpression(double[] parametersValue)
Returns the double value of this function computing with its parameter. |
java.lang.Object |
computeExpression(Interpreter interpreter,
java.lang.Object[] parametersValue)
Returns the value returned by the getCommonFunctionValue () method
of interpreter with the key of this function and the computed value
of its parameter as parameters of getCommonFunctionValue () . |
ExpressionNode |
getParameter()
Returns the node matching the parameter. |
int |
getParameterCount()
Returns the current count of parameters or operands stored by this node. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CommonFunctionNode
public CommonFunctionNode(java.lang.Object functionKey)
- Creates the node of a common function.
- Parameters:
functionKey
- the key of a common function of Syntax
.
addParameter
public void addParameter(ExpressionNode parameter)
- Stores the parameter of this function.
- Specified by:
addParameter
in interface ParameterizedNode
- Following copied from interface:
com.eteks.parser.node.ParameterizedNode
- Parameters:
parameter
- the node of an expression used as parameter or operand.
getParameterCount
public int getParameterCount()
- Description copied from interface:
ParameterizedNode
- Returns the current count of parameters or operands stored by this node.
- Specified by:
getParameterCount
in interface ParameterizedNode
- Following copied from interface:
com.eteks.parser.node.ParameterizedNode
- Returns:
- the count of parameters of this node.
getParameter
public ExpressionNode getParameter()
- Returns the node matching the parameter.
- Returns:
- the node of an expression.
computeExpression
public java.lang.Object computeExpression(Interpreter interpreter,
java.lang.Object[] parametersValue)
- Returns the value returned by the
getCommonFunctionValue ()
method
of interpreter
with the key of this function and the computed value
of its parameter as parameters of getCommonFunctionValue ()
.
- Specified by:
computeExpression
in interface ExpressionNode
- Overrides:
computeExpression
in class ConstantNode
- Parameters:
interpreter
- runtime interpreter.parametersValue
- the value of parameters passed to compute a compiled function.- Returns:
- the computed value of this function. The type of the returned value
depends on the implementation of the interpreter.
- See Also:
Interpreter.getCommonFunctionValue(java.lang.Object, java.lang.Object)
computeExpression
public double computeExpression(double[] parametersValue)
- Returns the double value of this function computing with its parameter.
- Specified by:
computeExpression
in interface ExpressionNode
- Overrides:
computeExpression
in class ConstantNode
- Parameters:
parametersValue
- the value of parameters passed to compute a compiled function.- Returns:
- the value of this function.