boolean (PsiExpression expression, boolean equals, PsiExpression part1, PsiExpression part2) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (!(expression instanceof PsiBinaryExpression binaryExpression)) { return false; } if (equals) { if (!JavaTokenType.EQEQ.equals(binaryExpression.getOperationTokenType())) { return false; } } else { if (!JavaTokenType.NE.equals(binaryExpression.getOperationTokenType())) { return false; } } final PsiExpression leftOperand = binaryExpression.getLOperand(); final PsiExpression rightOperand = binaryExpression.getROperand(); return EQUIVALENCE.expressionsAreEquivalent(leftOperand, part1) && EQUIVALENCE.expressionsAreEquivalent(rightOperand, part2) || EQUIVALENCE.expressionsAreEquivalent(leftOperand, part2) && EQUIVALENCE.expressionsAreEquivalent(rightOperand, part1); }