public class ExpressionNode
extends java.lang.Object
Constructor and Description |
---|
ExpressionNode(java.lang.String identifier)
Creates a new node representing an identifier.
|
Modifier and Type | Method and Description |
---|---|
ExpressionNode |
getLeftNode()
Retrieves the node representing the left hand side of a binary operation,
or the operand of a unary operation.
|
ExpressionNode |
getOperand(int index)
Gets an operand of the node.
|
int |
getOperandCount()
Gets the number of operands of this node.
|
ExpressionNode |
getRightNode()
Retrieves the node representing the right hand side of a binary
operation.
|
java.lang.String |
getValue()
Retrieves the value of this node.
|
boolean |
isIdentifier()
Tests whether this node represents an identifier.
|
boolean |
isNumberConstant()
Tests whether this node represents a number constant.
|
boolean |
isOperation()
Tests whether this node represents an operation.
|
boolean |
isStringConstant()
Tests whether this node represents a string constant.
|
public ExpressionNode(java.lang.String identifier)
identifier
- The identifierpublic java.lang.String getValue()
public int getOperandCount()
public ExpressionNode getOperand(int index)
index
- Index of the operand. Valid indices run from 0 to
getOperandCount()
.java.lang.IllegalArgumentException
- Index out of rangepublic ExpressionNode getLeftNode()
null
if there is no left operandpublic ExpressionNode getRightNode()
null
if there is no right operandpublic boolean isOperation()
true
if this node represents an operation.public boolean isNumberConstant()
true
if this node represents a number constant.public boolean isStringConstant()
true
if this node represents a string constant.public boolean isIdentifier()
true
if this node represents an identifier.