diff options
author | davinci@google.com <davinci@google.com@ee073f10-1060-11df-b6a4-87a95322a99c> | 2013-07-16 11:38:06 +0000 |
---|---|---|
committer | davinci@google.com <davinci@google.com@ee073f10-1060-11df-b6a4-87a95322a99c> | 2013-07-16 11:38:06 +0000 |
commit | 1772d2da44f02376fc09d066996782c87df24a61 (patch) | |
tree | a28279492016a9310faf67bcaf4675fc6ad1362a | |
parent | 0a391987da36c751527b8251aee7a178a10e5eb3 (diff) | |
download | android_external_libphonenumbergoogle-1772d2da44f02376fc09d066996782c87df24a61.tar.gz android_external_libphonenumbergoogle-1772d2da44f02376fc09d066996782c87df24a61.tar.bz2 android_external_libphonenumbergoogle-1772d2da44f02376fc09d066996782c87df24a61.zip |
DATA: Minor fix to change MetaData to Metadata for consistency
git-svn-id: http://libphonenumber.googlecode.com/svn/trunk@593 ee073f10-1060-11df-b6a4-87a95322a99c
3 files changed, 31 insertions, 31 deletions
diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java index 8cc31f5..9456c30 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java @@ -63,8 +63,8 @@ public class AsYouTypeFormatter { private static final char SEPARATOR_BEFORE_NATIONAL_NUMBER = ' '; private static final PhoneMetadata EMPTY_METADATA = new PhoneMetadata().setInternationalPrefix("NA"); - private PhoneMetadata defaultMetaData; - private PhoneMetadata currentMetaData; + private PhoneMetadata defaultMetadata; + private PhoneMetadata currentMetadata; // A pattern that is used to match character classes in regular expressions. An example of a // character class is [1-4]. @@ -126,8 +126,8 @@ public class AsYouTypeFormatter { */ AsYouTypeFormatter(String regionCode) { defaultCountry = regionCode; - currentMetaData = getMetadataForRegion(defaultCountry); - defaultMetaData = currentMetaData; + currentMetadata = getMetadataForRegion(defaultCountry); + defaultMetadata = currentMetadata; } // The metadata needed by this class is the same for all regions sharing the same country calling @@ -174,10 +174,10 @@ public class AsYouTypeFormatter { private void getAvailableFormats(String leadingThreeDigits) { List<NumberFormat> formatList = - (isCompleteNumber && currentMetaData.intlNumberFormatSize() > 0) - ? currentMetaData.intlNumberFormats() - : currentMetaData.numberFormats(); - boolean nationalPrefixIsUsedByCountry = currentMetaData.hasNationalPrefix(); + (isCompleteNumber && currentMetadata.intlNumberFormatSize() > 0) + ? currentMetadata.intlNumberFormats() + : currentMetadata.numberFormats(); + boolean nationalPrefixIsUsedByCountry = currentMetadata.hasNationalPrefix(); for (NumberFormat format : formatList) { if (!nationalPrefixIsUsedByCountry || isCompleteNumber || format.isNationalPrefixOptionalWhenFormatting() || @@ -277,8 +277,8 @@ public class AsYouTypeFormatter { isExpectingCountryCallingCode = false; possibleFormats.clear(); shouldAddSpaceAfterNationalPrefix = false; - if (!currentMetaData.equals(defaultMetaData)) { - currentMetaData = getMetadataForRegion(defaultCountry); + if (!currentMetadata.equals(defaultMetadata)) { + currentMetadata = getMetadataForRegion(defaultCountry); } } @@ -509,7 +509,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.getCountryCode() == 1) && (nationalNumber.charAt(0) == '1') && + return (currentMetadata.getCountryCode() == 1) && (nationalNumber.charAt(0) == '1') && (nationalNumber.charAt(1) != '0') && (nationalNumber.charAt(1) != '1'); } @@ -520,9 +520,9 @@ public class AsYouTypeFormatter { startOfNationalNumber = 1; prefixBeforeNationalNumber.append('1').append(SEPARATOR_BEFORE_NATIONAL_NUMBER); isCompleteNumber = true; - } else if (currentMetaData.hasNationalPrefixForParsing()) { + } else if (currentMetadata.hasNationalPrefixForParsing()) { Pattern nationalPrefixForParsing = - regexCache.getPatternForRegex(currentMetaData.getNationalPrefixForParsing()); + regexCache.getPatternForRegex(currentMetadata.getNationalPrefixForParsing()); Matcher m = nationalPrefixForParsing.matcher(nationalNumber); if (m.lookingAt()) { // When the national prefix is detected, we use international formatting rules instead of @@ -548,7 +548,7 @@ public class AsYouTypeFormatter { private boolean attemptToExtractIdd() { Pattern internationalPrefix = regexCache.getPatternForRegex("\\" + PhoneNumberUtil.PLUS_SIGN + "|" + - currentMetaData.getInternationalPrefix()); + currentMetadata.getInternationalPrefix()); Matcher iddMatcher = internationalPrefix.matcher(accruedInputWithoutFormatting); if (iddMatcher.lookingAt()) { isCompleteNumber = true; @@ -586,9 +586,9 @@ public class AsYouTypeFormatter { nationalNumber.append(numberWithoutCountryCallingCode); String newRegionCode = phoneUtil.getRegionCodeForCountryCode(countryCode); if (PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY.equals(newRegionCode)) { - currentMetaData = phoneUtil.getMetadataForNonGeographicalRegion(countryCode); + currentMetadata = phoneUtil.getMetadataForNonGeographicalRegion(countryCode); } else if (!newRegionCode.equals(defaultCountry)) { - currentMetaData = getMetadataForRegion(newRegionCode); + currentMetadata = getMetadataForRegion(newRegionCode); } String countryCodeString = Integer.toString(countryCode); prefixBeforeNationalNumber.append(countryCodeString).append(SEPARATOR_BEFORE_NATIONAL_NUMBER); diff --git a/javascript/i18n/phonenumbers/asyoutypeformatter.js b/javascript/i18n/phonenumbers/asyoutypeformatter.js index 0d3672d..ddd3f16 100644 --- a/javascript/i18n/phonenumbers/asyoutypeformatter.js +++ b/javascript/i18n/phonenumbers/asyoutypeformatter.js @@ -181,12 +181,12 @@ i18n.phonenumbers.AsYouTypeFormatter = function(regionCode) { * @private */ this.defaultCountry_ = regionCode; - this.currentMetaData_ = this.getMetadataForRegion_(this.defaultCountry_); + this.currentMetadata_ = this.getMetadataForRegion_(this.defaultCountry_); /** * @type {i18n.phonenumbers.PhoneMetadata} * @private */ - this.defaultMetaData_ = this.currentMetaData_; + this.defaultMetadata_ = this.currentMetadata_; }; @@ -351,9 +351,9 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.getAvailableFormats_ = /** @type {Array.<i18n.phonenumbers.NumberFormat>} */ var formatList = (this.isCompleteNumber_ && - this.currentMetaData_.intlNumberFormatCount() > 0) ? - this.currentMetaData_.intlNumberFormatArray() : - this.currentMetaData_.numberFormatArray(); + this.currentMetadata_.intlNumberFormatCount() > 0) ? + this.currentMetadata_.intlNumberFormatArray() : + this.currentMetadata_.numberFormatArray(); /** @type {number} */ var formatListLength = formatList.length; for (var i = 0; i < formatListLength; ++i) { @@ -361,7 +361,7 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.getAvailableFormats_ = var format = formatList[i]; /** @type {boolean} */ var nationalPrefixIsUsedByCountry = - this.currentMetaData_.hasNationalPrefix(); + this.currentMetadata_.hasNationalPrefix(); if (!nationalPrefixIsUsedByCountry || this.isCompleteNumber_ || format.getNationalPrefixOptionalWhenFormatting() || this.phoneUtil_.formattingRuleHasFirstGroupOnly( @@ -515,8 +515,8 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.clear = function() { this.isExpectingCountryCallingCode_ = false; this.possibleFormats_ = []; this.shouldAddSpaceAfterNationalPrefix_ = false; - if (this.currentMetaData_ != this.defaultMetaData_) { - this.currentMetaData_ = this.getMetadataForRegion_(this.defaultCountry_); + if (this.currentMetadata_ != this.defaultMetadata_) { + this.currentMetadata_ = this.getMetadataForRegion_(this.defaultCountry_); } }; @@ -887,7 +887,7 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype. // prefix. The reason is 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. - if (this.currentMetaData_.getCountryCode() != 1) { + if (this.currentMetadata_.getCountryCode() != 1) { return false; } /** @type {string} */ @@ -916,10 +916,10 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype. this.prefixBeforeNationalNumber_.append('1').append( i18n.phonenumbers.AsYouTypeFormatter.SEPARATOR_BEFORE_NATIONAL_NUMBER_); this.isCompleteNumber_ = true; - } else if (this.currentMetaData_.hasNationalPrefixForParsing()) { + } else if (this.currentMetadata_.hasNationalPrefixForParsing()) { /** @type {RegExp} */ var nationalPrefixForParsing = new RegExp( - '^(?:' + this.currentMetaData_.getNationalPrefixForParsing() + ')'); + '^(?:' + this.currentMetadata_.getNationalPrefixForParsing() + ')'); /** @type {Array.<string>} */ var m = nationalNumber.match(nationalPrefixForParsing); if (m != null && m[0] != null && m[0].length > 0) { @@ -955,7 +955,7 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.attemptToExtractIdd_ = /** @type {RegExp} */ var internationalPrefix = new RegExp( '^(?:' + '\\' + i18n.phonenumbers.PhoneNumberUtil.PLUS_SIGN + '|' + - this.currentMetaData_.getInternationalPrefix() + ')'); + this.currentMetadata_.getInternationalPrefix() + ')'); /** @type {Array.<string>} */ var m = accruedInputWithoutFormatting.match(internationalPrefix); if (m != null && m[0] != null && m[0].length > 0) { @@ -1008,10 +1008,10 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype. var newRegionCode = this.phoneUtil_.getRegionCodeForCountryCode(countryCode); if (i18n.phonenumbers.PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY == newRegionCode) { - this.currentMetaData_ = + this.currentMetadata_ = this.phoneUtil_.getMetadataForNonGeographicalRegion(countryCode); } else if (newRegionCode != this.defaultCountry_) { - this.currentMetaData_ = this.getMetadataForRegion_(newRegionCode); + this.currentMetadata_ = this.getMetadataForRegion_(newRegionCode); } /** @type {string} */ var countryCodeString = '' + countryCode; diff --git a/resources/PhoneNumberMetadataForTesting.xml b/resources/PhoneNumberMetadataForTesting.xml index 055f471..2f8bb05 100644 --- a/resources/PhoneNumberMetadataForTesting.xml +++ b/resources/PhoneNumberMetadataForTesting.xml @@ -14,7 +14,7 @@ @author: Shaopeng Jia - MetaData on Phone Number Plan and formatting rules. This file is used + Metadata on Phone Number Plan and formatting rules. This file is used solely for the purpose of unittesting, so data in this file is not necessarily consistent with that of PhoneNumberMetadata.xml. --> |