int (PsiIfStatement statement) { final PsiStatement branch = statement.getElseBranch(); if (branch == null) { return 1; } if (!(branch instanceof PsiIfStatement)) { return 2; } return 1 + calculateBranchCount((PsiIfStatement)branch); }