LongRangeSet (@NotNull PsiExpression nonConstantOperand) { final PsiBinaryExpression binOp = tryCast(PsiUtil.skipParenthesizedExprUp(nonConstantOperand.getParent()), PsiBinaryExpression.class); if (binOp == null) return null; final PsiJavaToken sign = binOp.getOperationSign(); final IElementType tokenType = sign.getTokenType(); RelationType relation = DfaPsiUtil.getRelationByToken(tokenType); if (relation == null) return null; final PsiExpression constOperand = PsiTreeUtil.isAncestor(binOp.getLOperand(), nonConstantOperand, false) ? binOp.getROperand() : binOp.getLOperand(); if (constOperand == null) return null; final Object constantExpression = ExpressionUtils.computeConstantExpression(constOperand); if (!(constantExpression instanceof Integer) && !(constantExpression instanceof Long)) return null; long value = ((Number)constantExpression).longValue(); boolean yodaCondition = constOperand == binOp.getLOperand(); if (yodaCondition) { relation = relation.getFlipped(); } return LongRangeSet.point(value).fromRelation(relation); }