void (@NotNull Project project, @NotNull PsiElement expression, @NotNull ModPsiUpdater updater) { CommentTracker tracker = new CommentTracker(); if (expression instanceof PsiPrefixExpression prefixExpression) { final PsiExpression operand = PsiUtil.skipParenthesizedExprDown(prefixExpression.getOperand()); PsiReplacementUtil.replaceExpression(prefixExpression, BoolUtils.getNegatedExpressionText(operand, tracker), tracker); } else if (expression instanceof PsiPolyadicExpression polyadicExpression) { final PsiExpression[] operands = polyadicExpression.getOperands(); final int length = operands.length; if (length == 2) { final PsiExpression firstOperand = operands[0]; final PsiExpression secondOperand = operands[1]; if (isNegation(firstOperand)) { PsiReplacementUtil .replaceExpression(polyadicExpression, BoolUtils.getNegatedExpressionText(firstOperand, tracker) + "==" + tracker.text(secondOperand), tracker); } else { PsiReplacementUtil .replaceExpression(polyadicExpression, tracker.text(firstOperand) + "==" + BoolUtils.getNegatedExpressionText(secondOperand, tracker), tracker); } } else { final StringBuilder newExpressionText = new StringBuilder(); for (int i = 0; i < length; i++) { if (i > 0) { if (length % 2 != 1 && i == length - 1) { newExpressionText.append("!="); } else { newExpressionText.append("=="); } } newExpressionText.append(tracker.text(operands[i])); } PsiReplacementUtil.replaceExpression(polyadicExpression, newExpressionText.toString(), tracker); } } }