@NotNull
    private static CommonPartType getType(@NotNull List<? extends ExtractionUnit> headStatements,
                                          List<? extends PsiStatement> tailStatements,
                                          boolean declarationsAreEquivalent,
                                          int thenLen,
                                          int elseLen,
                                          @NotNull PsiStatement thenBranch,
                                          @NotNull PsiStatement elseBranch) {
      if (declarationsAreEquivalent) {
        int duplicatedStatements = headStatements.size() + tailStatements.size();
        if (thenLen == duplicatedStatements && elseLen == duplicatedStatements) {
          return CommonPartType.COMPLETE_DUPLICATE;
        }
        if (canRemoveBranch(thenLen, thenBranch, duplicatedStatements)) return CommonPartType.WHOLE_BRANCH;
        if (canRemoveBranch(elseLen, elseBranch, duplicatedStatements)) return CommonPartType.WHOLE_BRANCH;
      }
      boolean hasVariables = false;
      boolean hasNonVariables = false;
      for (ExtractionUnit unit : headStatements) {
        if (unit.getThenStatement() instanceof PsiDeclarationStatement) {
          hasVariables = true;
        }
        else {
          hasNonVariables = true;
        }
        if (hasVariables && hasNonVariables) break;
      }
      if (!(hasVariables && hasNonVariables)) {
        for (PsiStatement statement : tailStatements) {
          if (statement instanceof PsiDeclarationStatement) {
            hasVariables = true;
          }
          else {
            hasNonVariables = true;
          }
          if (hasVariables && hasNonVariables) break;
        }
      }
      if (hasVariables && hasNonVariables) {
        return CommonPartType.WITH_VARIABLES_EXTRACT;
      }
      if (hasVariables) {
        return CommonPartType.VARIABLES_ONLY;
      }
      return CommonPartType.WITHOUT_VARIABLES_EXTRACT;
    }
@NotNull
    private static CommonPartType getType(@NotNull List<? extends ExtractionUnit> headStatements,
                                          List<? extends PsiStatement> tailStatements,
                                          boolean declarationsAreEquivalent,
                                          int thenLen,
                                          int elseLen,
                                          @NotNull PsiStatement thenBranch,
                                          @NotNull PsiStatement elseBranch)