String (GrExpression condition) { if (BoolUtils.isNegation(condition)) { final GrExpression negated = BoolUtils.getNegated(condition); if (ParenthesesUtils.getPrecedence(negated) > ParenthesesUtils.OR_PRECEDENCE) { return '(' + negated.getText() + ')'; } return negated.getText(); } else if (ComparisonUtils.isComparison(condition)) { final GrBinaryExpression binaryExpression = (GrBinaryExpression)condition; final IElementType sign = binaryExpression.getOperationTokenType(); final String negatedComparison = ComparisonUtils.getNegatedComparison(sign); final GrExpression lhs = binaryExpression.getLeftOperand(); final GrExpression rhs = binaryExpression.getRightOperand(); assert rhs != null; return lhs.getText() + negatedComparison + rhs.getText(); } else if (ParenthesesUtils.getPrecedence(condition) > ParenthesesUtils.PREFIX_PRECEDENCE) { return "!(" + condition.getText() + ')'; } else { return '!' + condition.getText(); } }