private String attemptToChooseFormattingPattern(){
  if (nationalNumber.length() >= MIN_LEADING_DIGITS_LENGTH) {
    getAvailableFormats(nationalNumber.toString());
    String formattedNumber=attemptToFormatAccruedDigits();
    if (formattedNumber.length() > 0) {
      return formattedNumber;
    }
    return maybeCreateNewTemplate() ? inputAccruedNationalNumber() : accruedInput.toString();
  }
 else {
    return appendNationalNumber(nationalNumber.toString());
  }
}

private String attemptToChooseFormattingPattern ( ) { if ( nationalNumber . length ( ) >= MIN_LEADING_DIGITS_LENGTH ) { getAvailableFormats ( nationalNumber . toString ( ) ) ; String formattedNumber = attemptToFormatAccruedDigits ( ) ; if ( formattedNumber . length ( ) > 0 ) { return formattedNumber ; } return maybeCreateNewTemplate ( ) ? inputAccruedNationalNumber ( ) : accruedInput . toString ( ) ; } else { return appendNationalNumber ( nationalNumber . toString ( ) ) ; } }
attempts to set the formatting template and returns a string which contains the formatted version of the digits entered so far .
