Browse Source

Update javadoc on isNumberGeographical (#1823)

pull/1829/head
Keghani Kouzoujian 9 years ago
committed by GitHub
parent
commit
9c5448dcbd
6 changed files with 19 additions and 24 deletions
  1. +4
    -4
      cpp/src/phonenumbers/phonenumberutil.cc
  2. +3
    -6
      cpp/src/phonenumbers/phonenumberutil.h
  3. +2
    -2
      cpp/src/phonenumbers/regex_based_matcher.h
  4. +6
    -9
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  5. +3
    -3
      javascript/i18n/phonenumbers/phonenumberutil.js
  6. +1
    -0
      pending_code_changes.txt

+ 4
- 4
cpp/src/phonenumbers/phonenumberutil.cc View File

@ -2364,12 +2364,12 @@ bool PhoneNumberUtil::IsNumberGeographical(
}
bool PhoneNumberUtil::IsNumberGeographical(
PhoneNumberType number_type, int country_calling_code) const {
return number_type == PhoneNumberUtil::FIXED_LINE ||
number_type == PhoneNumberUtil::FIXED_LINE_OR_MOBILE ||
PhoneNumberType phone_number_type, int country_calling_code) const {
return phone_number_type == PhoneNumberUtil::FIXED_LINE ||
phone_number_type == PhoneNumberUtil::FIXED_LINE_OR_MOBILE ||
(reg_exps_->geo_mobile_countries_.find(country_calling_code)
!= reg_exps_->geo_mobile_countries_.end() &&
number_type == PhoneNumberUtil::MOBILE);
phone_number_type == PhoneNumberUtil::MOBILE);
}
// A helper function to set the values related to leading zeros in a


+ 3
- 6
cpp/src/phonenumbers/phonenumberutil.h View File

@ -591,14 +591,11 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
bool CanBeInternationallyDialled(const PhoneNumber& number) const;
// Tests whether a phone number has a geographical association. It checks if
// the number is associated to a certain region in the country where it
// belongs to. Note that this doesn't verify if the number is actually in use.
// the number is associated with a certain region in the country to which it
// belongs. Note that this doesn't verify if the number is actually in use.
bool IsNumberGeographical(const PhoneNumber& phone_number) const;
// Tests whether a phone number has a geographical association, as represented
// by its type and the country it belongs to.
//
// This version of IsNumberGeographical exists since calculating the phone
// Overload of IsNumberGeographical(PhoneNumber), since calculating the phone
// number type is expensive; if we have already done this, we don't want to do
// it again.
bool IsNumberGeographical(PhoneNumberType phone_number_type,


+ 2
- 2
cpp/src/phonenumbers/regex_based_matcher.h View File

@ -37,12 +37,12 @@ class RegexBasedMatcher : public MatcherApi {
RegexBasedMatcher();
~RegexBasedMatcher();
bool MatchNationalNumber(const string& national_number,
bool MatchNationalNumber(const string& number,
const PhoneNumberDesc& number_desc,
bool allow_prefix_match) const;
private:
bool Match(const string& national_number, const string& number_pattern,
bool Match(const string& number, const string& number_pattern,
bool allow_prefix_match) const;
const scoped_ptr<const AbstractRegExpFactory> regexp_factory_;


+ 6
- 9
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -1124,7 +1124,7 @@ public class PhoneNumberUtil {
/**
* Tests whether a phone number has a geographical association. It checks if the number is
* associated to a certain region in the country where it belongs to. Note that this doesn't
* associated with a certain region in the country to which it belongs. Note that this doesn't
* verify if the number is actually in use.
*/
public boolean isNumberGeographical(PhoneNumber phoneNumber) {
@ -1132,17 +1132,14 @@ public class PhoneNumberUtil {
}
/**
* Tests whether a phone number has a geographical association, as represented by its type and the
* country it belongs to.
*
* This version of isNumberGeographical exists since calculating the phone number type is
* Overload of isNumberGeographical(PhoneNumber), since calculating the phone number type is
* expensive; if we have already done this, we don't want to do it again.
*/
public boolean isNumberGeographical(PhoneNumberType numberType, int countryCallingCode) {
return numberType == PhoneNumberType.FIXED_LINE
|| numberType == PhoneNumberType.FIXED_LINE_OR_MOBILE
public boolean isNumberGeographical(PhoneNumberType phoneNumberType, int countryCallingCode) {
return phoneNumberType == PhoneNumberType.FIXED_LINE
|| phoneNumberType == PhoneNumberType.FIXED_LINE_OR_MOBILE
|| (GEO_MOBILE_COUNTRIES.contains(countryCallingCode)
&& numberType == PhoneNumberType.MOBILE);
&& phoneNumberType == PhoneNumberType.MOBILE);
}
/**


+ 3
- 3
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -1531,9 +1531,9 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.formattingRuleHasFirstGroupOnly =
/**
* Tests whether a phone number has a geographical association. It checks if
* the number is associated to a certain region in the country where it belongs
* to. Note that this doesn't verify if the number is actually in use.
* Tests whether a phone number has a geographical association. It checks if the
* number is associated with a certain region in the country to which it
* belongs. Note that this doesn't verify if the number is actually in use.
*
* @param {i18n.phonenumbers.PhoneNumber} phoneNumber The phone number to test.
* @return {boolean} true if the phone number has a geographical association.


+ 1
- 0
pending_code_changes.txt View File

@ -9,3 +9,4 @@ Code changes:
starting with 0s may be noticed in some countries.
- Bug fix for Javascript: getNationalSignificantNumber used to print the string
"null" for empty phone number objects, now it returns an empty string.
- Updated the documentation for the isNumberGeographical API.

Loading…
Cancel
Save