http://www.eteks.com

com.eteks.parser.node
Class ConstantNode

java.lang.Object
  |
  +--com.eteks.parser.node.ConstantNode
All Implemented Interfaces:
ExpressionNode, java.io.Serializable
Direct Known Subclasses:
BinaryOperatorNode, CommonFunctionNode, UnaryOperatorNode

public class ConstantNode
extends java.lang.Object
implements ExpressionNode

Node matching a constant.

Since:
Jeks 1.0
Version:
1.0
Author:
Emmanuel Puybaret
See Also:
Serialized Form

Field Summary
static double FALSE_DOUBLE
          The double constant matching the constant FALSE (equal to 0).
static double TRUE_DOUBLE
          The double constant matching the constant TRUE (equal to 1).
 
Constructor Summary
ConstantNode(java.lang.Object key)
          Creates the node of a constant.
 
Method Summary
 double computeExpression(double[] parametersValue)
          Returns the double value of this constant.
 java.lang.Object computeExpression(Interpreter interpreter, java.lang.Object[] parametersValue)
          Returns the value returned by the getConstantValue () method of interpreter with the key of this constant as parameter.
 java.lang.Object getKey()
          Returns the syntactic key of this node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FALSE_DOUBLE

public static final double FALSE_DOUBLE
The double constant matching the constant FALSE (equal to 0).

TRUE_DOUBLE

public static final double TRUE_DOUBLE
The double constant matching the constant TRUE (equal to 1).
Constructor Detail

ConstantNode

public ConstantNode(java.lang.Object key)
Creates the node of a constant.
Parameters:
key - the key of a constant of Syntax.
Method Detail

getKey

public java.lang.Object getKey()
Returns the syntactic key of this node.
Returns:
a key of Syntax.

computeExpression

public java.lang.Object computeExpression(Interpreter interpreter,
                                          java.lang.Object[] parametersValue)
Returns the value returned by the getConstantValue () method of interpreter with the key of this constant as parameter.
Specified by:
computeExpression in interface ExpressionNode
Parameters:
interpreter - runtime interpreter.
parametersValue - not used.
Returns:
the interpreted value of this constant. The type of the returned value depends on the implementation of the interpreter.
See Also:
Interpreter.getConstantValue(java.lang.Object)

computeExpression

public double computeExpression(double[] parametersValue)
Returns the double value of this constant. The value FALSE_DOUBLE is returned for the CONSTANT_FALSE constant key, and the value TRUE_DOUBLE is returned for the CONSTANT_TRUE constant key.
Specified by:
computeExpression in interface ExpressionNode
Parameters:
parametersValue - not used.
Returns:
the value of this constant.

&cp; 1998-2003 eTeks - All rights reserved