public class ConstantExpressionNode extends Object implements ExpressionNode
ADDITION_NODE, CONSTANT_NODE, EXPONENTIATION_NODE, FUNCTION_NODE, MULTIPLICATION_NODE, VARIABLE_NODE| Constructor and Description |
|---|
ConstantExpressionNode(double value)
Construct with the fixed value.
|
ConstantExpressionNode(String value)
Convenience constructor that takes a string and converts it to a double
before storing the value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ExpressionNodeVisitor visitor)
Implementation of the visitor design pattern.
|
int |
getType()
Returns the type of the node, in this case ExpressionNode.CONSTANT_NODE
|
double |
getValue()
Returns the value of the constant
|
public ConstantExpressionNode(double value)
value - the value of the constantpublic ConstantExpressionNode(String value)
value - the string representation of the valuepublic double getValue()
getValue in interface ExpressionNodepublic int getType()
getType in interface ExpressionNodepublic void accept(ExpressionNodeVisitor visitor)
accept in interface ExpressionNodevisitor - the visitorCopyright © 2017. All rights reserved.