From 302f7bf6db833df13eb027411809022a7edb52a8 Mon Sep 17 00:00:00 2001 From: Shaopeng Jia Date: Mon, 1 Mar 2010 15:22:37 +0000 Subject: [PATCH] Minor documentation update. --- java/build.xml | 6 +++--- ...tobuf-java-2.3.0-lite.jar => protobuf-lite.jar} | Bin .../phonenumbers/BuildMetadataProtoFromXml.java | 6 +++--- .../google/i18n/phonenumbers/PhoneNumberUtil.java | 13 ++++++------- .../i18n/phonenumbers/PhoneNumberUtilTest.java | 3 --- 5 files changed, 12 insertions(+), 16 deletions(-) rename java/lib/{protobuf-java-2.3.0-lite.jar => protobuf-lite.jar} (100%) diff --git a/java/build.xml b/java/build.xml index af9d85277..9fd344da7 100644 --- a/java/build.xml +++ b/java/build.xml @@ -1,6 +1,6 @@ - + @@ -49,7 +49,7 @@ - + @@ -59,7 +59,7 @@ - + diff --git a/java/lib/protobuf-java-2.3.0-lite.jar b/java/lib/protobuf-lite.jar similarity index 100% rename from java/lib/protobuf-java-2.3.0-lite.jar rename to java/lib/protobuf-lite.jar diff --git a/java/src/com/google/i18n/phonenumbers/BuildMetadataProtoFromXml.java b/java/src/com/google/i18n/phonenumbers/BuildMetadataProtoFromXml.java index 5d7533f9f..b850cd5a4 100644 --- a/java/src/com/google/i18n/phonenumbers/BuildMetadataProtoFromXml.java +++ b/java/src/com/google/i18n/phonenumbers/BuildMetadataProtoFromXml.java @@ -43,12 +43,12 @@ import javax.xml.parsers.ParserConfigurationException; * ./BuildMetadataProtoFromXml PhoneNumberMetadata.xml PhoneNumberMetadataProto true * * When liteBuild flag is set to true, the outputFile generated omits certain metadata which is not - * needed for clients using liteBuild. At this moment, example numbers information is omitted. + * needed for clients using liteBuild. At this moment, example numbers information is omitted. * * @author Shaopeng Jia */ public class BuildMetadataProtoFromXml { - private BuildMetadataProtoFromXml() { + private BuildMetadataProtoFromXml() { } private static final Logger LOGGER = Logger.getLogger(BuildMetadataProtoFromXml.class.getName()); private static Boolean liteBuild; @@ -56,7 +56,7 @@ public class BuildMetadataProtoFromXml { public static void main(String[] args) { String inputFile = args[0]; String outputFile = args[1]; - liteBuild = args.length > 2 && Boolean.getBoolean(args[2]); + liteBuild = args.length > 2 && Boolean.getBoolean(args[2]); File xmlFile = new File(inputFile); try { FileOutputStream output = new FileOutputStream(outputFile); diff --git a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 3c57e9374..96e820813 100644 --- a/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -25,7 +25,6 @@ import com.google.i18n.phonenumbers.Phonemetadata.PhoneNumberDesc; import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber; import com.google.protobuf.MessageLite; - import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; @@ -74,7 +73,7 @@ public class PhoneNumberUtil { // The set of countries that share country code 262. private final Set frenchIndianOceanTerritories = new HashSet(6); - + private static final int FRENCH_INDIAN_OCEAN_COUNTRY_CODE = 262; // The PLUS_SIGN signifies the international prefix. @@ -223,7 +222,7 @@ public class PhoneNumberUtil { // version. There are two regular expressions here: the more generic one starts with optional // white space and ends with an optional full stop (.), followed by zero or more spaces/tabs and // then the numbers themselves. The other one covers the special case of American numbers where - // the extension is written with a hash at the end, such as "- 503#". + // the extension is written with a hash at the end, such as "- 503#". // Note that the only capturing groups should be around the digits that you want to capture as // part of the extension, or else parsing will fail! private static final String KNOWN_EXTN_PATTERNS = "[ \\u00A0\\t,]*(?:ext(?:ensio)?n?|" + @@ -319,7 +318,7 @@ public class PhoneNumberUtil { private void init(InputStream source) { // Read in metadata for each country. - try { + try { PhoneMetadataCollection metadataCollection = PhoneMetadataCollection.parseFrom(source); for (PhoneMetadata metadata : metadataCollection.getMetadataList()) { String regionCode = metadata.getId(); @@ -1167,7 +1166,7 @@ public class PhoneNumberUtil { * isValidNumber. See isPossibleNumber(PhoneNumber number) for details. * * This method first parses the number, then invokes isPossibleNumber(PhoneNumber number) with the - * resultant PhoneNumber object. + * resultant PhoneNumber object. * * @param number the number that needs to be checked, in the form of a string * @param countryDialingFrom the ISO 3166-1 two-letter country code that denotes @@ -1463,7 +1462,7 @@ public class PhoneNumberUtil { /** * As no equals method is implemented for MessageLite, we implement our own equals method here * to compare the serialized data. - */ + */ @VisibleForTesting static Boolean areSameMessages(MessageLite message1, MessageLite message2) { if (message1 == null && message2 == null) { @@ -1560,7 +1559,7 @@ public class PhoneNumberUtil { phoneNumber.setNationalNumber(Long.parseLong(normalizedNationalNumber.toString())); return phoneNumber.build(); } - + /** * Takes two phone numbers and compares them for equality. * diff --git a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java index 144c00e0c..0721fa619 100644 --- a/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java +++ b/java/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java @@ -761,7 +761,6 @@ public class PhoneNumberUtilTest extends TestCase { PhoneNumber number3 = PhoneNumber.newBuilder().setCountryCode(44).setNationalNumber(2070313000L).build(); assertTrue(phoneUtil.isPossibleNumber(number3)); - assertTrue(phoneUtil.isPossibleNumber("+1 650 253 0000", "US")); assertTrue(phoneUtil.isPossibleNumber("+1 650 GOO OGLE", "US")); assertTrue(phoneUtil.isPossibleNumber("(650) 253-0000", "US")); @@ -773,7 +772,6 @@ public class PhoneNumberUtilTest extends TestCase { assertTrue(phoneUtil.isPossibleNumber("3331 6005", "NZ")); } - public void testIsPossibleNumberWithReason() { // FYI, national numbers for country code +1 that are within 7 to 10 digits are possible. PhoneNumber number1 = @@ -1072,7 +1070,6 @@ public class PhoneNumberUtilTest extends TestCase { assertEquals(usNumber, phoneUtil.parse("0~01-650-333-6000", "PL")); // Check it doesn't use the '1' as a country code when parsing if the phone number was already // possible. - PhoneNumber usNumber2 = PhoneNumber.newBuilder().setCountryCode(1).setNationalNumber(1234567890L).build(); assertEquals(usNumber2, phoneUtil.parse("123-456-7890", "US"));