From b376743cffd0626a897bb5d4c14efc86b29bd348 Mon Sep 17 00:00:00 2001 From: David Beaumont Date: Wed, 8 Jul 2020 14:00:30 +0200 Subject: [PATCH] Project import generated by Copybara. (#2498) PiperOrigin-RevId: 320135887 Co-authored-by: The libphonenumber Team --- metadata/pom.xml | 13 +++++++++- .../metadata/RangeSpecification.java | 2 +- .../metadata/model/FormatSpec.java | 25 ++++++------------- .../metadata/model/RangesTableSchema.java | 2 +- .../metadata/table/RangeTable.java | 2 +- .../phonenumbers/metadata/table/Schema.java | 5 ++-- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/metadata/pom.xml b/metadata/pom.xml index 651acda07..ed7a297ac 100644 --- a/metadata/pom.xml +++ b/metadata/pom.xml @@ -49,6 +49,17 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + 8 + true + true + all,-missing + + @@ -119,4 +130,4 @@ test - \ No newline at end of file + diff --git a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/RangeSpecification.java b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/RangeSpecification.java index f3f833cee..d0ec2711c 100644 --- a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/RangeSpecification.java +++ b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/RangeSpecification.java @@ -425,7 +425,7 @@ public final class RangeSpecification implements Comparable } /** - * Returns the bitmask of the Nth range in this specification. Bit-X (0<= X <= 9) corresponds to + * Returns the bitmask of the Nth range in this specification. Bit-X (0 ≤ X ≤ 9) corresponds to * the digit with value X. As every range in a specification must match at least one digit, this * mask can never be zero. */ diff --git a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/FormatSpec.java b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/FormatSpec.java index d5110ef7e..ef2ddff51 100644 --- a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/FormatSpec.java +++ b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/FormatSpec.java @@ -240,15 +240,6 @@ public abstract class FormatSpec { // formatting around the first group (i.e. never "(XXX) XXX XXX") which makes sense since // international formats cannot be assumed to be read by people with local knowledge. - // TODO: To reactivate this check after we are sure that first digit of - // SN of MX is no more 1 and need not to be swallowed when formatting i.e after parsing change. - // Context: We have disabled the following check to fix a MX formatting issue i.e using this - // logic {X>} to remove the mobile token(1) in international format, which is the first digit of - // the mobile subscriber number. More details in b/111967450. In general, international - // format should not have such special formatting. Can be fixed as part of b/138727490. - - // checkArgument(!intl.getXmlPrefix().isPresent(), - // "international format specifier must not have separate prefix: %s", spec); checkArgument( !intl.hasNationalPrefix(), "international format specifier must not contain national prefix: %s", @@ -471,10 +462,10 @@ public abstract class FormatSpec { * *

For example given the following templates: *

    - *
  • {@code "XXX XXX-XXX"} ==> {@code "$1 $2-$3"} - *
  • {@code "(#XXX) XXX-XXX"} ==> {@code "$1 $2-$3"} (the prefix is hoisted) - *
  • {@code "#{XXX>123} XXX-XXX"} ==> {@code "$2-$3"} ($1 was replaced and hoisted) - *
  • {@code "{X>}XXX-XXX"} ==> {@code "$2-$3"} ($1 was removed) + *
  • {@code "XXX XXX-XXX"} ⟹ {@code "$1 $2-$3"} + *
  • {@code "(#XXX) XXX-XXX"} ⟹ {@code "$1 $2-$3"} (the prefix is hoisted) + *
  • {@code "#{XXX>123} XXX-XXX"} ⟹ {@code "$2-$3"} ($1 was replaced and hoisted) + *
  • {@code "{X>}XXX-XXX"} ⟹ {@code "$2-$3"} ($1 was removed) *
*/ public String getXmlFormat() { @@ -500,10 +491,10 @@ public abstract class FormatSpec { * *

For example given the following templates: *

    - *
  • {@code "XXX XXX-XXX"} ==> XML prefix is empty - *
  • {@code "(#XXX) XXX-XXX"} ==> {@code "($NP$FG)"} - *
  • {@code "#{XXX>123} XXX-XXX"} ==> {@code "$NP123 $FG"} - *
  • {@code "{X>}XXX-XXX"} ==> XML prefix is empty (but the format will not contain $1) + *
  • {@code "XXX XXX-XXX"} ⟹ XML prefix is empty + *
  • {@code "(#XXX) XXX-XXX"} ⟹ {@code "($NP$FG)"} + *
  • {@code "#{XXX>123} XXX-XXX"} ⟹ {@code "$NP123 $FG"} + *
  • {@code "{X>}XXX-XXX"} ⟹ XML prefix is empty (but the format will not contain $1) *
*/ public Optional getXmlPrefix() { diff --git a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/RangesTableSchema.java b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/RangesTableSchema.java index e15fe834e..8fb662e37 100644 --- a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/RangesTableSchema.java +++ b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/model/RangesTableSchema.java @@ -204,7 +204,7 @@ public final class RangesTableSchema { /** The ID of the format assigned to a range. */ public static final Column FORMAT = Column.ofString("Format"); - /** An '&'-separated list of timezone IDs associated with this range. */ + /** An '&'-separated list of timezone IDs associated with this range. */ public static final Column TIMEZONE = Timezones.column("Timezone"); /** The "Region:XX" column group in the range table. */ diff --git a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/RangeTable.java b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/RangeTable.java index 07be2fee1..c7db3f78d 100644 --- a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/RangeTable.java +++ b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/RangeTable.java @@ -613,7 +613,7 @@ public final class RangeTable { * *

An example of an "impossible" prefix would be if "123" has value A, "1234" has value B and * "12345" has value A again. In this case there is no prefix which can distinguish A and B - * (the calculated map would be { "123" => A, "1234" => B }). In this situation, testing for the + * (the calculated map would be { "123" ⟹ A, "1234" ⟹ B }). In this situation, testing for the * longer prefix would help preserve as much of the original mapping as possible, but it would * never be possible to correctly distinguish all inputs. */ diff --git a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/Schema.java b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/Schema.java index a6d7429e9..eaf4e7236 100644 --- a/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/Schema.java +++ b/metadata/src/main/java/com/google/i18n/phonenumbers/metadata/table/Schema.java @@ -88,13 +88,14 @@ public abstract class Schema { * is just the column name. For group columns, the key takes the form "prefix:suffix", where the * prefix is the name of the "prototype" column, and the "suffix" is an ID of a value within the * group. For example: - *

{@oode + * + *

 {@code
    * // Schema has a plain column called "Type" in it.
    * typeCol = table.getColumn("Type");
    *
    * // Schema has a group called "Region" in it which can parse RegionCodes.
    * usRegionCol = table.getColumn("Region:US");
-   * }

+ * }
*/ public Column getColumn(String key) { int split = key.indexOf(':');