public class Predicate extends Expression
This AST element is used to represent predicates.
A predicate is a boolean Expression
. It evaluates to true or false.
Note: Currently, logical expressions using non short-circuiting operators OR (|), AND (&), or XOR(^) are not allowed.
Operator
,
IfStm
,
WhileStm
,
DoWhileStm
,
ForStm
Modifier and Type | Method and Description |
---|---|
static Predicate |
build(IExpression left,
Operator operator,
IExpression right)
Create a new predicate expression.
|
boolean |
isLitteralFalse()
Determine if the predicate represents the simple literal value 'false' (
null IDENT 'false' ). |
boolean |
isLitteralTrue()
Determine if the predicate represents the simple literal value 'true' (
null IDENT 'true' ). |
void |
reverse()
Reverse the predicate.
|
getLeft, getOperator, getRight
attachTag, getSubElements, replaceSubElement, retrieveTag
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
attachTag, getSubElements, replaceSubElement, retrieveTag
public static Predicate build(IExpression left, Operator operator, IExpression right)
Create a new predicate expression.
left
- optional left expression, should be null if the operator is a unary operatoroperator
- a logical operator. Currently, only one of the following 11 logical operators is allowed:
LOG_IDENT, LOG_NOT, LOG_OR, LOG_AND, INSTANCEOF, EQ, NE, LT, GE, GT, LE
.right
- mandatory right expressionpublic boolean isLitteralTrue()
Determine if the predicate represents the simple literal value 'true' (null IDENT 'true'
).
public boolean isLitteralFalse()
Determine if the predicate represents the simple literal value 'false' (null IDENT 'false'
).
public void reverse()
Reverse the predicate.