Browse Source

Reorganize project structure, creating resources directory.

pull/567/head
Shaopeng Jia 16 years ago
committed by Mihaela Rosca
parent
commit
fb57f217db
8 changed files with 11 additions and 9 deletions
  1. +4
    -2
      java/build.xml
  2. +0
    -0
      java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml
  3. +0
    -0
      java/resources/com/google/i18n/phonenumbers/src/generated_files/PhoneNumberMetadataProto
  4. +0
    -0
      java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml
  5. +0
    -0
      java/resources/com/google/i18n/phonenumbers/test/generated_files/PhoneNumberMetadataProtoForTesting
  6. +4
    -4
      java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  7. +2
    -2
      java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
  8. +1
    -1
      java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java

+ 4
- 2
java/build.xml View File

@ -4,6 +4,7 @@
<property name="src.dir" value="src"/>
<property name="test.dir" value="test"/>
<property name="build.dir" value="build"/>
<property name="resources.dir" value="resources"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="lib.dir" value="lib"/>
@ -34,7 +35,7 @@
<include name="**/*.class"/>
<exclude name="**/*Test*"/>
</fileset>
<fileset dir="${src.dir}">
<fileset dir="${resources.dir}">
<include name="**/PhoneNumberMetadataProto"/>
</fileset>
</jar>
@ -47,7 +48,8 @@
<include name="**/*.class"/>
<exclude name="**/*Test*"/>
</fileset>
<fileset dir="${test.dir}">
<fileset dir="${resources.dir}">
<include name="**/PhoneNumberMetadataProto"/>
<include name="**/PhoneNumberMetadataProtoForTesting"/>
</fileset>
</jar>


java/src/com/google/i18n/phonenumbers/PhoneNumberMetaData.xml → java/resources/com/google/i18n/phonenumbers/src/PhoneNumberMetaData.xml View File


java/src/com/google/i18n/phonenumbers/PhoneNumberMetadataProto → java/resources/com/google/i18n/phonenumbers/src/generated_files/PhoneNumberMetadataProto View File


java/test/com/google/i18n/phonenumbers/PhoneNumberMetaDataForTesting.xml → java/resources/com/google/i18n/phonenumbers/test/PhoneNumberMetaDataForTesting.xml View File


java/test/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting → java/resources/com/google/i18n/phonenumbers/test/generated_files/PhoneNumberMetadataProtoForTesting View File


+ 4
- 4
java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -54,7 +54,7 @@ public class PhoneNumberUtil {
private static final int MAX_LENGTH_FOR_NSN = 15;
private static final int MIN_LENGTH_FOR_NSN = 3;
private static final String META_DATA_FILE =
"/com/google/i18n/phonenumbers/PhoneNumberMetadataProto";
"/com/google/i18n/phonenumbers/src/generated_files/PhoneNumberMetadataProto";
private static final Logger LOGGER = Logger.getLogger(PhoneNumberUtil.class.getName());
// A mapping from a country code to a region code which denotes the country/region
@ -251,7 +251,7 @@ public class PhoneNumberUtil {
/**
* INTERNATIONAL and NATIONAL formats are consistent with the definition in ITU-T Recommendation
* E. 123. For example, the number of the Google Zürich office will be written as
* E. 123. For example, the number of the Google Zurich office will be written as
* "+41 44 668 1800" in INTERNATIONAL format, and as "044 668 1800" in NATIONAL format.
* E164 format is as per INTERNATIONAL format but with no formatting applied, e.g. +41446681800.
*
@ -578,7 +578,7 @@ public class PhoneNumberUtil {
}
// Note here that all NANPA formatting rules are contained by US, so we use that to format NANPA
// numbers. The same applies to Russian Fed countries - rules are contained by Russia. French
// Indian Ocean country rules are contained by Réunion.
// Indian Ocean country rules are contained by Reunion.
String regionCode = getRegionCodeForCountryCode(countryCode);
if (!isValidRegionCode(regionCode, countryCode, nationalSignificantNumber)) {
return nationalSignificantNumber;
@ -671,7 +671,7 @@ public class PhoneNumberUtil {
if (countryCode == FRENCH_INDIAN_OCEAN_COUNTRY_CODE &&
frenchIndianOceanTerritories.contains(countryCallingFrom)) {
// For dialling between FRENCH_INDIAN_OCEAN countries, the 10 digit number is all we need.
// Technically this is the case for dialling from la Réunion to other overseas departments of
// Technically this is the case for dialling from la Reunion to other overseas departments of
// France (French Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover this
// edge case for now and for those cases return the version including country code.
// Details here: http://www.petitfute.com/voyage/225-info-pratiques-reunion


+ 2
- 2
java/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java View File

@ -32,10 +32,10 @@ import java.io.InputStream;
public class AsYouTypeFormatterTest extends TestCase {
private PhoneNumberUtil phoneUtil;
private static final String TEST_META_DATA_FILE =
"/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting";
"/com/google/i18n/phonenumbers/test/generated_files/PhoneNumberMetadataProtoForTesting";
public AsYouTypeFormatterTest() {
PhoneNumberUtil.resetInstance();
PhoneNumberUtil.resetInstance();
InputStream in = PhoneNumberUtilTest.class.getResourceAsStream(TEST_META_DATA_FILE);
phoneUtil = PhoneNumberUtil.getInstance(in);
}


+ 1
- 1
java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java View File

@ -42,7 +42,7 @@ import java.util.regex.Pattern;
public class PhoneNumberUtilTest extends TestCase {
private PhoneNumberUtil phoneUtil;
private static final String TEST_META_DATA_FILE =
"/com/google/i18n/phonenumbers/PhoneNumberMetadataProtoForTesting";
"/com/google/i18n/phonenumbers/test/generated_files/PhoneNumberMetadataProtoForTesting";
public PhoneNumberUtilTest() {
PhoneNumberUtil.resetInstance();


Loading…
Cancel
Save