ConditionType (@Nullable PsiExpression condition, @NotNull PsiVariable variable) { PsiBinaryExpression binaryExpression = tryCast(condition, PsiBinaryExpression.class); if (binaryExpression == null) return ConditionType.Unknown; IElementType tokenType = binaryExpression.getOperationTokenType(); ConditionType type = ConditionType.Unknown; if (tokenType == JavaTokenType.GT || tokenType == JavaTokenType.GE) { type = ConditionType.VarGreater; } else if (tokenType == JavaTokenType.LT || tokenType == JavaTokenType.LE) { type = ConditionType.VarLower; } if (type != ConditionType.Unknown) { PsiExpression lOperand = binaryExpression.getLOperand(); if (!ExpressionUtils.isReferenceTo(lOperand, variable)) { if (ExpressionUtils.isReferenceTo(binaryExpression.getROperand(), variable)) { type = type.inverted(); } else { type = ConditionType.Unknown; } } } return type; }