public class Expression extends NonStatement implements IExpression
This AST element is used to represent arithmetic or logical expressions.
An expression consists of one or two members (the left and right members) and an operator. The left member is optional, and should be null for unary operators.
Examples:
a + 1
a * ((int)b - foo())
!x
x ^ y | z
Note: Currently, expressions are read-only elements.
Operator
Modifier and Type | Method and Description |
---|---|
static Expression |
build(IExpression left,
Operator operator,
IExpression right)
Create an expression.
|
IExpression |
getLeft()
Get the left sub-expression.
|
Operator |
getOperator()
Get the expression's operator.
|
IExpression |
getRight()
Get the right sub-expression.
|
attachTag, getSubElements, replaceSubElement, retrieveTag
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
attachTag, getSubElements, replaceSubElement, retrieveTag
public static Expression build(IExpression left, Operator operator, IExpression right)
Create an expression.
left
- optional left expression, should be null if the operator is a unary operatoroperator
- the operatorright
- mandatory right expressionpublic IExpression getLeft()
Get the left sub-expression.
public IExpression getRight()
Get the right sub-expression.
public Operator getOperator()
Get the expression's operator.