private static int calcFinalEscapedStringCount(final String name, final EscapeInfoProvider p) {
    int result = 0;
    for (int i = 0; i < name.length(); i++) {
      char c = name.charAt(i);
      if (p.escape(c) != 0) {
        result += 2;
      }
      else {
        result += 1;
      }
    }

    return result;
  }
private static int calcFinalEscapedStringCount(final String name, final EscapeInfoProvider p)