Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 22931 invoked from network); 22 Sep 2006 03:07:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Sep 2006 03:07:03 -0000 Received: (qmail 60534 invoked by uid 500); 22 Sep 2006 03:07:02 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 60510 invoked by uid 500); 22 Sep 2006 03:07:02 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 60499 invoked by uid 99); 22 Sep 2006 03:07:02 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Sep 2006 20:07:02 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=pyang@apache.org; spf=permerror X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received-SPF: error (idunn.apache.osuosl.org: domain apache.org from 140.211.166.113 cause and error) Received: from [140.211.166.113] ([140.211.166.113:64655] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 70/B6-06791-E4353154 for ; Thu, 21 Sep 2006 20:06:55 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5E2341A981D; Thu, 21 Sep 2006 20:06:52 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r448784 [2/3] - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/Character.java test/java/org/apache/harmony/luni/tests/java/lang/CharacterTest.java Date: Fri, 22 Sep 2006 03:06:51 -0000 To: harmony-commits@incubator.apache.org From: pyang@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20060922030652.5E2341A981D@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java?view=diff&rev=448784&r1=448783&r2=448784 ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Character.java Thu Sep 21 20:06:51 2006 @@ -19,6 +19,8 @@ import java.util.SortedMap; import java.util.TreeMap; +import org.apache.harmony.luni.util.BinarySearch; + import com.ibm.icu.lang.UCharacter; /** @@ -55,313 +57,313 @@ * @since 1.0 */ public final class Character implements Serializable, Comparable { - private static final long serialVersionUID = 3786198910865385080L; + private static final long serialVersionUID = 3786198910865385080L; + + private final char value; + + /** + * The minimum possible Character value. + */ + public static final char MIN_VALUE = '\u0000'; + + /** + * The maximum possible Character value. + */ + public static final char MAX_VALUE = '\uffff'; + + /** + * The minimum possible radix used for conversions between Characters and + * integers. + */ + public static final int MIN_RADIX = 2; - private final char value; + /** + * The maximum possible radix used for conversions between Characters and + * integers. + */ + public static final int MAX_RADIX = 36; - /** - * The minimum possible Character value. - */ - public static final char MIN_VALUE = '\u0000'; - - /** - * The maximum possible Character value. - */ - public static final char MAX_VALUE = '\uffff'; - - /** - * The minimum possible radix used for conversions between Characters and - * integers. - */ - public static final int MIN_RADIX = 2; - - /** - * The maximum possible radix used for conversions between Characters and - * integers. - */ - public static final int MAX_RADIX = 36; - - /** - * The char {@link Class} object. - */ + /** + * The char {@link Class} object. + */ @SuppressWarnings("unchecked") public static final Class TYPE = (Class) new char[0] .getClass().getComponentType(); - // Note: This can't be set to "char.class", since *that* is - // defined to be "java.lang.Character.TYPE"; + // Note: This can't be set to "char.class", since *that* is + // defined to be "java.lang.Character.TYPE"; - /** - * Unicode category constant Cn. - */ - public static final byte UNASSIGNED = 0; + /** + * Unicode category constant Cn. + */ + public static final byte UNASSIGNED = 0; - /** - * Unicode category constant Lu. - */ - public static final byte UPPERCASE_LETTER = 1; + /** + * Unicode category constant Lu. + */ + public static final byte UPPERCASE_LETTER = 1; - /** - * Unicode category constant Ll. - */ - public static final byte LOWERCASE_LETTER = 2; + /** + * Unicode category constant Ll. + */ + public static final byte LOWERCASE_LETTER = 2; - /** - * Unicode category constant Lt. - */ - public static final byte TITLECASE_LETTER = 3; + /** + * Unicode category constant Lt. + */ + public static final byte TITLECASE_LETTER = 3; - /** - * Unicode category constant Lm. - */ - public static final byte MODIFIER_LETTER = 4; + /** + * Unicode category constant Lm. + */ + public static final byte MODIFIER_LETTER = 4; - /** - * Unicode category constant Lo. - */ - public static final byte OTHER_LETTER = 5; + /** + * Unicode category constant Lo. + */ + public static final byte OTHER_LETTER = 5; - /** - * Unicode category constant Mn. - */ - public static final byte NON_SPACING_MARK = 6; + /** + * Unicode category constant Mn. + */ + public static final byte NON_SPACING_MARK = 6; - /** - * Unicode category constant Me. - */ - public static final byte ENCLOSING_MARK = 7; + /** + * Unicode category constant Me. + */ + public static final byte ENCLOSING_MARK = 7; - /** - * Unicode category constant Mc. - */ - public static final byte COMBINING_SPACING_MARK = 8; + /** + * Unicode category constant Mc. + */ + public static final byte COMBINING_SPACING_MARK = 8; - /** - * Unicode category constant Nd. - */ - public static final byte DECIMAL_DIGIT_NUMBER = 9; + /** + * Unicode category constant Nd. + */ + public static final byte DECIMAL_DIGIT_NUMBER = 9; - /** - * Unicode category constant Nl. - */ - public static final byte LETTER_NUMBER = 10; + /** + * Unicode category constant Nl. + */ + public static final byte LETTER_NUMBER = 10; - /** - * Unicode category constant No. - */ - public static final byte OTHER_NUMBER = 11; + /** + * Unicode category constant No. + */ + public static final byte OTHER_NUMBER = 11; - /** - * Unicode category constant Zs. - */ - public static final byte SPACE_SEPARATOR = 12; + /** + * Unicode category constant Zs. + */ + public static final byte SPACE_SEPARATOR = 12; - /** - * Unicode category constant Zl. - */ - public static final byte LINE_SEPARATOR = 13; + /** + * Unicode category constant Zl. + */ + public static final byte LINE_SEPARATOR = 13; - /** - * Unicode category constant Zp. - */ - public static final byte PARAGRAPH_SEPARATOR = 14; + /** + * Unicode category constant Zp. + */ + public static final byte PARAGRAPH_SEPARATOR = 14; - /** - * Unicode category constant Cc. - */ - public static final byte CONTROL = 15; + /** + * Unicode category constant Cc. + */ + public static final byte CONTROL = 15; - /** - * Unicode category constant Cf. - */ - public static final byte FORMAT = 16; + /** + * Unicode category constant Cf. + */ + public static final byte FORMAT = 16; - /** - * Unicode category constant Co. - */ - public static final byte PRIVATE_USE = 18; + /** + * Unicode category constant Co. + */ + public static final byte PRIVATE_USE = 18; - /** - * Unicode category constant Cs. - */ - public static final byte SURROGATE = 19; + /** + * Unicode category constant Cs. + */ + public static final byte SURROGATE = 19; - /** - * Unicode category constant Pd. - */ - public static final byte DASH_PUNCTUATION = 20; + /** + * Unicode category constant Pd. + */ + public static final byte DASH_PUNCTUATION = 20; - /** - * Unicode category constant Ps. - */ - public static final byte START_PUNCTUATION = 21; + /** + * Unicode category constant Ps. + */ + public static final byte START_PUNCTUATION = 21; - /** - * Unicode category constant Pe. - */ - public static final byte END_PUNCTUATION = 22; + /** + * Unicode category constant Pe. + */ + public static final byte END_PUNCTUATION = 22; - /** - * Unicode category constant Pc. - */ - public static final byte CONNECTOR_PUNCTUATION = 23; + /** + * Unicode category constant Pc. + */ + public static final byte CONNECTOR_PUNCTUATION = 23; - /** - * Unicode category constant Po. - */ - public static final byte OTHER_PUNCTUATION = 24; + /** + * Unicode category constant Po. + */ + public static final byte OTHER_PUNCTUATION = 24; - /** - * Unicode category constant Sm. - */ - public static final byte MATH_SYMBOL = 25; + /** + * Unicode category constant Sm. + */ + public static final byte MATH_SYMBOL = 25; - /** - * Unicode category constant Sc. - */ - public static final byte CURRENCY_SYMBOL = 26; + /** + * Unicode category constant Sc. + */ + public static final byte CURRENCY_SYMBOL = 26; - /** - * Unicode category constant Sk. - */ - public static final byte MODIFIER_SYMBOL = 27; + /** + * Unicode category constant Sk. + */ + public static final byte MODIFIER_SYMBOL = 27; - /** - * Unicode category constant So. - */ - public static final byte OTHER_SYMBOL = 28; + /** + * Unicode category constant So. + */ + public static final byte OTHER_SYMBOL = 28; - /** - * Unicode category constant Pi. + /** + * Unicode category constant Pi. * @since 1.4 - */ - public static final byte INITIAL_QUOTE_PUNCTUATION = 29; + */ + public static final byte INITIAL_QUOTE_PUNCTUATION = 29; - /** - * Unicode category constant Pf. + /** + * Unicode category constant Pf. * @since 1.4 - */ - public static final byte FINAL_QUOTE_PUNCTUATION = 30; + */ + public static final byte FINAL_QUOTE_PUNCTUATION = 30; - /** - * Unicode bidirectional constant. + /** + * Unicode bidirectional constant. * @since 1.4 - */ - public static final byte DIRECTIONALITY_UNDEFINED = -1; + */ + public static final byte DIRECTIONALITY_UNDEFINED = -1; - /** - * Unicode bidirectional constant L. + /** + * Unicode bidirectional constant L. * @since 1.4 - */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; + */ + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; - /** - * Unicode bidirectional constant R. + /** + * Unicode bidirectional constant R. * @since 1.4 - */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; + */ + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; - /** - * Unicode bidirectional constant AL. + /** + * Unicode bidirectional constant AL. * @since 1.4 - */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; + */ + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; - /** - * Unicode bidirectional constant EN. + /** + * Unicode bidirectional constant EN. * @since 1.4 - */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; + */ + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; - /** - * Unicode bidirectional constant ES. + /** + * Unicode bidirectional constant ES. * @since 1.4 - */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; + */ + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; - /** - * Unicode bidirectional constant ET. + /** + * Unicode bidirectional constant ET. * @since 1.4 - */ - public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; + */ + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; - /** - * Unicode bidirectional constant AN. + /** + * Unicode bidirectional constant AN. * @since 1.4 - */ - public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; + */ + public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; - /** - * Unicode bidirectional constant CS. + /** + * Unicode bidirectional constant CS. * @since 1.4 - */ - public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; + */ + public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; - /** - * Unicode bidirectional constant NSM. + /** + * Unicode bidirectional constant NSM. * @since 1.4 - */ - public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; + */ + public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; - /** - * Unicode bidirectional constant BN. + /** + * Unicode bidirectional constant BN. * @since 1.4 - */ - public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; + */ + public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; - /** - * Unicode bidirectional constant B. + /** + * Unicode bidirectional constant B. * @since 1.4 - */ - public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; + */ + public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; - /** - * Unicode bidirectional constant S. + /** + * Unicode bidirectional constant S. * @since 1.4 - */ - public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; + */ + public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; - /** - * Unicode bidirectional constant WS. + /** + * Unicode bidirectional constant WS. * @since 1.4 - */ - public static final byte DIRECTIONALITY_WHITESPACE = 12; + */ + public static final byte DIRECTIONALITY_WHITESPACE = 12; - /** - * Unicode bidirectional constant ON. + /** + * Unicode bidirectional constant ON. * @since 1.4 - */ - public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; + */ + public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; - /** - * Unicode bidirectional constant LRE. + /** + * Unicode bidirectional constant LRE. * @since 1.4 - */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; + */ + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; - /** - * Unicode bidirectional constant LRO. + /** + * Unicode bidirectional constant LRO. * @since 1.4 - */ - public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; + */ + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; - /** - * Unicode bidirectional constant RLE. + /** + * Unicode bidirectional constant RLE. * @since 1.4 - */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; + */ + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; - /** - * Unicode bidirectional constant RLO. + /** + * Unicode bidirectional constant RLO. * @since 1.4 - */ - public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; + */ + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; - /** - * Unicode bidirectional constant PDF. + /** + * Unicode bidirectional constant PDF. * @since 1.4 - */ - public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; + */ + public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; /** *

@@ -457,39 +459,39 @@ */ public static final int SIZE = 16; - // Unicode 3.0.1 (same as Unicode 3.0.0) - private static final String bidiKeys = "\u0000\t\f\u000e\u001c\u001f!#&+/1:c is null. * @since 1.2 */ - public int compareTo(Character c) { - return value - c.value; - } + public int compareTo(Character c) { + return value - c.value; + } - /* + /* * Provides a cache for the 'valueOf' method. A size of 512 should cache the * first couple pages of Unicode, which includes the ASCII/Latin-1 * characters, which other parts of this class are optimized for. @@ -1951,8 +1953,8 @@ */ public static int codePointAt(char[] seq, int index, int limit) { if (index < 0 || index >= limit || limit < 0 || limit > seq.length) { - throw new IndexOutOfBoundsException(); - } + throw new IndexOutOfBoundsException(); + } char high = seq[index++]; if (index >= limit) { @@ -2415,7 +2417,7 @@ return i; } - /** + /** * Convenient method to determine the value of character c in [... 1104 lines stripped ...]