public class ConditionalExpression extends NonStatement implements IExpression
This AST element is used to represent conditional expressions.
Conditional expressions in Java use the ternary operator ?:
Examples:
a ? b : c
Note: Currently, conditional expressions are read-only elements.
Modifier and Type | Method and Description |
---|---|
static ConditionalExpression |
build(IExpression left,
IExpression right0,
IExpression right1)
Create a conditional expression.
|
IExpression |
getLeft()
Get the 'condition' left expression.
|
IExpression |
getRight0()
Get the 'evaluated on true' right expression.
|
IExpression |
getRight1()
Get the 'evaluated on false' right expression.
|
attachTag, getSubElements, replaceSubElement, retrieveTag
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
attachTag, getSubElements, replaceSubElement, retrieveTag
public static ConditionalExpression build(IExpression left, IExpression right0, IExpression right1)
Create a conditional expression. The expression is the following: left ? right0 : right1
.
left
- the mandatory 'condition' left expressionright0
- the mandatory 'evaluated on true' right expressionright1
- the mandatory 'evaluated on false' right expressionpublic IExpression getLeft()
Get the 'condition' left expression.
public IExpression getRight0()
Get the 'evaluated on true' right expression.
public IExpression getRight1()
Get the 'evaluated on false' right expression.