boolean (@NotNull Number wantedValue) { if (!(myChainExpression instanceof PsiExpression)) return false; PsiMethodCallExpression call = ExpressionUtils.getCallForQualifier((PsiExpression)myChainExpression); if (call == null || call.getParent() instanceof PsiExpressionStatement || !"orElse".equals(call.getMethodExpression().getReferenceName())) { return false; } PsiExpression[] args = call.getArgumentList().getExpressions(); if (args.length == 1 && wantedValue.equals(ExpressionUtils.computeConstantExpression(args[0]))) { myChainExpression = call; return true; } return false; }