public class VariableExpressionNode extends Object implements ExpressionNode
ADDITION_NODE, CONSTANT_NODE, EXPONENTIATION_NODE, FUNCTION_NODE, MULTIPLICATION_NODE, VARIABLE_NODE| Constructor and Description |
|---|
VariableExpressionNode(String name)
Construct with the name of the variable.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ExpressionNodeVisitor visitor)
Implementation of the visitor design pattern.
|
String |
getName() |
int |
getType()
Returns the type of the node, in this case ExpressionNode.VARIABLE_NODE
|
double |
getValue()
Returns the value of the variable but throws an exception if the value has
not been set
|
void |
setValue(double value)
Sets the value of the variable
|
public VariableExpressionNode(String name)
name - the name of the variablepublic String getName()
public int getType()
getType in interface ExpressionNodepublic void setValue(double value)
value - the value of the variablepublic double getValue()
getValue in interface ExpressionNodepublic void accept(ExpressionNodeVisitor visitor)
accept in interface ExpressionNodevisitor - the visitorCopyright © 2017. All rights reserved.