diff --git a/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java b/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java index f2fa9a56ac2..dcbc3cfa5f2 100755 --- a/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java +++ b/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/dev/test/lang/UCharacterTest.java,v $ -* $Date: 2003/06/03 18:49:30 $ -* $Revision: 1.56 $ +* $Date: 2003/06/03 22:41:26 $ +* $Revision: 1.57 $ * ******************************************************************************* */ @@ -284,6 +284,10 @@ public final class UCharacterTest extends TestFmwk */ public void TestNumeric() { + if (UCharacter.getNumericValue(0x00BC) != -2) { + errln("Numeric value of 0x00BC expected to be -2"); + } + for (int i = '0'; i < '9'; i ++) { int n1 = UCharacter.getNumericValue(i); double n2 = UCharacter.getUnicodeNumericValue(i); diff --git a/icu4j/src/com/ibm/icu/impl/Utility.java b/icu4j/src/com/ibm/icu/impl/Utility.java index 1197e478d38..6f9c1ea98a5 100755 --- a/icu4j/src/com/ibm/icu/impl/Utility.java +++ b/icu4j/src/com/ibm/icu/impl/Utility.java @@ -5,8 +5,8 @@ ******************************************************************************* * * $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/impl/Utility.java,v $ - * $Date: 2003/06/03 18:49:33 $ - * $Revision: 1.39 $ + * $Date: 2003/06/03 22:41:26 $ + * $Revision: 1.40 $ * ***************************************************************************************** */ @@ -19,6 +19,7 @@ public final class Utility { private static final char APOSTROPHE = '\''; private static final char BACKSLASH = '\\'; + private static final int MAGIC_UNSIGNED = 0x80000000; /** * Convenience utility to compare two Object[]s. @@ -1616,9 +1617,8 @@ public final class Utility { */ public static final int compareUnsigned(int source, int target) { - int MAGIC = 0x80000000; - source += MAGIC; - target += MAGIC; + source += MAGIC_UNSIGNED; + target += MAGIC_UNSIGNED; if (source < target) { return -1; } diff --git a/icu4j/src/com/ibm/icu/lang/UCharacter.java b/icu4j/src/com/ibm/icu/lang/UCharacter.java index 9a0aadbffac..e9ad0b19405 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: 2003/06/03 18:49:33 $ -* $Revision: 1.76 $ +* $Date: 2003/06/03 22:41:25 $ +* $Revision: 1.77 $ * ******************************************************************************* */ @@ -2346,10 +2346,11 @@ public final class UCharacter *
+ * Determines if the specified character should be regarded as an ignorable + * character in a Java identifier or a Unicode identifier. + *
+ *
+ * The following Unicode characters are ignorable in a Java identifier or a
+ * Unicode identifier:
+ * ISO control characters that are not whitespace
+ *
+ * Same as java.lang.Character.isIdentifierIgnorable() + *
+ *+ * Note that Unicode just recommends to ignore Cf (format controls). + *
+ * @param c the code point to be tested + * @return true if the code point is ignorable in identifiers according to + * Java + * + * @see #isUnicodeIdentifierStart(int) + * @see #isUnicodeIdentifierPart(int) * @stable ICU 2.1 */ public static boolean isIdentifierIgnorable(int ch) { // see java.lang.Character.isIdentifierIgnorable() on range of // ignorable characters. - return ch <= 8 || (ch >= 0xe && ch <= 0x1b) - || (ch >= 0x7f && ch <= 0x9f) - || (ch >= 0x200a && ch <= 0x200f) - || (ch >= 0x206a && ch <= 0x206f) || ch == 0xfeff; + if (ch <= 0x9f) { + return isISOControl(ch) + && !((ch >= 0x9 && ch <= 0xd) + || (ch >= 0x1c && ch <= 0x1f)); + } + return getType(ch) == UCharacterCategory.FORMAT; } /** @@ -4621,6 +4640,14 @@ public final class UCharacter ///CLOVER:ON // private methods --------------------------------------------------- + /** + * Getting the digit values of characters like 'A' - 'Z', normal, + * half-width and full-width. This method assumes that the other digit + * characters are checked by the calling method. + * @param ch character to test + * @return -1 if ch is not a character of the form 'A' - 'Z', otherwise + * its corresponding digit will be returned. + */ private static int getEuropeanDigit(int ch) { if ((ch > 0x7a && ch < 0xff21) || ch < 0x41 || (ch > 0x5a && ch < 0x61) @@ -4665,11 +4692,14 @@ public final class UCharacter * This is optimized. * Note this is alittle different from CharTrie the index m_trieData_ * is never negative. + * This is a duplicate of UCharacterProperty.getProperty. For optimization + * purposes, this method calls the trie data directly instead of through + * UCharacterProperty.getProperty. * @param ch code point whose property value is to be retrieved * @return property value of code point * @draft ICU 2.6 */ - public static int getProperty(int ch) + private static int getProperty(int ch) { if (ch < UTF16.LEAD_SURROGATE_MIN_VALUE || (ch > UTF16.LEAD_SURROGATE_MAX_VALUE