com.eteks.parser.node
Class UnaryOperatorNode
java.lang.Object
|
+--com.eteks.parser.node.ConstantNode
|
+--com.eteks.parser.node.UnaryOperatorNode
- All Implemented Interfaces:
- ExpressionNode, ParameterizedNode, java.io.Serializable
- public class UnaryOperatorNode
- extends ConstantNode
- implements ParameterizedNode
Node matching an unary operator.
- Since:
- Jeks 1.0
- Version:
- 1.0
- Author:
- Emmanuel Puybaret
- See Also:
- Serialized Form
Constructor Summary |
UnaryOperatorNode(java.lang.Object operatorKey)
Creates the node of an unary operator. |
Method Summary |
void |
addParameter(ExpressionNode operand)
Stores the operand of this operator. |
double |
computeExpression(double[] parametersValue)
Returns the double value of this operator node operating on it operand. |
java.lang.Object |
computeExpression(Interpreter interpreter,
java.lang.Object[] parametersValue)
Returns the value returned by the getUnaryOperatorValue () method
of interpreter with the key of this operator and the computed value
of its operand as parameters. |
ExpressionNode |
getOperand()
Returns the node matching the operand. |
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 |
UnaryOperatorNode
public UnaryOperatorNode(java.lang.Object operatorKey)
- Creates the node of an unary operator.
- Parameters:
operatorKey
- the key of an unary operator of Syntax
.
addParameter
public void addParameter(ExpressionNode operand)
- Stores the operand of this operator.
- 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.
getOperand
public ExpressionNode getOperand()
- Returns the node matching the operand.
- Returns:
- the node of an expression.
computeExpression
public java.lang.Object computeExpression(Interpreter interpreter,
java.lang.Object[] parametersValue)
- Returns the value returned by the
getUnaryOperatorValue ()
method
of interpreter
with the key of this operator and the computed value
of its operand as parameters.
- 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 operator. The type of the returned value
depends on the implementation of the interpreter.
- See Also:
Interpreter.getUnaryOperatorValue(java.lang.Object, java.lang.Object)
computeExpression
public double computeExpression(double[] parametersValue)
- Returns the double value of this operator node operating on it operand.
- 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 operator.