From 9fec1baba212f10f2a8443412aa58b8266ede25d Mon Sep 17 00:00:00 2001 From: Syn Wee Quek Date: Sat, 17 Mar 2001 01:36:32 +0000 Subject: [PATCH] Updated isPrintable to synch with ICU. X-SVN-Rev: 4159 --- icu4j/src/com/ibm/icu/lang/UCharacter.java | 65 ++++++---------------- icu4j/src/com/ibm/text/UCharacter.java | 65 ++++++---------------- icu4j/src/com/ibm/text/UGenPropReader.java | 6 +- icu4j/src/com/ibm/text/uprops.dat | 4 +- 4 files changed, 37 insertions(+), 103 deletions(-) diff --git a/icu4j/src/com/ibm/icu/lang/UCharacter.java b/icu4j/src/com/ibm/icu/lang/UCharacter.java index 1e4da820ee..4153fb269b 100755 --- a/icu4j/src/com/ibm/icu/lang/UCharacter.java +++ b/icu4j/src/com/ibm/icu/lang/UCharacter.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/lang/UCharacter.java,v $ -* $Date: 2001/03/07 02:52:05 $ -* $Revision: 1.2 $ +* $Date: 2001/03/17 01:36:32 $ +* $Revision: 1.3 $ * ******************************************************************************* */ @@ -322,7 +322,11 @@ public final class UCharacter */ private static final char GREEK_SMALL_LETTER_RHO_ = 0x3c2; - + /** + * ISO control character first range upper limit 0x0 - 0x1F + */ + private static final int ISO_CONTROL_FIRST_RANGE_MAX_ = 0x1F; + // constructor ==================================================== /** @@ -920,29 +924,6 @@ public final class UCharacter return (ch >= 0 && ch < LAST_CHAR_MASK_); } - /** - * Determines whether the specified code point is a control character or not. - *
- * A code point is considered a control character if it is of either type - * - * @param ch the code point to be determined if it is a control character - * @return true if the code point is a control character - */ - public static boolean isControl(int ch) - { - int cat = getType(ch); - // if props == 0, it will just fall through and return false - return cat == UCharacterCategory.CONTROL || - cat == UCharacterCategory.FORMAT || - cat == UCharacterCategory.LINE_SEPARATOR || - cat == UCharacterCategory.PARAGRAPH_SEPARATOR; - } - /** * Determines whether the specified code point is a printable character * according to the Unicode standard. @@ -951,31 +932,17 @@ public final class UCharacter */ public static boolean isPrintable(int ch) { + if (isISOControl(ch)) { + return false; + } int cat = getType(ch); // if props == 0, it will just fall through and return false - return cat == UCharacterCategory.DECIMAL_DIGIT_NUMBER || - cat == UCharacterCategory.OTHER_NUMBER || - cat == UCharacterCategory.LETTER_NUMBER || - cat == UCharacterCategory.UPPERCASE_LETTER || - cat == UCharacterCategory.LOWERCASE_LETTER || - cat == UCharacterCategory.TITLECASE_LETTER || - cat == UCharacterCategory.MODIFIER_LETTER || - cat == UCharacterCategory.OTHER_LETTER || - cat == UCharacterCategory.NON_SPACING_MARK || - cat == UCharacterCategory.ENCLOSING_MARK || - cat == UCharacterCategory.COMBINING_SPACING_MARK || - cat == UCharacterCategory.SPACE_SEPARATOR || - cat == UCharacterCategory.LINE_SEPARATOR || - cat == UCharacterCategory.PARAGRAPH_SEPARATOR || - cat == UCharacterCategory.DASH_PUNCTUATION || - cat == UCharacterCategory.START_PUNCTUATION || - cat == UCharacterCategory.END_PUNCTUATION || - cat == UCharacterCategory.CONNECTOR_PUNCTUATION || - cat == UCharacterCategory.OTHER_PUNCTUATION || - cat == UCharacterCategory.MATH_SYMBOL || - cat == UCharacterCategory.CURRENCY_SYMBOL || - cat == UCharacterCategory.MODIFIER_SYMBOL || - cat == UCharacterCategory.OTHER_SYMBOL; + return (cat != UCharacterCategory.UNASSIGNED && + cat != UCharacterCategory.CONTROL && + cat != UCharacterCategory.FORMAT && + cat != UCharacterCategory.PRIVATE_USE && + cat != UCharacterCategory.SURROGATE && + cat != UCharacterCategory.GENERAL_OTHER_TYPES); } /** diff --git a/icu4j/src/com/ibm/text/UCharacter.java b/icu4j/src/com/ibm/text/UCharacter.java index 4e708e8a4c..64b0829d93 100755 --- a/icu4j/src/com/ibm/text/UCharacter.java +++ b/icu4j/src/com/ibm/text/UCharacter.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/UCharacter.java,v $ -* $Date: 2001/03/07 02:52:05 $ -* $Revision: 1.2 $ +* $Date: 2001/03/17 01:36:32 $ +* $Revision: 1.3 $ * ******************************************************************************* */ @@ -322,7 +322,11 @@ public final class UCharacter */ private static final char GREEK_SMALL_LETTER_RHO_ = 0x3c2; - + /** + * ISO control character first range upper limit 0x0 - 0x1F + */ + private static final int ISO_CONTROL_FIRST_RANGE_MAX_ = 0x1F; + // constructor ==================================================== /** @@ -920,29 +924,6 @@ public final class UCharacter return (ch >= 0 && ch < LAST_CHAR_MASK_); } - /** - * Determines whether the specified code point is a control character or not. - *
- * A code point is considered a control character if it is of either type - * - * @param ch the code point to be determined if it is a control character - * @return true if the code point is a control character - */ - public static boolean isControl(int ch) - { - int cat = getType(ch); - // if props == 0, it will just fall through and return false - return cat == UCharacterCategory.CONTROL || - cat == UCharacterCategory.FORMAT || - cat == UCharacterCategory.LINE_SEPARATOR || - cat == UCharacterCategory.PARAGRAPH_SEPARATOR; - } - /** * Determines whether the specified code point is a printable character * according to the Unicode standard. @@ -951,31 +932,17 @@ public final class UCharacter */ public static boolean isPrintable(int ch) { + if (isISOControl(ch)) { + return false; + } int cat = getType(ch); // if props == 0, it will just fall through and return false - return cat == UCharacterCategory.DECIMAL_DIGIT_NUMBER || - cat == UCharacterCategory.OTHER_NUMBER || - cat == UCharacterCategory.LETTER_NUMBER || - cat == UCharacterCategory.UPPERCASE_LETTER || - cat == UCharacterCategory.LOWERCASE_LETTER || - cat == UCharacterCategory.TITLECASE_LETTER || - cat == UCharacterCategory.MODIFIER_LETTER || - cat == UCharacterCategory.OTHER_LETTER || - cat == UCharacterCategory.NON_SPACING_MARK || - cat == UCharacterCategory.ENCLOSING_MARK || - cat == UCharacterCategory.COMBINING_SPACING_MARK || - cat == UCharacterCategory.SPACE_SEPARATOR || - cat == UCharacterCategory.LINE_SEPARATOR || - cat == UCharacterCategory.PARAGRAPH_SEPARATOR || - cat == UCharacterCategory.DASH_PUNCTUATION || - cat == UCharacterCategory.START_PUNCTUATION || - cat == UCharacterCategory.END_PUNCTUATION || - cat == UCharacterCategory.CONNECTOR_PUNCTUATION || - cat == UCharacterCategory.OTHER_PUNCTUATION || - cat == UCharacterCategory.MATH_SYMBOL || - cat == UCharacterCategory.CURRENCY_SYMBOL || - cat == UCharacterCategory.MODIFIER_SYMBOL || - cat == UCharacterCategory.OTHER_SYMBOL; + return (cat != UCharacterCategory.UNASSIGNED && + cat != UCharacterCategory.CONTROL && + cat != UCharacterCategory.FORMAT && + cat != UCharacterCategory.PRIVATE_USE && + cat != UCharacterCategory.SURROGATE && + cat != UCharacterCategory.GENERAL_OTHER_TYPES); } /** diff --git a/icu4j/src/com/ibm/text/UGenPropReader.java b/icu4j/src/com/ibm/text/UGenPropReader.java index 6a9995c8df..770379c795 100755 --- a/icu4j/src/com/ibm/text/UGenPropReader.java +++ b/icu4j/src/com/ibm/text/UGenPropReader.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/text/Attic/UGenPropReader.java,v $ -* $Date: 2001/03/07 02:52:05 $ -* $Revision: 1.2 $ +* $Date: 2001/03/17 01:36:32 $ +* $Revision: 1.3 $ * ******************************************************************************* */ @@ -66,7 +66,7 @@ final class UGenPropReader extends UGenReader private static final byte DATA_FORMAT_ID_[] = {(byte)0x55, (byte)0x50, (byte)0x72, (byte)0x6F}; private static final byte DATA_FORMAT_VERSION_[] = - {(byte)0x1, (byte)0x2, (byte)0x0, (byte)0x0}; + {(byte)0x1, (byte)0x3, (byte)0x0, (byte)0x0}; /** * Corrupted error string diff --git a/icu4j/src/com/ibm/text/uprops.dat b/icu4j/src/com/ibm/text/uprops.dat index 992b951d62..f7cea8bbfd 100755 --- a/icu4j/src/com/ibm/text/uprops.dat +++ b/icu4j/src/com/ibm/text/uprops.dat @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1cf9869af246135c8c52891f308fe202681a7abd2892d8aefd5a99fded6fc40e -size 25268 +oid sha256:83064e82c1c71bf6af23d623fe79f2737c14a1be8aa65eb977a9133e4a8f80b3 +size 26420