String (PsiExpression expression, boolean tokenTypeAndAnd, CommentTracker tracker) { if (BoolUtils.isNegation(expression)) { final PsiExpression negatedExpression = BoolUtils.getNegated(expression); if (negatedExpression == null) { return ""; } if (negatedExpression instanceof PsiLiteralExpression) { return safeText(negatedExpression); } return tracker.text(negatedExpression, tokenTypeAndAnd ? ParenthesesUtils.OR_PRECEDENCE : ParenthesesUtils.AND_PRECEDENCE); } else if (ComparisonUtils.isComparison(expression)) { final PsiBinaryExpression binaryExpression = (PsiBinaryExpression)expression; final String negatedComparison = ComparisonUtils.getNegatedComparison(binaryExpression.getOperationTokenType()); final PsiExpression lhs = binaryExpression.getLOperand(); final PsiExpression rhs = binaryExpression.getROperand(); if (rhs != null) { final String lhsText = lhs instanceof PsiLiteralExpression ? safeText(lhs) : tracker.text(lhs); final String rhsText = rhs instanceof PsiLiteralExpression ? safeText(rhs) : tracker.text(rhs); return lhsText + negatedComparison + rhsText; } } if (expression instanceof PsiLiteralExpression) { return '!' + safeText(expression); } return '!' + tracker.text(expression, ParenthesesUtils.PREFIX_PRECEDENCE); }