Browse Source

Remove protobuf-javanano dependency (#1348)

We remove the dependency on protobuf (protobuf-javanano) from the Java library, resurrecting java/libphonenumber/src/com/google/i18n/phonenumbers/Phonemetadata.java which was present until libphonenumber-7.1.1.

Does not affect the C++ or JavaScript libraries.
pull/1349/head
Keghani Kouzoujian 9 years ago
committed by lararennie
parent
commit
96d90b1b1a
605 changed files with 31110 additions and 30536 deletions
  1. +9
    -1
      .travis.yml
  2. +832
    -769
      cpp/src/phonenumbers/alternate_format.cc
  3. +11749
    -11450
      cpp/src/phonenumbers/lite_metadata.cc
  4. +12511
    -12212
      cpp/src/phonenumbers/metadata.cc
  5. +3178
    -3142
      cpp/src/phonenumbers/short_metadata.cc
  6. +875
    -846
      cpp/src/phonenumbers/test_metadata.cc
  7. BIN
      java/carrier/src/com/google/i18n/phonenumbers/carrier/data/config
  8. BIN
      java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config
  9. BIN
      java/lib/protobuf-javanano-3.0.0-alpha-7.jar
  10. +0
    -54
      java/lib/protobuf-javanano-readme.md
  11. +0
    -9
      java/libphonenumber/pom.xml
  12. +27
    -30
      java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java
  13. +15
    -43
      java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataManager.java
  14. +1
    -1
      java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataSource.java
  15. +12
    -9
      java/libphonenumber/src/com/google/i18n/phonenumbers/MultiFileMetadataSourceImpl.java
  16. +8
    -8
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java
  17. +97
    -113
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  18. +1119
    -0
      java/libphonenumber/src/com/google/i18n/phonenumbers/Phonemetadata.java
  19. +28
    -28
      java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberInfo.java
  20. +8
    -9
      java/libphonenumber/src/com/google/i18n/phonenumbers/SingleFileMetadataSourceImpl.java
  21. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_255
  22. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_27
  23. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_30
  24. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_31
  25. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_34
  26. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_350
  27. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_351
  28. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_352
  29. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_358
  30. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_359
  31. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_36
  32. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_372
  33. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_373
  34. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_380
  35. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_381
  36. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_385
  37. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_43
  38. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_44
  39. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_49
  40. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_505
  41. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_506
  42. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_54
  43. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_55
  44. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_58
  45. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_595
  46. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_61
  47. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_62
  48. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_63
  49. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_66
  50. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_675
  51. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_676
  52. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_679
  53. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_7
  54. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_81
  55. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_84
  56. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_855
  57. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_90
  58. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_91
  59. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_94
  60. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_95
  61. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_971
  62. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_972
  63. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_995
  64. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_800
  65. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_808
  66. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_870
  67. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_878
  68. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_881
  69. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_882
  70. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_883
  71. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_888
  72. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_979
  73. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC
  74. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD
  75. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE
  76. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF
  77. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG
  78. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI
  79. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL
  80. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM
  81. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO
  82. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR
  83. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS
  84. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT
  85. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU
  86. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW
  87. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AX
  88. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ
  89. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA
  90. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB
  91. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD
  92. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE
  93. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
  94. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG
  95. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH
  96. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI
  97. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ
  98. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL
  99. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM
  100. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN

+ 9
- 1
.travis.yml View File

@ -1,5 +1,13 @@
language: java
install:
# Invoke the "travis" profile during Maven steps; see <profile> in pom.xml
# files. This is configured not to build the "cpp-build" module.
# The "mvn install" command will run by default during the "install" phase by
# Travis, without the profile flag. Here we customize the install phase to use
# the relevant profile. If we want to build "cpp-build" with Travis CI it's safe
# to remove this line entirely.
- mvn install -P travis -DskipTests=true -Dmaven.javadoc.skip=true -B -V
script:
- mvn test
- mvn -P travis test
- ant clean -f java/build.xml && ant jar -f java/build.xml
- ant junit -f java/build.xml

+ 832
- 769
cpp/src/phonenumbers/alternate_format.cc
File diff suppressed because it is too large
View File


+ 11749
- 11450
cpp/src/phonenumbers/lite_metadata.cc
File diff suppressed because it is too large
View File


+ 12511
- 12212
cpp/src/phonenumbers/metadata.cc
File diff suppressed because it is too large
View File


+ 3178
- 3142
cpp/src/phonenumbers/short_metadata.cc
File diff suppressed because it is too large
View File


+ 875
- 846
cpp/src/phonenumbers/test_metadata.cc
File diff suppressed because it is too large
View File


BIN
java/carrier/src/com/google/i18n/phonenumbers/carrier/data/config View File


BIN
java/geocoder/src/com/google/i18n/phonenumbers/geocoding/data/config View File


BIN
java/lib/protobuf-javanano-3.0.0-alpha-7.jar View File


+ 0
- 54
java/lib/protobuf-javanano-readme.md View File

@ -1,54 +0,0 @@
# How to regenerate `Phonemetadata.java`
You need to re-generate
`java/libphonenumber/src/com/google/i18n/phonenumbers/nano/Phonemetadata.java` if you update
`resources/phonemetadata.proto` or the protobuf version.
Here are convenience instructions to update `Phonemetadata.java`.
Checklist:
- Are we still depending on Maven's 3.0.0-alpha-7 version of com.google.protobuf.nano
protobuf-javanano?
- Are you on a Linux x86_64 architecture? Check via the `arch` command in your terminal.
If you answered no to any question, refer instead to the full instructions, [How to update the
protobuf version](#how-to-update-the-protobuf-version).
```
mkdir /tmp/custom_protoc/ && \
cd /tmp/custom_protoc/ && \
wget https://github.com/google/protobuf/releases/download/v3.0.0-beta-4/protoc-3.0.0-beta-4-linux-x86_64.zip && \
unzip protoc-3.0.0-beta-4-linux-x86_64.zip
```
Then go to the root of your libphonenumber git repository and run:
```
/tmp/custom_protoc/bin/protoc --javanano_out=java/libphonenumber/src \
resources/phonemetadata.proto \
--proto_path=resources
```
# How to update the protobuf version
- Start by finding a protobuf library version released to Maven Central that has functionality you
need, e.g. nano. See http://mvnrepository.com/artifact/com.google.protobuf.
- Update the protobuf library dependency's `groupId`, `artifactId`, and `version` to match this
artifact in all the `pom.xml` files. You can find the files by searching for
`<groupId>com.google.protobuf` in the GitHub repository.
- Download the `.jar` from the Maven Repository,
e.g. from http://repo1.maven.org/maven2/com/google/protobuf/nano/protobuf-javanano/3.0.0-alpha-7/,
and copy to `java/lib/`, replacing the previous version's `.jar`.
- See https://github.com/google/protobuf/releases for the release containing the chosen version, and
download the `protoc` binary for your machine's architecture from the same release and use this to
re-generate `java/libphonenumber/src/com/google/i18n/phonenumbers/nano/Phonemetadata.java` and
check in any changes to this file. The command from the root directory is:
```
protoc --javanano_out=java/libphonenumber/src \
resources/phonemetadata.proto \
--proto_path=resources
```
- Update the convenience instructions, [How to regenerate `Phonemetadata.java`]
(#how-to-regenerate-phonemetadatajava).

+ 0
- 9
java/libphonenumber/pom.xml View File

@ -52,13 +52,4 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.protobuf.nano</groupId>
<artifactId>protobuf-javanano</artifactId>
<!-- If updating the version, see instructions in java/lib/protobuf-javanano-readme.md. -->
<version>3.0.0-alpha-7</version>
</dependency>
</dependencies>
</project>

+ 27
- 30
java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java View File

@ -16,8 +16,8 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.nano.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import java.util.ArrayList;
import java.util.Iterator;
@ -61,11 +61,8 @@ public class AsYouTypeFormatter {
// Character used when appropriate to separate a prefix, such as a long NDD or a country calling
// code, from the national number.
private static final char SEPARATOR_BEFORE_NATIONAL_NUMBER = ' ';
private static final PhoneMetadata EMPTY_METADATA;
static {
EMPTY_METADATA = new PhoneMetadata();
EMPTY_METADATA.internationalPrefix = "NA";
}
private static final PhoneMetadata EMPTY_METADATA =
new PhoneMetadata().setInternationalPrefix("NA");
private PhoneMetadata defaultMetadata;
private PhoneMetadata currentMetadata;
@ -154,7 +151,7 @@ public class AsYouTypeFormatter {
Iterator<NumberFormat> it = possibleFormats.iterator();
while (it.hasNext()) {
NumberFormat numberFormat = it.next();
String pattern = numberFormat.pattern;
String pattern = numberFormat.getPattern();
if (currentFormattingPattern.equals(pattern)) {
return false;
}
@ -162,7 +159,7 @@ public class AsYouTypeFormatter {
currentFormattingPattern = pattern;
shouldAddSpaceAfterNationalPrefix =
NATIONAL_PREFIX_SEPARATORS_PATTERN.matcher(
numberFormat.nationalPrefixFormattingRule).find();
numberFormat.getNationalPrefixFormattingRule()).find();
// With a new formatting template, the matched position using the old template needs to be
// reset.
lastMatchPosition = 0;
@ -176,17 +173,17 @@ public class AsYouTypeFormatter {
}
private void getAvailableFormats(String leadingDigits) {
NumberFormat[] numberFormats =
(isCompleteNumber && currentMetadata.intlNumberFormat.length > 0)
? currentMetadata.intlNumberFormat
: currentMetadata.numberFormat;
boolean nationalPrefixIsUsedByCountry = (!currentMetadata.nationalPrefix.equals(""));
for (NumberFormat format : numberFormats) {
List<NumberFormat> formatList =
(isCompleteNumber && currentMetadata.intlNumberFormatSize() > 0)
? currentMetadata.intlNumberFormats()
: currentMetadata.numberFormats();
boolean nationalPrefixIsUsedByCountry = currentMetadata.hasNationalPrefix();
for (NumberFormat format : formatList) {
if (!nationalPrefixIsUsedByCountry || isCompleteNumber ||
format.nationalPrefixOptionalWhenFormatting ||
format.isNationalPrefixOptionalWhenFormatting() ||
PhoneNumberUtil.formattingRuleHasFirstGroupOnly(
format.nationalPrefixFormattingRule)) {
if (isFormatEligible(format.format)) {
format.getNationalPrefixFormattingRule())) {
if (isFormatEligible(format.getFormat())) {
possibleFormats.add(format);
}
}
@ -203,14 +200,14 @@ public class AsYouTypeFormatter {
Iterator<NumberFormat> it = possibleFormats.iterator();
while (it.hasNext()) {
NumberFormat format = it.next();
if (format.leadingDigitsPattern.length == 0) {
if (format.leadingDigitsPatternSize() == 0) {
// Keep everything that isn't restricted by leading digits.
continue;
}
int lastLeadingDigitsPattern =
Math.min(indexOfLeadingDigitsPattern, format.leadingDigitsPattern.length - 1);
Math.min(indexOfLeadingDigitsPattern, format.leadingDigitsPatternSize() - 1);
Pattern leadingDigitsPattern = regexCache.getPatternForRegex(
format.leadingDigitsPattern[lastLeadingDigitsPattern]);
format.getLeadingDigitsPattern(lastLeadingDigitsPattern));
Matcher m = leadingDigitsPattern.matcher(leadingDigits);
if (!m.lookingAt()) {
it.remove();
@ -219,7 +216,7 @@ public class AsYouTypeFormatter {
}
private boolean createFormattingTemplate(NumberFormat format) {
String numberPattern = format.pattern;
String numberPattern = format.getPattern();
// The formatter doesn't format numbers when numberPattern contains "|", e.g.
// (20|3)\d{4}. In those cases we quickly return.
@ -233,7 +230,7 @@ public class AsYouTypeFormatter {
// Replace any standalone digit (not the one in d{}) with \d
numberPattern = STANDALONE_DIGIT_PATTERN.matcher(numberPattern).replaceAll("\\\\d");
formattingTemplate.setLength(0);
String tempTemplate = getFormattingTemplate(numberPattern, format.format);
String tempTemplate = getFormattingTemplate(numberPattern, format.getFormat());
if (tempTemplate.length() > 0) {
formattingTemplate.append(tempTemplate);
return true;
@ -431,12 +428,12 @@ public class AsYouTypeFormatter {
*/
String attemptToFormatAccruedDigits() {
for (NumberFormat numberFormat : possibleFormats) {
Matcher m = regexCache.getPatternForRegex(numberFormat.pattern).matcher(nationalNumber);
Matcher m = regexCache.getPatternForRegex(numberFormat.getPattern()).matcher(nationalNumber);
if (m.matches()) {
shouldAddSpaceAfterNationalPrefix =
NATIONAL_PREFIX_SEPARATORS_PATTERN.matcher(
numberFormat.nationalPrefixFormattingRule).find();
String formattedNumber = m.replaceAll(numberFormat.format);
numberFormat.getNationalPrefixFormattingRule()).find();
String formattedNumber = m.replaceAll(numberFormat.getFormat());
return appendNationalNumber(formattedNumber);
}
}
@ -529,7 +526,7 @@ public class AsYouTypeFormatter {
// that national significant numbers in NANPA always start with [2-9] after the national prefix.
// Numbers beginning with 1[01] can only be short/emergency numbers, which don't need the
// national prefix.
return (currentMetadata.countryCode == 1) && (nationalNumber.charAt(0) == '1') &&
return (currentMetadata.getCountryCode() == 1) && (nationalNumber.charAt(0) == '1') &&
(nationalNumber.charAt(1) != '0') && (nationalNumber.charAt(1) != '1');
}
@ -540,9 +537,9 @@ public class AsYouTypeFormatter {
startOfNationalNumber = 1;
prefixBeforeNationalNumber.append('1').append(SEPARATOR_BEFORE_NATIONAL_NUMBER);
isCompleteNumber = true;
} else if (!currentMetadata.nationalPrefixForParsing.equals("")) {
} else if (currentMetadata.hasNationalPrefixForParsing()) {
Pattern nationalPrefixForParsing =
regexCache.getPatternForRegex(currentMetadata.nationalPrefixForParsing);
regexCache.getPatternForRegex(currentMetadata.getNationalPrefixForParsing());
Matcher m = nationalPrefixForParsing.matcher(nationalNumber);
// Since some national prefix patterns are entirely optional, check that a national prefix
// could actually be extracted.
@ -570,7 +567,7 @@ public class AsYouTypeFormatter {
private boolean attemptToExtractIdd() {
Pattern internationalPrefix =
regexCache.getPatternForRegex("\\" + PhoneNumberUtil.PLUS_SIGN + "|" +
currentMetadata.internationalPrefix);
currentMetadata.getInternationalPrefix());
Matcher iddMatcher = internationalPrefix.matcher(accruedInputWithoutFormatting);
if (iddMatcher.lookingAt()) {
isCompleteNumber = true;


+ 15
- 43
java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataManager.java View File

@ -16,16 +16,16 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadataCollection;
import com.google.protobuf.nano.CodedInputByteBufferNano;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadataCollection;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
@ -61,39 +61,13 @@ final class MetadataManager {
private MetadataManager() {
}
// The size of the byte buffer in bytes used to convert a stream containing metadata for a single
// region, to a nanoproto-compatible CodedInputByteBufferNano. This was determined by the size of
// the binary metadata files that contain each region's metadata.
static final int DEFAULT_BUFFER_SIZE = 16 * 1024;
// The size of the byte buffer in bytes used to convert a stream containing metadata for all
// regions, to a nanoproto-compatible CodedInputByteBufferNano. This was determined by the size of
// the binary metadata file that contains all regions' metadata.
static final int ALL_REGIONS_BUFFER_SIZE = 256 * 1024;
static CodedInputByteBufferNano convertStreamToByteBuffer(ObjectInputStream in, int bufferSize)
throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[bufferSize];
while ((nRead = in.read(data, 0, bufferSize)) != -1) {
outputStream.write(data, 0, nRead);
}
outputStream.flush();
return CodedInputByteBufferNano.newInstance(outputStream.toByteArray());
}
/**
* Loads and returns the metadata protocol buffer from the given stream and closes the stream.
* Loads and returns the metadata object from the given stream and closes the stream.
*
* @param source the non-null stream from which metadata is to be read.
* @param bufferSize the size of the buffer in bytes used to convert the stream to a
nanoproto-compatible {@code CodedInputByteBufferNano}.
* @return the loaded metadata protocol buffer.
* @param source the non-null stream from which metadata is to be read
* @return the loaded metadata object
*/
static PhoneMetadataCollection loadMetadataAndCloseInput(InputStream source, int bufferSize) {
static PhoneMetadataCollection loadMetadataAndCloseInput(InputStream source) {
ObjectInputStream ois = null;
try {
try {
@ -103,7 +77,7 @@ final class MetadataManager {
}
PhoneMetadataCollection metadataCollection = new PhoneMetadataCollection();
try {
metadataCollection.mergeFrom(convertStreamToByteBuffer(ois, bufferSize));
metadataCollection.readExternal(ois);
} catch (IOException e) {
throw new RuntimeException("cannot load/parse metadata", e);
}
@ -130,10 +104,9 @@ final class MetadataManager {
// that they are present, by checking the map of available data first.
throw new IllegalStateException("missing metadata: " + fileName);
}
PhoneMetadataCollection alternateFormatData =
loadMetadataAndCloseInput(source, DEFAULT_BUFFER_SIZE);
for (PhoneMetadata metadata : alternateFormatData.metadata) {
callingCodeToAlternateFormatsMap.put(metadata.countryCode, metadata);
PhoneMetadataCollection alternateFormats = loadMetadataAndCloseInput(source);
for (PhoneMetadata metadata : alternateFormats.getMetadataList()) {
callingCodeToAlternateFormatsMap.put(metadata.getCountryCode(), metadata);
}
}
@ -157,10 +130,9 @@ final class MetadataManager {
// that they are present, by checking the map of available data first.
throw new IllegalStateException("missing metadata: " + fileName);
}
PhoneMetadataCollection shortNumberData =
loadMetadataAndCloseInput(source, DEFAULT_BUFFER_SIZE);
for (PhoneMetadata metadata : shortNumberData.metadata) {
regionCodeToShortNumberMetadataMap.put(regionCode, metadata);
PhoneMetadataCollection shortNumberMetadata = loadMetadataAndCloseInput(source);
for (PhoneMetadata metadata : shortNumberMetadata.getMetadataList()) {
regionCodeToShortNumberMetadataMap.put(regionCode, metadata);
}
}


+ 1
- 1
java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataSource.java View File

@ -16,7 +16,7 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
/**
* A source for phone metadata for all regions.


+ 12
- 9
java/libphonenumber/src/com/google/i18n/phonenumbers/MultiFileMetadataSourceImpl.java View File

@ -16,12 +16,16 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadataCollection;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadataCollection;
import java.io.InputStream;
import java.util.concurrent.ConcurrentHashMap;
import java.io.ObjectInputStream;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -116,17 +120,16 @@ final class MultiFileMetadataSourceImpl implements MetadataSource {
// that they are present, by checking the map of available data first.
throw new IllegalStateException("missing metadata: " + fileName);
}
PhoneMetadataCollection metadataCollection =
MetadataManager.loadMetadataAndCloseInput(source, MetadataManager.DEFAULT_BUFFER_SIZE);
PhoneMetadata[] metadatas = metadataCollection.metadata;
if (metadatas.length == 0) {
PhoneMetadataCollection metadataCollection = MetadataManager.loadMetadataAndCloseInput(source);
List<PhoneMetadata> metadataList = metadataCollection.getMetadataList();
if (metadataList.isEmpty()) {
// Sanity check; this should not happen since we build with non-empty metadata.
throw new IllegalStateException("empty metadata: " + fileName);
}
if (metadatas.length > 1) {
if (metadataList.size() > 1) {
logger.log(Level.WARNING, "invalid metadata (too many entries): " + fileName);
}
PhoneMetadata metadata = metadatas[0];
PhoneMetadata metadata = metadataList.get(0);
PhoneMetadata oldValue = map.putIfAbsent(key, metadata);
return (oldValue != null) ? oldValue : metadata;
}


+ 8
- 8
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java View File

@ -19,10 +19,10 @@ package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.PhoneNumberUtil.Leniency;
import com.google.i18n.phonenumbers.PhoneNumberUtil.MatchType;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
import com.google.i18n.phonenumbers.nano.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import java.lang.Character.UnicodeBlock;
import java.util.Iterator;
@ -585,7 +585,7 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
PhoneMetadata alternateFormats =
MetadataManager.getAlternateFormatsForCountry(number.getCountryCode());
if (alternateFormats != null) {
for (NumberFormat alternateFormat : alternateFormats.numberFormat) {
for (NumberFormat alternateFormat : alternateFormats.numberFormats()) {
formattedNumberGroups = getNationalNumberGroups(util, number, alternateFormat);
if (checker.checkGroups(util, number, normalizedCandidate, formattedNumberGroups)) {
return true;
@ -665,17 +665,17 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
// Check if a national prefix should be present when formatting this number.
String nationalNumber = util.getNationalSignificantNumber(number);
NumberFormat formatRule =
util.chooseFormattingPatternForNumber(metadata.numberFormat, nationalNumber);
util.chooseFormattingPatternForNumber(metadata.numberFormats(), nationalNumber);
// To do this, we check that a national prefix formatting rule was present and that it wasn't
// just the first-group symbol ($1) with punctuation.
if ((formatRule != null) && formatRule.nationalPrefixFormattingRule.length() > 0) {
if (formatRule.nationalPrefixOptionalWhenFormatting) {
if ((formatRule != null) && formatRule.getNationalPrefixFormattingRule().length() > 0) {
if (formatRule.isNationalPrefixOptionalWhenFormatting()) {
// The national-prefix is optional in these cases, so we don't need to check if it was
// present.
return true;
}
if (PhoneNumberUtil.formattingRuleHasFirstGroupOnly(
formatRule.nationalPrefixFormattingRule)) {
formatRule.getNationalPrefixFormattingRule())) {
// National Prefix not needed for this number.
return true;
}


+ 97
- 113
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -16,11 +16,11 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneNumberDesc;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource;
import com.google.i18n.phonenumbers.nano.Phonemetadata.NumberFormat;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneNumberDesc;
import java.io.InputStream;
import java.util.ArrayList;
@ -612,24 +612,6 @@ public class PhoneNumberUtil {
nanpaRegions.addAll(countryCallingCodeToRegionCodeMap.get(NANPA_COUNTRY_CODE));
}
/**
* Returns a copy of the given NumberFormat object.
*/
static NumberFormat copyNumberFormat(NumberFormat other) {
NumberFormat copy = new NumberFormat();
copy.pattern = other.pattern;
copy.format = other.format;
int leadingDigitsPatternSize = other.leadingDigitsPattern.length;
copy.leadingDigitsPattern = new String[leadingDigitsPatternSize];
for (int i = 0; i < leadingDigitsPatternSize; i++) {
copy.leadingDigitsPattern[i] = other.leadingDigitsPattern[i];
}
copy.nationalPrefixFormattingRule = other.nationalPrefixFormattingRule;
copy.domesticCarrierCodeFormattingRule = other.domesticCarrierCodeFormattingRule;
copy.nationalPrefixOptionalWhenFormatting = other.nationalPrefixOptionalWhenFormatting;
return copy;
}
/**
* Attempts to extract a possible number from the string passed in. This currently strips all
* leading characters that cannot be used to start a phone number. Characters that can be used to
@ -813,7 +795,7 @@ public class PhoneNumberUtil {
}
// If a country doesn't use a national prefix, and this number doesn't have an Italian leading
// zero, we assume it is a closed dialling plan with no area codes.
if (metadata.nationalPrefix.equals("") && !number.isItalianLeadingZero()) {
if (!metadata.hasNationalPrefix() && !number.isItalianLeadingZero()) {
return 0;
}
@ -1172,29 +1154,29 @@ public class PhoneNumberUtil {
StringBuilder formattedNumber = new StringBuilder(20);
NumberFormat formattingPattern =
chooseFormattingPatternForNumber(userDefinedFormats.toArray(
new NumberFormat[userDefinedFormats.size()]), nationalSignificantNumber);
chooseFormattingPatternForNumber(userDefinedFormats, nationalSignificantNumber);
if (formattingPattern == null) {
// If no pattern above is matched, we format the number as a whole.
formattedNumber.append(nationalSignificantNumber);
} else {
NumberFormat numFormatCopy = new NumberFormat();
// Before we do a replacement of the national prefix pattern $NP with the national prefix, we
// need to copy the rule so that subsequent replacements for different numbers have the
// appropriate national prefix.
NumberFormat numFormatCopy = copyNumberFormat(formattingPattern);
String nationalPrefixFormattingRule = formattingPattern.nationalPrefixFormattingRule;
numFormatCopy.mergeFrom(formattingPattern);
String nationalPrefixFormattingRule = formattingPattern.getNationalPrefixFormattingRule();
if (nationalPrefixFormattingRule.length() > 0) {
String nationalPrefix = metadata.nationalPrefix;
String nationalPrefix = metadata.getNationalPrefix();
if (nationalPrefix.length() > 0) {
// Replace $NP with national prefix and $FG with the first group ($1).
nationalPrefixFormattingRule =
NP_PATTERN.matcher(nationalPrefixFormattingRule).replaceFirst(nationalPrefix);
nationalPrefixFormattingRule =
FG_PATTERN.matcher(nationalPrefixFormattingRule).replaceFirst("\\$1");
numFormatCopy.nationalPrefixFormattingRule = nationalPrefixFormattingRule;
numFormatCopy.setNationalPrefixFormattingRule(nationalPrefixFormattingRule);
} else {
// We don't want to have a rule for how to format the national prefix if there isn't one.
numFormatCopy.nationalPrefixFormattingRule = "";
numFormatCopy.clearNationalPrefixFormattingRule();
}
}
formattedNumber.append(
@ -1410,16 +1392,16 @@ public class PhoneNumberUtil {
}
// Metadata cannot be null because we checked 'isValidRegionCode()' above.
PhoneMetadata metadataForRegionCallingFrom = getMetadataForRegion(regionCallingFrom);
String internationalPrefix = metadataForRegionCallingFrom.internationalPrefix;
String internationalPrefix = metadataForRegionCallingFrom.getInternationalPrefix();
// For regions that have multiple international prefixes, the international format of the
// number is returned, unless there is a preferred international prefix.
String internationalPrefixForFormatting = "";
if (UNIQUE_INTERNATIONAL_PREFIX.matcher(internationalPrefix).matches()) {
internationalPrefixForFormatting = internationalPrefix;
} else if (!metadataForRegionCallingFrom.preferredInternationalPrefix.equals("")) {
} else if (metadataForRegionCallingFrom.hasPreferredInternationalPrefix()) {
internationalPrefixForFormatting =
metadataForRegionCallingFrom.preferredInternationalPrefix;
metadataForRegionCallingFrom.getPreferredInternationalPrefix();
}
String regionCode = getRegionCodeForCountryCode(countryCallingCode);
@ -1505,7 +1487,7 @@ public class PhoneNumberUtil {
PhoneMetadata metadata = getMetadataForRegion(regionCode);
String nationalNumber = getNationalSignificantNumber(number);
NumberFormat formatRule =
chooseFormattingPatternForNumber(metadata.numberFormat, nationalNumber);
chooseFormattingPatternForNumber(metadata.numberFormats(), nationalNumber);
// The format rule could still be null here if the national number was 0 and there was no
// raw input (this should not be possible for numbers generated by the phonenumber library
// as they would also not have a country calling code and we would have exited earlier).
@ -1517,7 +1499,7 @@ public class PhoneNumberUtil {
// return the national format.
// TODO: Refactor the code below with the code in
// isNationalPrefixPresentIfRequired.
String candidateNationalPrefixRule = formatRule.nationalPrefixFormattingRule;
String candidateNationalPrefixRule = formatRule.getNationalPrefixFormattingRule();
// We assume that the first-group symbol will never be _before_ the national prefix.
int indexOfFirstGroup = candidateNationalPrefixRule.indexOf("$1");
if (indexOfFirstGroup <= 0) {
@ -1533,8 +1515,9 @@ public class PhoneNumberUtil {
break;
}
// Otherwise, we need to remove the national prefix from our output.
NumberFormat numFormatCopy = copyNumberFormat(formatRule);
numFormatCopy.nationalPrefixFormattingRule = "";
NumberFormat numFormatCopy = new NumberFormat();
numFormatCopy.mergeFrom(formatRule);
numFormatCopy.clearNationalPrefixFormattingRule();
List<NumberFormat> numberFormats = new ArrayList<NumberFormat>(1);
numberFormats.add(numFormatCopy);
formattedNumber = formatByPattern(number, PhoneNumberFormat.NATIONAL, numberFormats);
@ -1591,7 +1574,7 @@ public class PhoneNumberUtil {
}
String nationalNumber = getNationalSignificantNumber(number);
NumberFormat formatRule =
chooseFormattingPatternForNumber(metadata.numberFormat, nationalNumber);
chooseFormattingPatternForNumber(metadata.numberFormats(), nationalNumber);
return formatRule != null;
}
@ -1655,17 +1638,18 @@ public class PhoneNumberUtil {
} else if (metadataForRegionCallingFrom != null &&
countryCode == getCountryCodeForValidRegion(regionCallingFrom)) {
NumberFormat formattingPattern =
chooseFormattingPatternForNumber(metadataForRegionCallingFrom.numberFormat,
chooseFormattingPatternForNumber(metadataForRegionCallingFrom.numberFormats(),
nationalNumber);
if (formattingPattern == null) {
// If no pattern above is matched, we format the original input.
return rawInput;
}
NumberFormat newFormat = copyNumberFormat(formattingPattern);
NumberFormat newFormat = new NumberFormat();
newFormat.mergeFrom(formattingPattern);
// The first group is the first group of digits that the user wrote together.
newFormat.pattern = "(\\d+)(.*)";
newFormat.setPattern("(\\d+)(.*)");
// Here we just concatenate them back together after the national prefix has been fixed.
newFormat.format = "$1$2";
newFormat.setFormat("$1$2");
// Now we format using this pattern instead of the default pattern, but with the national
// prefix prefixed if necessary.
// This will not work in the cases where the pattern (and not the leading digits) decide
@ -1678,11 +1662,11 @@ public class PhoneNumberUtil {
// prefixes, the international format of the number is returned, unless there is a preferred
// international prefix.
if (metadataForRegionCallingFrom != null) {
String internationalPrefix = metadataForRegionCallingFrom.internationalPrefix;
String internationalPrefix = metadataForRegionCallingFrom.getInternationalPrefix();
internationalPrefixForFormatting =
UNIQUE_INTERNATIONAL_PREFIX.matcher(internationalPrefix).matches()
? internationalPrefix
: metadataForRegionCallingFrom.preferredInternationalPrefix;
: metadataForRegionCallingFrom.getPreferredInternationalPrefix();
}
StringBuilder formattedNumber = new StringBuilder(rawInput);
String regionCode = getRegionCodeForCountryCode(countryCode);
@ -1764,27 +1748,27 @@ public class PhoneNumberUtil {
PhoneMetadata metadata,
PhoneNumberFormat numberFormat,
String carrierCode) {
NumberFormat[] intlNumberFormats = metadata.intlNumberFormat;
List<NumberFormat> intlNumberFormats = metadata.intlNumberFormats();
// When the intlNumberFormats exists, we use that to format national number for the
// INTERNATIONAL format instead of using the numberDesc.numberFormats.
NumberFormat[] availableFormats =
(intlNumberFormats.length == 0 || numberFormat == PhoneNumberFormat.NATIONAL)
? metadata.numberFormat
: metadata.intlNumberFormat;
List<NumberFormat> availableFormats =
(intlNumberFormats.size() == 0 || numberFormat == PhoneNumberFormat.NATIONAL)
? metadata.numberFormats()
: metadata.intlNumberFormats();
NumberFormat formattingPattern = chooseFormattingPatternForNumber(availableFormats, number);
return (formattingPattern == null)
? number
: formatNsnUsingPattern(number, formattingPattern, numberFormat, carrierCode);
}
NumberFormat chooseFormattingPatternForNumber(NumberFormat[] availableFormats,
NumberFormat chooseFormattingPatternForNumber(List<NumberFormat> availableFormats,
String nationalNumber) {
for (NumberFormat numFormat : availableFormats) {
int size = numFormat.leadingDigitsPattern.length;
int size = numFormat.leadingDigitsPatternSize();
if (size == 0 || regexCache.getPatternForRegex(
// We always use the last leading_digits_pattern, as it is the most detailed.
numFormat.leadingDigitsPattern[size - 1]).matcher(nationalNumber).lookingAt()) {
Matcher m = regexCache.getPatternForRegex(numFormat.pattern).matcher(nationalNumber);
numFormat.getLeadingDigitsPattern(size - 1)).matcher(nationalNumber).lookingAt()) {
Matcher m = regexCache.getPatternForRegex(numFormat.getPattern()).matcher(nationalNumber);
if (m.matches()) {
return numFormat;
}
@ -1806,15 +1790,15 @@ public class PhoneNumberUtil {
NumberFormat formattingPattern,
PhoneNumberFormat numberFormat,
String carrierCode) {
String numberFormatRule = formattingPattern.format;
String numberFormatRule = formattingPattern.getFormat();
Matcher m =
regexCache.getPatternForRegex(formattingPattern.pattern).matcher(nationalNumber);
regexCache.getPatternForRegex(formattingPattern.getPattern()).matcher(nationalNumber);
String formattedNationalNumber = "";
if (numberFormat == PhoneNumberFormat.NATIONAL &&
carrierCode != null && carrierCode.length() > 0 &&
formattingPattern.domesticCarrierCodeFormattingRule.length() > 0) {
formattingPattern.getDomesticCarrierCodeFormattingRule().length() > 0) {
// Replace the $CC in the formatting rule with the desired carrier code.
String carrierCodeFormattingRule = formattingPattern.domesticCarrierCodeFormattingRule;
String carrierCodeFormattingRule = formattingPattern.getDomesticCarrierCodeFormattingRule();
carrierCodeFormattingRule =
CC_PATTERN.matcher(carrierCodeFormattingRule).replaceFirst(carrierCode);
// Now replace the $FG in the formatting rule with the first group and the carrier code
@ -1824,7 +1808,7 @@ public class PhoneNumberUtil {
formattedNationalNumber = m.replaceAll(numberFormatRule);
} else {
// Use the national prefix formatting rule instead.
String nationalPrefixFormattingRule = formattingPattern.nationalPrefixFormattingRule;
String nationalPrefixFormattingRule = formattingPattern.getNationalPrefixFormattingRule();
if (numberFormat == PhoneNumberFormat.NATIONAL &&
nationalPrefixFormattingRule != null &&
nationalPrefixFormattingRule.length() > 0) {
@ -1881,11 +1865,11 @@ public class PhoneNumberUtil {
// invalid number.
PhoneNumberDesc desc = getNumberDescByType(getMetadataForRegion(regionCode),
PhoneNumberType.FIXED_LINE);
if (desc.exampleNumber.equals("")) {
if (!desc.hasExampleNumber()) {
// This shouldn't happen; we have a test for this.
return null;
}
String exampleNumber = desc.exampleNumber;
String exampleNumber = desc.getExampleNumber();
// Try and make the number invalid. We do this by changing the length. We try reducing the
// length of the number, since currently no region has a number that is the same length as
// MIN_LENGTH_FOR_NSN. This is probably quicker than making the number longer, which is another
@ -1933,8 +1917,8 @@ public class PhoneNumberUtil {
}
PhoneNumberDesc desc = getNumberDescByType(getMetadataForRegion(regionCode), type);
try {
if (!desc.exampleNumber.equals("")) {
return parse(desc.exampleNumber, regionCode);
if (desc.hasExampleNumber()) {
return parse(desc.getExampleNumber(), regionCode);
}
} catch (NumberParseException e) {
logger.log(Level.SEVERE, e.toString());
@ -1962,8 +1946,8 @@ public class PhoneNumberUtil {
PhoneNumberDesc desc = getNumberDescByType(
getMetadataForNonGeographicalRegion(countryCallingCode), type);
try {
if (!desc.exampleNumber.equals("")) {
return parse("+" + countryCallingCode + desc.exampleNumber, UNKNOWN_REGION);
if (desc.hasExampleNumber()) {
return parse("+" + countryCallingCode + desc.getExampleNumber(), UNKNOWN_REGION);
}
} catch (NumberParseException e) {
logger.log(Level.SEVERE, e.toString());
@ -1984,10 +1968,10 @@ public class PhoneNumberUtil {
public PhoneNumber getExampleNumberForNonGeoEntity(int countryCallingCode) {
PhoneMetadata metadata = getMetadataForNonGeographicalRegion(countryCallingCode);
if (metadata != null) {
PhoneNumberDesc desc = metadata.generalDesc;
PhoneNumberDesc desc = metadata.getGeneralDesc();
try {
if (!desc.exampleNumber.equals("")) {
return parse("+" + countryCallingCode + desc.exampleNumber, UNKNOWN_REGION);
if (desc.hasExampleNumber()) {
return parse("+" + countryCallingCode + desc.getExampleNumber(), UNKNOWN_REGION);
}
} catch (NumberParseException e) {
logger.log(Level.SEVERE, e.toString());
@ -2010,8 +1994,8 @@ public class PhoneNumberUtil {
if (numberFormat == PhoneNumberFormat.RFC3966) {
formattedNumber.append(RFC3966_EXTN_PREFIX).append(number.getExtension());
} else {
if (!metadata.preferredExtnPrefix.equals("")) {
formattedNumber.append(metadata.preferredExtnPrefix).append(number.getExtension());
if (metadata.hasPreferredExtnPrefix()) {
formattedNumber.append(metadata.getPreferredExtnPrefix()).append(number.getExtension());
} else {
formattedNumber.append(DEFAULT_EXTN_PREFIX).append(number.getExtension());
}
@ -2022,28 +2006,28 @@ public class PhoneNumberUtil {
PhoneNumberDesc getNumberDescByType(PhoneMetadata metadata, PhoneNumberType type) {
switch (type) {
case PREMIUM_RATE:
return metadata.premiumRate;
return metadata.getPremiumRate();
case TOLL_FREE:
return metadata.tollFree;
return metadata.getTollFree();
case MOBILE:
return metadata.mobile;
return metadata.getMobile();
case FIXED_LINE:
case FIXED_LINE_OR_MOBILE:
return metadata.fixedLine;
return metadata.getFixedLine();
case SHARED_COST:
return metadata.sharedCost;
return metadata.getSharedCost();
case VOIP:
return metadata.voip;
return metadata.getVoip();
case PERSONAL_NUMBER:
return metadata.personalNumber;
return metadata.getPersonalNumber();
case PAGER:
return metadata.pager;
return metadata.getPager();
case UAN:
return metadata.uan;
return metadata.getUan();
case VOICEMAIL:
return metadata.voicemail;
return metadata.getVoicemail();
default:
return metadata.generalDesc;
return metadata.getGeneralDesc();
}
}
@ -2064,48 +2048,48 @@ public class PhoneNumberUtil {
}
private PhoneNumberType getNumberTypeHelper(String nationalNumber, PhoneMetadata metadata) {
if (!isNumberMatchingDesc(nationalNumber, metadata.generalDesc)) {
if (!isNumberMatchingDesc(nationalNumber, metadata.getGeneralDesc())) {
return PhoneNumberType.UNKNOWN;
}
if (isNumberMatchingDesc(nationalNumber, metadata.premiumRate)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getPremiumRate())) {
return PhoneNumberType.PREMIUM_RATE;
}
if (isNumberMatchingDesc(nationalNumber, metadata.tollFree)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getTollFree())) {
return PhoneNumberType.TOLL_FREE;
}
if (isNumberMatchingDesc(nationalNumber, metadata.sharedCost)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getSharedCost())) {
return PhoneNumberType.SHARED_COST;
}
if (isNumberMatchingDesc(nationalNumber, metadata.voip)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getVoip())) {
return PhoneNumberType.VOIP;
}
if (isNumberMatchingDesc(nationalNumber, metadata.personalNumber)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getPersonalNumber())) {
return PhoneNumberType.PERSONAL_NUMBER;
}
if (isNumberMatchingDesc(nationalNumber, metadata.pager)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getPager())) {
return PhoneNumberType.PAGER;
}
if (isNumberMatchingDesc(nationalNumber, metadata.uan)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getUan())) {
return PhoneNumberType.UAN;
}
if (isNumberMatchingDesc(nationalNumber, metadata.voicemail)) {
if (isNumberMatchingDesc(nationalNumber, metadata.getVoicemail())) {
return PhoneNumberType.VOICEMAIL;
}
boolean isFixedLine = isNumberMatchingDesc(nationalNumber, metadata.fixedLine);
boolean isFixedLine = isNumberMatchingDesc(nationalNumber, metadata.getFixedLine());
if (isFixedLine) {
if (metadata.sameMobileAndFixedLinePattern) {
if (metadata.isSameMobileAndFixedLinePattern()) {
return PhoneNumberType.FIXED_LINE_OR_MOBILE;
} else if (isNumberMatchingDesc(nationalNumber, metadata.mobile)) {
} else if (isNumberMatchingDesc(nationalNumber, metadata.getMobile())) {
return PhoneNumberType.FIXED_LINE_OR_MOBILE;
}
return PhoneNumberType.FIXED_LINE;
}
// Otherwise, test to see if the number is mobile. Only do this if certain that the patterns for
// mobile and fixed line aren't the same.
if (!metadata.sameMobileAndFixedLinePattern &&
isNumberMatchingDesc(nationalNumber, metadata.mobile)) {
if (!metadata.isSameMobileAndFixedLinePattern() &&
isNumberMatchingDesc(nationalNumber, metadata.getMobile())) {
return PhoneNumberType.MOBILE;
}
return PhoneNumberType.UNKNOWN;
@ -2131,14 +2115,14 @@ public class PhoneNumberUtil {
boolean isNumberPossibleForDesc(String nationalNumber, PhoneNumberDesc numberDesc) {
Matcher possibleNumberPatternMatcher =
regexCache.getPatternForRegex(numberDesc.possibleNumberPattern)
regexCache.getPatternForRegex(numberDesc.getPossibleNumberPattern())
.matcher(nationalNumber);
return possibleNumberPatternMatcher.matches();
}
boolean isNumberMatchingDesc(String nationalNumber, PhoneNumberDesc numberDesc) {
Matcher nationalNumberPatternMatcher =
regexCache.getPatternForRegex(numberDesc.nationalNumberPattern)
regexCache.getPatternForRegex(numberDesc.getNationalNumberPattern())
.matcher(nationalNumber);
return isNumberPossibleForDesc(nationalNumber, numberDesc) &&
nationalNumberPatternMatcher.matches();
@ -2217,8 +2201,8 @@ public class PhoneNumberUtil {
// If leadingDigits is present, use this. Otherwise, do full validation.
// Metadata cannot be null because the region codes come from the country calling code map.
PhoneMetadata metadata = getMetadataForRegion(regionCode);
if (!metadata.leadingDigits.equals("")) {
if (regexCache.getPatternForRegex(metadata.leadingDigits)
if (metadata.hasLeadingDigits()) {
if (regexCache.getPatternForRegex(metadata.getLeadingDigits())
.matcher(nationalNumber).lookingAt()) {
return regionCode;
}
@ -2284,7 +2268,7 @@ public class PhoneNumberUtil {
if (metadata == null) {
throw new IllegalArgumentException("Invalid region code: " + regionCode);
}
return metadata.countryCode;
return metadata.getCountryCode();
}
/**
@ -2310,7 +2294,7 @@ public class PhoneNumberUtil {
+ ") provided.");
return null;
}
String nationalPrefix = metadata.nationalPrefix;
String nationalPrefix = metadata.getNationalPrefix();
// If no national prefix was found, we return null.
if (nationalPrefix.length() == 0) {
return null;
@ -2344,7 +2328,7 @@ public class PhoneNumberUtil {
if (mainMetadataForCallingCode == null) {
return false;
}
return mainMetadataForCallingCode.leadingZeroPossible;
return mainMetadataForCallingCode.isLeadingZeroPossible();
}
/**
@ -2401,7 +2385,7 @@ public class PhoneNumberUtil {
*/
private boolean isShorterThanPossibleNormalNumber(PhoneMetadata regionMetadata, String number) {
Pattern possibleNumberPattern = regexCache.getPatternForRegex(
regionMetadata.generalDesc.possibleNumberPattern);
regionMetadata.getGeneralDesc().getPossibleNumberPattern());
return testNumberLengthAgainstPattern(possibleNumberPattern, number) ==
ValidationResult.TOO_SHORT;
}
@ -2441,7 +2425,7 @@ public class PhoneNumberUtil {
// Metadata cannot be null because the country calling code is valid.
PhoneMetadata metadata = getMetadataForRegionOrCallingCode(countryCode, regionCode);
Pattern possibleNumberPattern =
regexCache.getPatternForRegex(metadata.generalDesc.possibleNumberPattern);
regexCache.getPatternForRegex(metadata.getGeneralDesc().getPossibleNumberPattern());
return testNumberLengthAgainstPattern(possibleNumberPattern, nationalNumber);
}
@ -2573,7 +2557,7 @@ public class PhoneNumberUtil {
// Set the default prefix to be something that will never match.
String possibleCountryIddPrefix = "NonMatch";
if (defaultRegionMetadata != null) {
possibleCountryIddPrefix = defaultRegionMetadata.internationalPrefix;
possibleCountryIddPrefix = defaultRegionMetadata.getInternationalPrefix();
}
CountryCodeSource countryCodeSource =
@ -2601,19 +2585,19 @@ public class PhoneNumberUtil {
// Check to see if the number starts with the country calling code for the default region. If
// so, we remove the country calling code, and do some checks on the validity of the number
// before and after.
int defaultCountryCode = defaultRegionMetadata.countryCode;
int defaultCountryCode = defaultRegionMetadata.getCountryCode();
String defaultCountryCodeString = String.valueOf(defaultCountryCode);
String normalizedNumber = fullNumber.toString();
if (normalizedNumber.startsWith(defaultCountryCodeString)) {
StringBuilder potentialNationalNumber =
new StringBuilder(normalizedNumber.substring(defaultCountryCodeString.length()));
PhoneNumberDesc generalDesc = defaultRegionMetadata.generalDesc;
PhoneNumberDesc generalDesc = defaultRegionMetadata.getGeneralDesc();
Pattern validNumberPattern =
regexCache.getPatternForRegex(generalDesc.nationalNumberPattern);
regexCache.getPatternForRegex(generalDesc.getNationalNumberPattern());
maybeStripNationalPrefixAndCarrierCode(
potentialNationalNumber, defaultRegionMetadata, null /* Don't need the carrier code */);
Pattern possibleNumberPattern =
regexCache.getPatternForRegex(generalDesc.possibleNumberPattern);
regexCache.getPatternForRegex(generalDesc.getPossibleNumberPattern());
// If the number was not valid before but is valid now, or if it was too long before, we
// consider the number with the country calling code stripped to be a better result and
// keep that instead.
@ -2706,7 +2690,7 @@ public class PhoneNumberUtil {
boolean maybeStripNationalPrefixAndCarrierCode(
StringBuilder number, PhoneMetadata metadata, StringBuilder carrierCode) {
int numberLength = number.length();
String possibleNationalPrefix = metadata.nationalPrefixForParsing;
String possibleNationalPrefix = metadata.getNationalPrefixForParsing();
if (numberLength == 0 || possibleNationalPrefix.length() == 0) {
// Early return for numbers of zero length.
return false;
@ -2715,14 +2699,14 @@ public class PhoneNumberUtil {
Matcher prefixMatcher = regexCache.getPatternForRegex(possibleNationalPrefix).matcher(number);
if (prefixMatcher.lookingAt()) {
Pattern nationalNumberRule =
regexCache.getPatternForRegex(metadata.generalDesc.nationalNumberPattern);
regexCache.getPatternForRegex(metadata.getGeneralDesc().getNationalNumberPattern());
// Check if the original number is viable.
boolean isViableOriginalNumber = nationalNumberRule.matcher(number).matches();
// prefixMatcher.group(numOfGroups) == null implies nothing was captured by the capturing
// groups in possibleNationalPrefix; therefore, no transformation is necessary, and we just
// remove the national prefix.
int numOfGroups = prefixMatcher.groupCount();
String transformRule = metadata.nationalPrefixTransformRule;
String transformRule = metadata.getNationalPrefixTransformRule();
if (transformRule == null || transformRule.length() == 0 ||
prefixMatcher.group(numOfGroups) == null) {
// If the original number was viable, and the resultant number is not, we return.
@ -3017,7 +3001,7 @@ public class PhoneNumberUtil {
normalize(nationalNumber);
normalizedNationalNumber.append(nationalNumber);
if (defaultRegion != null) {
countryCode = regionMetadata.countryCode;
countryCode = regionMetadata.getCountryCode();
phoneNumber.setCountryCode(countryCode);
} else if (keepRawInput) {
phoneNumber.clearCountryCodeSource();
@ -3291,7 +3275,7 @@ public class PhoneNumberUtil {
return true;
}
String nationalSignificantNumber = getNationalSignificantNumber(number);
return !isNumberMatchingDesc(nationalSignificantNumber, metadata.noInternationalDialling);
return !isNumberMatchingDesc(nationalSignificantNumber, metadata.getNoInternationalDialling());
}
/**
@ -3307,6 +3291,6 @@ public class PhoneNumberUtil {
logger.log(Level.WARNING, "Invalid or unknown region code provided: " + regionCode);
return false;
}
return metadata.mobileNumberPortableRegion;
return metadata.isMobileNumberPortableRegion();
}
}

+ 1119
- 0
java/libphonenumber/src/com/google/i18n/phonenumbers/Phonemetadata.java
File diff suppressed because it is too large
View File


+ 28
- 28
java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberInfo.java View File

@ -16,11 +16,11 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.internal.MatcherApi;
import com.google.i18n.phonenumbers.internal.RegexBasedMatcher;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneNumberDesc;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneNumberDesc;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import java.util.ArrayList;
import java.util.Arrays;
@ -130,7 +130,7 @@ public class ShortNumberInfo {
if (phoneMetadata == null) {
return false;
}
return matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.generalDesc);
return matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.getGeneralDesc());
}
/**
@ -151,7 +151,7 @@ public class ShortNumberInfo {
return false;
}
return matcherApi.matchesPossibleNumber(getNationalSignificantNumber(number),
phoneMetadata.generalDesc);
phoneMetadata.getGeneralDesc());
}
/**
@ -171,7 +171,7 @@ public class ShortNumberInfo {
if (phoneMetadata == null) {
continue;
}
if (matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.generalDesc)) {
if (matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.getGeneralDesc())) {
return true;
}
}
@ -199,11 +199,11 @@ public class ShortNumberInfo {
if (phoneMetadata == null) {
return false;
}
PhoneNumberDesc generalDesc = phoneMetadata.generalDesc;
PhoneNumberDesc generalDesc = phoneMetadata.getGeneralDesc();
if (!matchesPossibleNumberAndNationalNumber(shortNumber, generalDesc)) {
return false;
}
PhoneNumberDesc shortNumberDesc = phoneMetadata.shortCode;
PhoneNumberDesc shortNumberDesc = phoneMetadata.getShortCode();
return matchesPossibleNumberAndNationalNumber(shortNumber, shortNumberDesc);
}
@ -226,11 +226,11 @@ public class ShortNumberInfo {
return false;
}
String shortNumber = getNationalSignificantNumber(number);
PhoneNumberDesc generalDesc = phoneMetadata.generalDesc;
PhoneNumberDesc generalDesc = phoneMetadata.getGeneralDesc();
if (!matchesPossibleNumberAndNationalNumber(shortNumber, generalDesc)) {
return false;
}
PhoneNumberDesc shortNumberDesc = phoneMetadata.shortCode;
PhoneNumberDesc shortNumberDesc = phoneMetadata.getShortCode();
return matchesPossibleNumberAndNationalNumber(shortNumber, shortNumberDesc);
}
@ -292,13 +292,13 @@ public class ShortNumberInfo {
// The cost categories are tested in order of decreasing expense, since if for some reason the
// patterns overlap the most expensive matching cost category should be returned.
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.premiumRate)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getPremiumRate())) {
return ShortNumberCost.PREMIUM_RATE;
}
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.standardRate)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getStandardRate())) {
return ShortNumberCost.STANDARD_RATE;
}
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.tollFree)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getTollFree())) {
return ShortNumberCost.TOLL_FREE;
}
if (isEmergencyNumber(shortNumber, regionDialingFrom)) {
@ -346,13 +346,13 @@ public class ShortNumberInfo {
// The cost categories are tested in order of decreasing expense, since if for some reason the
// patterns overlap the most expensive matching cost category should be returned.
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.premiumRate)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getPremiumRate())) {
return ShortNumberCost.PREMIUM_RATE;
}
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.standardRate)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getStandardRate())) {
return ShortNumberCost.STANDARD_RATE;
}
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.tollFree)) {
if (matchesPossibleNumberAndNationalNumber(shortNumber, phoneMetadata.getTollFree())) {
return ShortNumberCost.TOLL_FREE;
}
if (isEmergencyNumber(shortNumber, regionDialingFrom)) {
@ -429,7 +429,7 @@ public class ShortNumberInfo {
for (String regionCode : regionCodes) {
PhoneMetadata phoneMetadata = MetadataManager.getShortNumberMetadataForRegion(regionCode);
if (phoneMetadata != null
&& matchesPossibleNumberAndNationalNumber(nationalNumber, phoneMetadata.shortCode)) {
&& matchesPossibleNumberAndNationalNumber(nationalNumber, phoneMetadata.getShortCode())) {
// The number is valid for this region.
return regionCode;
}
@ -457,9 +457,9 @@ public class ShortNumberInfo {
if (phoneMetadata == null) {
return "";
}
PhoneNumberDesc desc = phoneMetadata.shortCode;
if (!desc.exampleNumber.equals("")) {
return desc.exampleNumber;
PhoneNumberDesc desc = phoneMetadata.getShortCode();
if (desc.hasExampleNumber()) {
return desc.getExampleNumber();
}
return "";
}
@ -481,20 +481,20 @@ public class ShortNumberInfo {
PhoneNumberDesc desc = null;
switch (cost) {
case TOLL_FREE:
desc = phoneMetadata.tollFree;
desc = phoneMetadata.getTollFree();
break;
case STANDARD_RATE:
desc = phoneMetadata.standardRate;
desc = phoneMetadata.getStandardRate();
break;
case PREMIUM_RATE:
desc = phoneMetadata.premiumRate;
desc = phoneMetadata.getPremiumRate();
break;
default:
// UNKNOWN_COST numbers are computed by the process of elimination from the other cost
// categories.
}
if (desc != null && !desc.exampleNumber.equals("")) {
return desc.exampleNumber;
if (desc != null && desc.hasExampleNumber()) {
return desc.getExampleNumber();
}
return "";
}
@ -543,12 +543,12 @@ public class ShortNumberInfo {
return false;
}
PhoneMetadata metadata = MetadataManager.getShortNumberMetadataForRegion(regionCode);
if (metadata == null || metadata.emergency == null) {
if (metadata == null || !metadata.hasEmergency()) {
return false;
}
String normalizedNumber = PhoneNumberUtil.normalizeDigitsOnly(number);
PhoneNumberDesc emergencyDesc = metadata.emergency;
PhoneNumberDesc emergencyDesc = metadata.getEmergency();
boolean allowPrefixMatchForRegion =
allowPrefixMatch && !REGIONS_WHERE_EMERGENCY_NUMBERS_MUST_BE_EXACT.contains(regionCode);
return matcherApi.matchesNationalNumber(normalizedNumber, emergencyDesc,
@ -572,7 +572,7 @@ public class ShortNumberInfo {
PhoneMetadata phoneMetadata = MetadataManager.getShortNumberMetadataForRegion(regionCode);
return (phoneMetadata != null)
&& (matchesPossibleNumberAndNationalNumber(nationalNumber,
phoneMetadata.carrierSpecific));
phoneMetadata.getCarrierSpecific()));
}
/**


+ 8
- 9
java/libphonenumber/src/com/google/i18n/phonenumbers/SingleFileMetadataSourceImpl.java View File

@ -16,8 +16,8 @@
package com.google.i18n.phonenumbers;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.nano.Phonemetadata.PhoneMetadataCollection;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadata;
import com.google.i18n.phonenumbers.Phonemetadata.PhoneMetadataCollection;
import java.io.InputStream;
import java.util.Collections;
@ -101,16 +101,15 @@ final class SingleFileMetadataSourceImpl implements MetadataSource {
// loading depending on what data is available in the jar.
throw new IllegalStateException("missing metadata: " + fileName);
}
PhoneMetadataCollection metadataCollection =
MetadataManager.loadMetadataAndCloseInput(source, MetadataManager.ALL_REGIONS_BUFFER_SIZE);
PhoneMetadata[] metadatas = metadataCollection.metadata;
if (metadatas.length == 0) {
PhoneMetadataCollection metadataCollection = MetadataManager.loadMetadataAndCloseInput(source);
List<PhoneMetadata> metadataList = metadataCollection.getMetadataList();
if (metadataList.isEmpty()) {
// This should not happen since clients shouldn't be using this implementation!
throw new IllegalStateException("empty metadata: " + fileName);
}
for (PhoneMetadata metadata : metadatas) {
String regionCode = metadata.id;
int countryCallingCode = metadata.countryCode;
for (PhoneMetadata metadata : metadataList) {
String regionCode = metadata.getId();
int countryCallingCode = metadata.getCountryCode();
boolean isNonGeoRegion = PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY.equals(regionCode);
if (isNonGeoRegion) {
countryCodeToNonGeographicalMetadataMap.put(countryCallingCode, metadata);


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_255 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_27 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_30 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_31 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_34 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_350 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_351 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_352 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_358 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_359 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_36 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_372 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_373 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_380 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_381 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_385 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_43 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_44 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_49 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_505 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_506 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_54 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_55 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_58 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_595 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_61 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_62 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_63 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_66 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_675 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_676 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_679 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_7 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_81 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_84 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_855 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_90 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_91 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_94 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_95 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_971 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_972 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberAlternateFormatsProto_995 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_800 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_808 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_870 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_878 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_881 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_882 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_883 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_888 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_979 View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AD View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AF View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AL View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AM View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AO View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AW View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AX View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BA View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BG View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BI View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BJ View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BL View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BN View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save