and.visitChildren(this);
try {
if (isConstant(and.getLeftArg()) && isConstant(and.getRightArg())) {
boolean value = strategy.isTrue(and, EmptyBindingSet.getInstance());
and.replaceWith(new ValueConstant(BooleanLiteralImpl.valueOf(value)));
}
else if (isConstant(and.getLeftArg())) {
boolean leftIsTrue = strategy.isTrue(and.getLeftArg(), EmptyBindingSet.getInstance());
if (leftIsTrue) {
and.replaceWith(and.getRightArg());
}
else {
and.replaceWith(new ValueConstant(BooleanLiteralImpl.FALSE));
}
}
else if (isConstant(and.getRightArg())) {
boolean rightIsTrue = strategy.isTrue(and.getRightArg(), EmptyBindingSet.getInstance());
if (rightIsTrue) {
and.replaceWith(and.getLeftArg());
}
else {
and.replaceWith(new ValueConstant(BooleanLiteralImpl.FALSE));
}
}
}
catch (ValueExprEvaluationException e) {
logger.warn("Failed to evaluate BinaryValueOperator with two constant arguments", e);