1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/emul/src/main/java/java/lang/Character.java Sat Sep 29 11:01:22 2012 +0200
1.3 @@ -0,0 +1,7032 @@
1.4 +/*
1.5 + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 + *
1.8 + * This code is free software; you can redistribute it and/or modify it
1.9 + * under the terms of the GNU General Public License version 2 only, as
1.10 + * published by the Free Software Foundation. Oracle designates this
1.11 + * particular file as subject to the "Classpath" exception as provided
1.12 + * by Oracle in the LICENSE file that accompanied this code.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 + * version 2 for more details (a copy is included in the LICENSE file that
1.18 + * accompanied this code).
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License version
1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 + *
1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 + * or visit www.oracle.com if you need additional information or have any
1.26 + * questions.
1.27 + */
1.28 +
1.29 +package java.lang;
1.30 +
1.31 +import java.util.Arrays;
1.32 +import java.util.Map;
1.33 +import java.util.HashMap;
1.34 +import java.util.Locale;
1.35 +
1.36 +/**
1.37 + * The {@code Character} class wraps a value of the primitive
1.38 + * type {@code char} in an object. An object of type
1.39 + * {@code Character} contains a single field whose type is
1.40 + * {@code char}.
1.41 + * <p>
1.42 + * In addition, this class provides several methods for determining
1.43 + * a character's category (lowercase letter, digit, etc.) and for converting
1.44 + * characters from uppercase to lowercase and vice versa.
1.45 + * <p>
1.46 + * Character information is based on the Unicode Standard, version 6.0.0.
1.47 + * <p>
1.48 + * The methods and data of class {@code Character} are defined by
1.49 + * the information in the <i>UnicodeData</i> file that is part of the
1.50 + * Unicode Character Database maintained by the Unicode
1.51 + * Consortium. This file specifies various properties including name
1.52 + * and general category for every defined Unicode code point or
1.53 + * character range.
1.54 + * <p>
1.55 + * The file and its description are available from the Unicode Consortium at:
1.56 + * <ul>
1.57 + * <li><a href="http://www.unicode.org">http://www.unicode.org</a>
1.58 + * </ul>
1.59 + *
1.60 + * <h4><a name="unicode">Unicode Character Representations</a></h4>
1.61 + *
1.62 + * <p>The {@code char} data type (and therefore the value that a
1.63 + * {@code Character} object encapsulates) are based on the
1.64 + * original Unicode specification, which defined characters as
1.65 + * fixed-width 16-bit entities. The Unicode Standard has since been
1.66 + * changed to allow for characters whose representation requires more
1.67 + * than 16 bits. The range of legal <em>code point</em>s is now
1.68 + * U+0000 to U+10FFFF, known as <em>Unicode scalar value</em>.
1.69 + * (Refer to the <a
1.70 + * href="http://www.unicode.org/reports/tr27/#notation"><i>
1.71 + * definition</i></a> of the U+<i>n</i> notation in the Unicode
1.72 + * Standard.)
1.73 + *
1.74 + * <p><a name="BMP">The set of characters from U+0000 to U+FFFF is
1.75 + * sometimes referred to as the <em>Basic Multilingual Plane (BMP)</em>.
1.76 + * <a name="supplementary">Characters</a> whose code points are greater
1.77 + * than U+FFFF are called <em>supplementary character</em>s. The Java
1.78 + * platform uses the UTF-16 representation in {@code char} arrays and
1.79 + * in the {@code String} and {@code StringBuffer} classes. In
1.80 + * this representation, supplementary characters are represented as a pair
1.81 + * of {@code char} values, the first from the <em>high-surrogates</em>
1.82 + * range, (\uD800-\uDBFF), the second from the
1.83 + * <em>low-surrogates</em> range (\uDC00-\uDFFF).
1.84 + *
1.85 + * <p>A {@code char} value, therefore, represents Basic
1.86 + * Multilingual Plane (BMP) code points, including the surrogate
1.87 + * code points, or code units of the UTF-16 encoding. An
1.88 + * {@code int} value represents all Unicode code points,
1.89 + * including supplementary code points. The lower (least significant)
1.90 + * 21 bits of {@code int} are used to represent Unicode code
1.91 + * points and the upper (most significant) 11 bits must be zero.
1.92 + * Unless otherwise specified, the behavior with respect to
1.93 + * supplementary characters and surrogate {@code char} values is
1.94 + * as follows:
1.95 + *
1.96 + * <ul>
1.97 + * <li>The methods that only accept a {@code char} value cannot support
1.98 + * supplementary characters. They treat {@code char} values from the
1.99 + * surrogate ranges as undefined characters. For example,
1.100 + * {@code Character.isLetter('\u005CuD840')} returns {@code false}, even though
1.101 + * this specific value if followed by any low-surrogate value in a string
1.102 + * would represent a letter.
1.103 + *
1.104 + * <li>The methods that accept an {@code int} value support all
1.105 + * Unicode characters, including supplementary characters. For
1.106 + * example, {@code Character.isLetter(0x2F81A)} returns
1.107 + * {@code true} because the code point value represents a letter
1.108 + * (a CJK ideograph).
1.109 + * </ul>
1.110 + *
1.111 + * <p>In the Java SE API documentation, <em>Unicode code point</em> is
1.112 + * used for character values in the range between U+0000 and U+10FFFF,
1.113 + * and <em>Unicode code unit</em> is used for 16-bit
1.114 + * {@code char} values that are code units of the <em>UTF-16</em>
1.115 + * encoding. For more information on Unicode terminology, refer to the
1.116 + * <a href="http://www.unicode.org/glossary/">Unicode Glossary</a>.
1.117 + *
1.118 + * @author Lee Boynton
1.119 + * @author Guy Steele
1.120 + * @author Akira Tanaka
1.121 + * @author Martin Buchholz
1.122 + * @author Ulf Zibis
1.123 + * @since 1.0
1.124 + */
1.125 +public final
1.126 +class Character implements java.io.Serializable, Comparable<Character> {
1.127 + /**
1.128 + * The minimum radix available for conversion to and from strings.
1.129 + * The constant value of this field is the smallest value permitted
1.130 + * for the radix argument in radix-conversion methods such as the
1.131 + * {@code digit} method, the {@code forDigit} method, and the
1.132 + * {@code toString} method of class {@code Integer}.
1.133 + *
1.134 + * @see Character#digit(char, int)
1.135 + * @see Character#forDigit(int, int)
1.136 + * @see Integer#toString(int, int)
1.137 + * @see Integer#valueOf(String)
1.138 + */
1.139 + public static final int MIN_RADIX = 2;
1.140 +
1.141 + /**
1.142 + * The maximum radix available for conversion to and from strings.
1.143 + * The constant value of this field is the largest value permitted
1.144 + * for the radix argument in radix-conversion methods such as the
1.145 + * {@code digit} method, the {@code forDigit} method, and the
1.146 + * {@code toString} method of class {@code Integer}.
1.147 + *
1.148 + * @see Character#digit(char, int)
1.149 + * @see Character#forDigit(int, int)
1.150 + * @see Integer#toString(int, int)
1.151 + * @see Integer#valueOf(String)
1.152 + */
1.153 + public static final int MAX_RADIX = 36;
1.154 +
1.155 + /**
1.156 + * The constant value of this field is the smallest value of type
1.157 + * {@code char}, {@code '\u005Cu0000'}.
1.158 + *
1.159 + * @since 1.0.2
1.160 + */
1.161 + public static final char MIN_VALUE = '\u0000';
1.162 +
1.163 + /**
1.164 + * The constant value of this field is the largest value of type
1.165 + * {@code char}, {@code '\u005CuFFFF'}.
1.166 + *
1.167 + * @since 1.0.2
1.168 + */
1.169 + public static final char MAX_VALUE = '\uFFFF';
1.170 +
1.171 + /**
1.172 + * The {@code Class} instance representing the primitive type
1.173 + * {@code char}.
1.174 + *
1.175 + * @since 1.1
1.176 + */
1.177 + @SuppressWarnings("unchecked")
1.178 + public static final Class<Character> TYPE = Class.getPrimitiveClass("char");
1.179 +
1.180 + /*
1.181 + * Normative general types
1.182 + */
1.183 +
1.184 + /*
1.185 + * General character types
1.186 + */
1.187 +
1.188 + /**
1.189 + * General category "Cn" in the Unicode specification.
1.190 + * @since 1.1
1.191 + */
1.192 + public static final byte UNASSIGNED = 0;
1.193 +
1.194 + /**
1.195 + * General category "Lu" in the Unicode specification.
1.196 + * @since 1.1
1.197 + */
1.198 + public static final byte UPPERCASE_LETTER = 1;
1.199 +
1.200 + /**
1.201 + * General category "Ll" in the Unicode specification.
1.202 + * @since 1.1
1.203 + */
1.204 + public static final byte LOWERCASE_LETTER = 2;
1.205 +
1.206 + /**
1.207 + * General category "Lt" in the Unicode specification.
1.208 + * @since 1.1
1.209 + */
1.210 + public static final byte TITLECASE_LETTER = 3;
1.211 +
1.212 + /**
1.213 + * General category "Lm" in the Unicode specification.
1.214 + * @since 1.1
1.215 + */
1.216 + public static final byte MODIFIER_LETTER = 4;
1.217 +
1.218 + /**
1.219 + * General category "Lo" in the Unicode specification.
1.220 + * @since 1.1
1.221 + */
1.222 + public static final byte OTHER_LETTER = 5;
1.223 +
1.224 + /**
1.225 + * General category "Mn" in the Unicode specification.
1.226 + * @since 1.1
1.227 + */
1.228 + public static final byte NON_SPACING_MARK = 6;
1.229 +
1.230 + /**
1.231 + * General category "Me" in the Unicode specification.
1.232 + * @since 1.1
1.233 + */
1.234 + public static final byte ENCLOSING_MARK = 7;
1.235 +
1.236 + /**
1.237 + * General category "Mc" in the Unicode specification.
1.238 + * @since 1.1
1.239 + */
1.240 + public static final byte COMBINING_SPACING_MARK = 8;
1.241 +
1.242 + /**
1.243 + * General category "Nd" in the Unicode specification.
1.244 + * @since 1.1
1.245 + */
1.246 + public static final byte DECIMAL_DIGIT_NUMBER = 9;
1.247 +
1.248 + /**
1.249 + * General category "Nl" in the Unicode specification.
1.250 + * @since 1.1
1.251 + */
1.252 + public static final byte LETTER_NUMBER = 10;
1.253 +
1.254 + /**
1.255 + * General category "No" in the Unicode specification.
1.256 + * @since 1.1
1.257 + */
1.258 + public static final byte OTHER_NUMBER = 11;
1.259 +
1.260 + /**
1.261 + * General category "Zs" in the Unicode specification.
1.262 + * @since 1.1
1.263 + */
1.264 + public static final byte SPACE_SEPARATOR = 12;
1.265 +
1.266 + /**
1.267 + * General category "Zl" in the Unicode specification.
1.268 + * @since 1.1
1.269 + */
1.270 + public static final byte LINE_SEPARATOR = 13;
1.271 +
1.272 + /**
1.273 + * General category "Zp" in the Unicode specification.
1.274 + * @since 1.1
1.275 + */
1.276 + public static final byte PARAGRAPH_SEPARATOR = 14;
1.277 +
1.278 + /**
1.279 + * General category "Cc" in the Unicode specification.
1.280 + * @since 1.1
1.281 + */
1.282 + public static final byte CONTROL = 15;
1.283 +
1.284 + /**
1.285 + * General category "Cf" in the Unicode specification.
1.286 + * @since 1.1
1.287 + */
1.288 + public static final byte FORMAT = 16;
1.289 +
1.290 + /**
1.291 + * General category "Co" in the Unicode specification.
1.292 + * @since 1.1
1.293 + */
1.294 + public static final byte PRIVATE_USE = 18;
1.295 +
1.296 + /**
1.297 + * General category "Cs" in the Unicode specification.
1.298 + * @since 1.1
1.299 + */
1.300 + public static final byte SURROGATE = 19;
1.301 +
1.302 + /**
1.303 + * General category "Pd" in the Unicode specification.
1.304 + * @since 1.1
1.305 + */
1.306 + public static final byte DASH_PUNCTUATION = 20;
1.307 +
1.308 + /**
1.309 + * General category "Ps" in the Unicode specification.
1.310 + * @since 1.1
1.311 + */
1.312 + public static final byte START_PUNCTUATION = 21;
1.313 +
1.314 + /**
1.315 + * General category "Pe" in the Unicode specification.
1.316 + * @since 1.1
1.317 + */
1.318 + public static final byte END_PUNCTUATION = 22;
1.319 +
1.320 + /**
1.321 + * General category "Pc" in the Unicode specification.
1.322 + * @since 1.1
1.323 + */
1.324 + public static final byte CONNECTOR_PUNCTUATION = 23;
1.325 +
1.326 + /**
1.327 + * General category "Po" in the Unicode specification.
1.328 + * @since 1.1
1.329 + */
1.330 + public static final byte OTHER_PUNCTUATION = 24;
1.331 +
1.332 + /**
1.333 + * General category "Sm" in the Unicode specification.
1.334 + * @since 1.1
1.335 + */
1.336 + public static final byte MATH_SYMBOL = 25;
1.337 +
1.338 + /**
1.339 + * General category "Sc" in the Unicode specification.
1.340 + * @since 1.1
1.341 + */
1.342 + public static final byte CURRENCY_SYMBOL = 26;
1.343 +
1.344 + /**
1.345 + * General category "Sk" in the Unicode specification.
1.346 + * @since 1.1
1.347 + */
1.348 + public static final byte MODIFIER_SYMBOL = 27;
1.349 +
1.350 + /**
1.351 + * General category "So" in the Unicode specification.
1.352 + * @since 1.1
1.353 + */
1.354 + public static final byte OTHER_SYMBOL = 28;
1.355 +
1.356 + /**
1.357 + * General category "Pi" in the Unicode specification.
1.358 + * @since 1.4
1.359 + */
1.360 + public static final byte INITIAL_QUOTE_PUNCTUATION = 29;
1.361 +
1.362 + /**
1.363 + * General category "Pf" in the Unicode specification.
1.364 + * @since 1.4
1.365 + */
1.366 + public static final byte FINAL_QUOTE_PUNCTUATION = 30;
1.367 +
1.368 + /**
1.369 + * Error flag. Use int (code point) to avoid confusion with U+FFFF.
1.370 + */
1.371 + static final int ERROR = 0xFFFFFFFF;
1.372 +
1.373 +
1.374 + /**
1.375 + * Undefined bidirectional character type. Undefined {@code char}
1.376 + * values have undefined directionality in the Unicode specification.
1.377 + * @since 1.4
1.378 + */
1.379 + public static final byte DIRECTIONALITY_UNDEFINED = -1;
1.380 +
1.381 + /**
1.382 + * Strong bidirectional character type "L" in the Unicode specification.
1.383 + * @since 1.4
1.384 + */
1.385 + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0;
1.386 +
1.387 + /**
1.388 + * Strong bidirectional character type "R" in the Unicode specification.
1.389 + * @since 1.4
1.390 + */
1.391 + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1;
1.392 +
1.393 + /**
1.394 + * Strong bidirectional character type "AL" in the Unicode specification.
1.395 + * @since 1.4
1.396 + */
1.397 + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2;
1.398 +
1.399 + /**
1.400 + * Weak bidirectional character type "EN" in the Unicode specification.
1.401 + * @since 1.4
1.402 + */
1.403 + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3;
1.404 +
1.405 + /**
1.406 + * Weak bidirectional character type "ES" in the Unicode specification.
1.407 + * @since 1.4
1.408 + */
1.409 + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4;
1.410 +
1.411 + /**
1.412 + * Weak bidirectional character type "ET" in the Unicode specification.
1.413 + * @since 1.4
1.414 + */
1.415 + public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5;
1.416 +
1.417 + /**
1.418 + * Weak bidirectional character type "AN" in the Unicode specification.
1.419 + * @since 1.4
1.420 + */
1.421 + public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6;
1.422 +
1.423 + /**
1.424 + * Weak bidirectional character type "CS" in the Unicode specification.
1.425 + * @since 1.4
1.426 + */
1.427 + public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7;
1.428 +
1.429 + /**
1.430 + * Weak bidirectional character type "NSM" in the Unicode specification.
1.431 + * @since 1.4
1.432 + */
1.433 + public static final byte DIRECTIONALITY_NONSPACING_MARK = 8;
1.434 +
1.435 + /**
1.436 + * Weak bidirectional character type "BN" in the Unicode specification.
1.437 + * @since 1.4
1.438 + */
1.439 + public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9;
1.440 +
1.441 + /**
1.442 + * Neutral bidirectional character type "B" in the Unicode specification.
1.443 + * @since 1.4
1.444 + */
1.445 + public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10;
1.446 +
1.447 + /**
1.448 + * Neutral bidirectional character type "S" in the Unicode specification.
1.449 + * @since 1.4
1.450 + */
1.451 + public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11;
1.452 +
1.453 + /**
1.454 + * Neutral bidirectional character type "WS" in the Unicode specification.
1.455 + * @since 1.4
1.456 + */
1.457 + public static final byte DIRECTIONALITY_WHITESPACE = 12;
1.458 +
1.459 + /**
1.460 + * Neutral bidirectional character type "ON" in the Unicode specification.
1.461 + * @since 1.4
1.462 + */
1.463 + public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13;
1.464 +
1.465 + /**
1.466 + * Strong bidirectional character type "LRE" in the Unicode specification.
1.467 + * @since 1.4
1.468 + */
1.469 + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14;
1.470 +
1.471 + /**
1.472 + * Strong bidirectional character type "LRO" in the Unicode specification.
1.473 + * @since 1.4
1.474 + */
1.475 + public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15;
1.476 +
1.477 + /**
1.478 + * Strong bidirectional character type "RLE" in the Unicode specification.
1.479 + * @since 1.4
1.480 + */
1.481 + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16;
1.482 +
1.483 + /**
1.484 + * Strong bidirectional character type "RLO" in the Unicode specification.
1.485 + * @since 1.4
1.486 + */
1.487 + public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17;
1.488 +
1.489 + /**
1.490 + * Weak bidirectional character type "PDF" in the Unicode specification.
1.491 + * @since 1.4
1.492 + */
1.493 + public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18;
1.494 +
1.495 + /**
1.496 + * The minimum value of a
1.497 + * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit">
1.498 + * Unicode high-surrogate code unit</a>
1.499 + * in the UTF-16 encoding, constant {@code '\u005CuD800'}.
1.500 + * A high-surrogate is also known as a <i>leading-surrogate</i>.
1.501 + *
1.502 + * @since 1.5
1.503 + */
1.504 + public static final char MIN_HIGH_SURROGATE = '\uD800';
1.505 +
1.506 + /**
1.507 + * The maximum value of a
1.508 + * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit">
1.509 + * Unicode high-surrogate code unit</a>
1.510 + * in the UTF-16 encoding, constant {@code '\u005CuDBFF'}.
1.511 + * A high-surrogate is also known as a <i>leading-surrogate</i>.
1.512 + *
1.513 + * @since 1.5
1.514 + */
1.515 + public static final char MAX_HIGH_SURROGATE = '\uDBFF';
1.516 +
1.517 + /**
1.518 + * The minimum value of a
1.519 + * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit">
1.520 + * Unicode low-surrogate code unit</a>
1.521 + * in the UTF-16 encoding, constant {@code '\u005CuDC00'}.
1.522 + * A low-surrogate is also known as a <i>trailing-surrogate</i>.
1.523 + *
1.524 + * @since 1.5
1.525 + */
1.526 + public static final char MIN_LOW_SURROGATE = '\uDC00';
1.527 +
1.528 + /**
1.529 + * The maximum value of a
1.530 + * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit">
1.531 + * Unicode low-surrogate code unit</a>
1.532 + * in the UTF-16 encoding, constant {@code '\u005CuDFFF'}.
1.533 + * A low-surrogate is also known as a <i>trailing-surrogate</i>.
1.534 + *
1.535 + * @since 1.5
1.536 + */
1.537 + public static final char MAX_LOW_SURROGATE = '\uDFFF';
1.538 +
1.539 + /**
1.540 + * The minimum value of a Unicode surrogate code unit in the
1.541 + * UTF-16 encoding, constant {@code '\u005CuD800'}.
1.542 + *
1.543 + * @since 1.5
1.544 + */
1.545 + public static final char MIN_SURROGATE = MIN_HIGH_SURROGATE;
1.546 +
1.547 + /**
1.548 + * The maximum value of a Unicode surrogate code unit in the
1.549 + * UTF-16 encoding, constant {@code '\u005CuDFFF'}.
1.550 + *
1.551 + * @since 1.5
1.552 + */
1.553 + public static final char MAX_SURROGATE = MAX_LOW_SURROGATE;
1.554 +
1.555 + /**
1.556 + * The minimum value of a
1.557 + * <a href="http://www.unicode.org/glossary/#supplementary_code_point">
1.558 + * Unicode supplementary code point</a>, constant {@code U+10000}.
1.559 + *
1.560 + * @since 1.5
1.561 + */
1.562 + public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
1.563 +
1.564 + /**
1.565 + * The minimum value of a
1.566 + * <a href="http://www.unicode.org/glossary/#code_point">
1.567 + * Unicode code point</a>, constant {@code U+0000}.
1.568 + *
1.569 + * @since 1.5
1.570 + */
1.571 + public static final int MIN_CODE_POINT = 0x000000;
1.572 +
1.573 + /**
1.574 + * The maximum value of a
1.575 + * <a href="http://www.unicode.org/glossary/#code_point">
1.576 + * Unicode code point</a>, constant {@code U+10FFFF}.
1.577 + *
1.578 + * @since 1.5
1.579 + */
1.580 + public static final int MAX_CODE_POINT = 0X10FFFF;
1.581 +
1.582 +
1.583 + /**
1.584 + * Instances of this class represent particular subsets of the Unicode
1.585 + * character set. The only family of subsets defined in the
1.586 + * {@code Character} class is {@link Character.UnicodeBlock}.
1.587 + * Other portions of the Java API may define other subsets for their
1.588 + * own purposes.
1.589 + *
1.590 + * @since 1.2
1.591 + */
1.592 + public static class Subset {
1.593 +
1.594 + private String name;
1.595 +
1.596 + /**
1.597 + * Constructs a new {@code Subset} instance.
1.598 + *
1.599 + * @param name The name of this subset
1.600 + * @exception NullPointerException if name is {@code null}
1.601 + */
1.602 + protected Subset(String name) {
1.603 + if (name == null) {
1.604 + throw new NullPointerException("name");
1.605 + }
1.606 + this.name = name;
1.607 + }
1.608 +
1.609 + /**
1.610 + * Compares two {@code Subset} objects for equality.
1.611 + * This method returns {@code true} if and only if
1.612 + * {@code this} and the argument refer to the same
1.613 + * object; since this method is {@code final}, this
1.614 + * guarantee holds for all subclasses.
1.615 + */
1.616 + public final boolean equals(Object obj) {
1.617 + return (this == obj);
1.618 + }
1.619 +
1.620 + /**
1.621 + * Returns the standard hash code as defined by the
1.622 + * {@link Object#hashCode} method. This method
1.623 + * is {@code final} in order to ensure that the
1.624 + * {@code equals} and {@code hashCode} methods will
1.625 + * be consistent in all subclasses.
1.626 + */
1.627 + public final int hashCode() {
1.628 + return super.hashCode();
1.629 + }
1.630 +
1.631 + /**
1.632 + * Returns the name of this subset.
1.633 + */
1.634 + public final String toString() {
1.635 + return name;
1.636 + }
1.637 + }
1.638 +
1.639 + // See http://www.unicode.org/Public/UNIDATA/Blocks.txt
1.640 + // for the latest specification of Unicode Blocks.
1.641 +
1.642 + /**
1.643 + * A family of character subsets representing the character blocks in the
1.644 + * Unicode specification. Character blocks generally define characters
1.645 + * used for a specific script or purpose. A character is contained by
1.646 + * at most one Unicode block.
1.647 + *
1.648 + * @since 1.2
1.649 + */
1.650 + public static final class UnicodeBlock extends Subset {
1.651 +
1.652 + private static Map<String, UnicodeBlock> map = new HashMap<>(256);
1.653 +
1.654 + /**
1.655 + * Creates a UnicodeBlock with the given identifier name.
1.656 + * This name must be the same as the block identifier.
1.657 + */
1.658 + private UnicodeBlock(String idName) {
1.659 + super(idName);
1.660 + map.put(idName, this);
1.661 + }
1.662 +
1.663 + /**
1.664 + * Creates a UnicodeBlock with the given identifier name and
1.665 + * alias name.
1.666 + */
1.667 + private UnicodeBlock(String idName, String alias) {
1.668 + this(idName);
1.669 + map.put(alias, this);
1.670 + }
1.671 +
1.672 + /**
1.673 + * Creates a UnicodeBlock with the given identifier name and
1.674 + * alias names.
1.675 + */
1.676 + private UnicodeBlock(String idName, String... aliases) {
1.677 + this(idName);
1.678 + for (String alias : aliases)
1.679 + map.put(alias, this);
1.680 + }
1.681 +
1.682 + /**
1.683 + * Constant for the "Basic Latin" Unicode character block.
1.684 + * @since 1.2
1.685 + */
1.686 + public static final UnicodeBlock BASIC_LATIN =
1.687 + new UnicodeBlock("BASIC_LATIN",
1.688 + "BASIC LATIN",
1.689 + "BASICLATIN");
1.690 +
1.691 + /**
1.692 + * Constant for the "Latin-1 Supplement" Unicode character block.
1.693 + * @since 1.2
1.694 + */
1.695 + public static final UnicodeBlock LATIN_1_SUPPLEMENT =
1.696 + new UnicodeBlock("LATIN_1_SUPPLEMENT",
1.697 + "LATIN-1 SUPPLEMENT",
1.698 + "LATIN-1SUPPLEMENT");
1.699 +
1.700 + /**
1.701 + * Constant for the "Latin Extended-A" Unicode character block.
1.702 + * @since 1.2
1.703 + */
1.704 + public static final UnicodeBlock LATIN_EXTENDED_A =
1.705 + new UnicodeBlock("LATIN_EXTENDED_A",
1.706 + "LATIN EXTENDED-A",
1.707 + "LATINEXTENDED-A");
1.708 +
1.709 + /**
1.710 + * Constant for the "Latin Extended-B" Unicode character block.
1.711 + * @since 1.2
1.712 + */
1.713 + public static final UnicodeBlock LATIN_EXTENDED_B =
1.714 + new UnicodeBlock("LATIN_EXTENDED_B",
1.715 + "LATIN EXTENDED-B",
1.716 + "LATINEXTENDED-B");
1.717 +
1.718 + /**
1.719 + * Constant for the "IPA Extensions" Unicode character block.
1.720 + * @since 1.2
1.721 + */
1.722 + public static final UnicodeBlock IPA_EXTENSIONS =
1.723 + new UnicodeBlock("IPA_EXTENSIONS",
1.724 + "IPA EXTENSIONS",
1.725 + "IPAEXTENSIONS");
1.726 +
1.727 + /**
1.728 + * Constant for the "Spacing Modifier Letters" Unicode character block.
1.729 + * @since 1.2
1.730 + */
1.731 + public static final UnicodeBlock SPACING_MODIFIER_LETTERS =
1.732 + new UnicodeBlock("SPACING_MODIFIER_LETTERS",
1.733 + "SPACING MODIFIER LETTERS",
1.734 + "SPACINGMODIFIERLETTERS");
1.735 +
1.736 + /**
1.737 + * Constant for the "Combining Diacritical Marks" Unicode character block.
1.738 + * @since 1.2
1.739 + */
1.740 + public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS =
1.741 + new UnicodeBlock("COMBINING_DIACRITICAL_MARKS",
1.742 + "COMBINING DIACRITICAL MARKS",
1.743 + "COMBININGDIACRITICALMARKS");
1.744 +
1.745 + /**
1.746 + * Constant for the "Greek and Coptic" Unicode character block.
1.747 + * <p>
1.748 + * This block was previously known as the "Greek" block.
1.749 + *
1.750 + * @since 1.2
1.751 + */
1.752 + public static final UnicodeBlock GREEK =
1.753 + new UnicodeBlock("GREEK",
1.754 + "GREEK AND COPTIC",
1.755 + "GREEKANDCOPTIC");
1.756 +
1.757 + /**
1.758 + * Constant for the "Cyrillic" Unicode character block.
1.759 + * @since 1.2
1.760 + */
1.761 + public static final UnicodeBlock CYRILLIC =
1.762 + new UnicodeBlock("CYRILLIC");
1.763 +
1.764 + /**
1.765 + * Constant for the "Armenian" Unicode character block.
1.766 + * @since 1.2
1.767 + */
1.768 + public static final UnicodeBlock ARMENIAN =
1.769 + new UnicodeBlock("ARMENIAN");
1.770 +
1.771 + /**
1.772 + * Constant for the "Hebrew" Unicode character block.
1.773 + * @since 1.2
1.774 + */
1.775 + public static final UnicodeBlock HEBREW =
1.776 + new UnicodeBlock("HEBREW");
1.777 +
1.778 + /**
1.779 + * Constant for the "Arabic" Unicode character block.
1.780 + * @since 1.2
1.781 + */
1.782 + public static final UnicodeBlock ARABIC =
1.783 + new UnicodeBlock("ARABIC");
1.784 +
1.785 + /**
1.786 + * Constant for the "Devanagari" Unicode character block.
1.787 + * @since 1.2
1.788 + */
1.789 + public static final UnicodeBlock DEVANAGARI =
1.790 + new UnicodeBlock("DEVANAGARI");
1.791 +
1.792 + /**
1.793 + * Constant for the "Bengali" Unicode character block.
1.794 + * @since 1.2
1.795 + */
1.796 + public static final UnicodeBlock BENGALI =
1.797 + new UnicodeBlock("BENGALI");
1.798 +
1.799 + /**
1.800 + * Constant for the "Gurmukhi" Unicode character block.
1.801 + * @since 1.2
1.802 + */
1.803 + public static final UnicodeBlock GURMUKHI =
1.804 + new UnicodeBlock("GURMUKHI");
1.805 +
1.806 + /**
1.807 + * Constant for the "Gujarati" Unicode character block.
1.808 + * @since 1.2
1.809 + */
1.810 + public static final UnicodeBlock GUJARATI =
1.811 + new UnicodeBlock("GUJARATI");
1.812 +
1.813 + /**
1.814 + * Constant for the "Oriya" Unicode character block.
1.815 + * @since 1.2
1.816 + */
1.817 + public static final UnicodeBlock ORIYA =
1.818 + new UnicodeBlock("ORIYA");
1.819 +
1.820 + /**
1.821 + * Constant for the "Tamil" Unicode character block.
1.822 + * @since 1.2
1.823 + */
1.824 + public static final UnicodeBlock TAMIL =
1.825 + new UnicodeBlock("TAMIL");
1.826 +
1.827 + /**
1.828 + * Constant for the "Telugu" Unicode character block.
1.829 + * @since 1.2
1.830 + */
1.831 + public static final UnicodeBlock TELUGU =
1.832 + new UnicodeBlock("TELUGU");
1.833 +
1.834 + /**
1.835 + * Constant for the "Kannada" Unicode character block.
1.836 + * @since 1.2
1.837 + */
1.838 + public static final UnicodeBlock KANNADA =
1.839 + new UnicodeBlock("KANNADA");
1.840 +
1.841 + /**
1.842 + * Constant for the "Malayalam" Unicode character block.
1.843 + * @since 1.2
1.844 + */
1.845 + public static final UnicodeBlock MALAYALAM =
1.846 + new UnicodeBlock("MALAYALAM");
1.847 +
1.848 + /**
1.849 + * Constant for the "Thai" Unicode character block.
1.850 + * @since 1.2
1.851 + */
1.852 + public static final UnicodeBlock THAI =
1.853 + new UnicodeBlock("THAI");
1.854 +
1.855 + /**
1.856 + * Constant for the "Lao" Unicode character block.
1.857 + * @since 1.2
1.858 + */
1.859 + public static final UnicodeBlock LAO =
1.860 + new UnicodeBlock("LAO");
1.861 +
1.862 + /**
1.863 + * Constant for the "Tibetan" Unicode character block.
1.864 + * @since 1.2
1.865 + */
1.866 + public static final UnicodeBlock TIBETAN =
1.867 + new UnicodeBlock("TIBETAN");
1.868 +
1.869 + /**
1.870 + * Constant for the "Georgian" Unicode character block.
1.871 + * @since 1.2
1.872 + */
1.873 + public static final UnicodeBlock GEORGIAN =
1.874 + new UnicodeBlock("GEORGIAN");
1.875 +
1.876 + /**
1.877 + * Constant for the "Hangul Jamo" Unicode character block.
1.878 + * @since 1.2
1.879 + */
1.880 + public static final UnicodeBlock HANGUL_JAMO =
1.881 + new UnicodeBlock("HANGUL_JAMO",
1.882 + "HANGUL JAMO",
1.883 + "HANGULJAMO");
1.884 +
1.885 + /**
1.886 + * Constant for the "Latin Extended Additional" Unicode character block.
1.887 + * @since 1.2
1.888 + */
1.889 + public static final UnicodeBlock LATIN_EXTENDED_ADDITIONAL =
1.890 + new UnicodeBlock("LATIN_EXTENDED_ADDITIONAL",
1.891 + "LATIN EXTENDED ADDITIONAL",
1.892 + "LATINEXTENDEDADDITIONAL");
1.893 +
1.894 + /**
1.895 + * Constant for the "Greek Extended" Unicode character block.
1.896 + * @since 1.2
1.897 + */
1.898 + public static final UnicodeBlock GREEK_EXTENDED =
1.899 + new UnicodeBlock("GREEK_EXTENDED",
1.900 + "GREEK EXTENDED",
1.901 + "GREEKEXTENDED");
1.902 +
1.903 + /**
1.904 + * Constant for the "General Punctuation" Unicode character block.
1.905 + * @since 1.2
1.906 + */
1.907 + public static final UnicodeBlock GENERAL_PUNCTUATION =
1.908 + new UnicodeBlock("GENERAL_PUNCTUATION",
1.909 + "GENERAL PUNCTUATION",
1.910 + "GENERALPUNCTUATION");
1.911 +
1.912 + /**
1.913 + * Constant for the "Superscripts and Subscripts" Unicode character
1.914 + * block.
1.915 + * @since 1.2
1.916 + */
1.917 + public static final UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS =
1.918 + new UnicodeBlock("SUPERSCRIPTS_AND_SUBSCRIPTS",
1.919 + "SUPERSCRIPTS AND SUBSCRIPTS",
1.920 + "SUPERSCRIPTSANDSUBSCRIPTS");
1.921 +
1.922 + /**
1.923 + * Constant for the "Currency Symbols" Unicode character block.
1.924 + * @since 1.2
1.925 + */
1.926 + public static final UnicodeBlock CURRENCY_SYMBOLS =
1.927 + new UnicodeBlock("CURRENCY_SYMBOLS",
1.928 + "CURRENCY SYMBOLS",
1.929 + "CURRENCYSYMBOLS");
1.930 +
1.931 + /**
1.932 + * Constant for the "Combining Diacritical Marks for Symbols" Unicode
1.933 + * character block.
1.934 + * <p>
1.935 + * This block was previously known as "Combining Marks for Symbols".
1.936 + * @since 1.2
1.937 + */
1.938 + public static final UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS =
1.939 + new UnicodeBlock("COMBINING_MARKS_FOR_SYMBOLS",
1.940 + "COMBINING DIACRITICAL MARKS FOR SYMBOLS",
1.941 + "COMBININGDIACRITICALMARKSFORSYMBOLS",
1.942 + "COMBINING MARKS FOR SYMBOLS",
1.943 + "COMBININGMARKSFORSYMBOLS");
1.944 +
1.945 + /**
1.946 + * Constant for the "Letterlike Symbols" Unicode character block.
1.947 + * @since 1.2
1.948 + */
1.949 + public static final UnicodeBlock LETTERLIKE_SYMBOLS =
1.950 + new UnicodeBlock("LETTERLIKE_SYMBOLS",
1.951 + "LETTERLIKE SYMBOLS",
1.952 + "LETTERLIKESYMBOLS");
1.953 +
1.954 + /**
1.955 + * Constant for the "Number Forms" Unicode character block.
1.956 + * @since 1.2
1.957 + */
1.958 + public static final UnicodeBlock NUMBER_FORMS =
1.959 + new UnicodeBlock("NUMBER_FORMS",
1.960 + "NUMBER FORMS",
1.961 + "NUMBERFORMS");
1.962 +
1.963 + /**
1.964 + * Constant for the "Arrows" Unicode character block.
1.965 + * @since 1.2
1.966 + */
1.967 + public static final UnicodeBlock ARROWS =
1.968 + new UnicodeBlock("ARROWS");
1.969 +
1.970 + /**
1.971 + * Constant for the "Mathematical Operators" Unicode character block.
1.972 + * @since 1.2
1.973 + */
1.974 + public static final UnicodeBlock MATHEMATICAL_OPERATORS =
1.975 + new UnicodeBlock("MATHEMATICAL_OPERATORS",
1.976 + "MATHEMATICAL OPERATORS",
1.977 + "MATHEMATICALOPERATORS");
1.978 +
1.979 + /**
1.980 + * Constant for the "Miscellaneous Technical" Unicode character block.
1.981 + * @since 1.2
1.982 + */
1.983 + public static final UnicodeBlock MISCELLANEOUS_TECHNICAL =
1.984 + new UnicodeBlock("MISCELLANEOUS_TECHNICAL",
1.985 + "MISCELLANEOUS TECHNICAL",
1.986 + "MISCELLANEOUSTECHNICAL");
1.987 +
1.988 + /**
1.989 + * Constant for the "Control Pictures" Unicode character block.
1.990 + * @since 1.2
1.991 + */
1.992 + public static final UnicodeBlock CONTROL_PICTURES =
1.993 + new UnicodeBlock("CONTROL_PICTURES",
1.994 + "CONTROL PICTURES",
1.995 + "CONTROLPICTURES");
1.996 +
1.997 + /**
1.998 + * Constant for the "Optical Character Recognition" Unicode character block.
1.999 + * @since 1.2
1.1000 + */
1.1001 + public static final UnicodeBlock OPTICAL_CHARACTER_RECOGNITION =
1.1002 + new UnicodeBlock("OPTICAL_CHARACTER_RECOGNITION",
1.1003 + "OPTICAL CHARACTER RECOGNITION",
1.1004 + "OPTICALCHARACTERRECOGNITION");
1.1005 +
1.1006 + /**
1.1007 + * Constant for the "Enclosed Alphanumerics" Unicode character block.
1.1008 + * @since 1.2
1.1009 + */
1.1010 + public static final UnicodeBlock ENCLOSED_ALPHANUMERICS =
1.1011 + new UnicodeBlock("ENCLOSED_ALPHANUMERICS",
1.1012 + "ENCLOSED ALPHANUMERICS",
1.1013 + "ENCLOSEDALPHANUMERICS");
1.1014 +
1.1015 + /**
1.1016 + * Constant for the "Box Drawing" Unicode character block.
1.1017 + * @since 1.2
1.1018 + */
1.1019 + public static final UnicodeBlock BOX_DRAWING =
1.1020 + new UnicodeBlock("BOX_DRAWING",
1.1021 + "BOX DRAWING",
1.1022 + "BOXDRAWING");
1.1023 +
1.1024 + /**
1.1025 + * Constant for the "Block Elements" Unicode character block.
1.1026 + * @since 1.2
1.1027 + */
1.1028 + public static final UnicodeBlock BLOCK_ELEMENTS =
1.1029 + new UnicodeBlock("BLOCK_ELEMENTS",
1.1030 + "BLOCK ELEMENTS",
1.1031 + "BLOCKELEMENTS");
1.1032 +
1.1033 + /**
1.1034 + * Constant for the "Geometric Shapes" Unicode character block.
1.1035 + * @since 1.2
1.1036 + */
1.1037 + public static final UnicodeBlock GEOMETRIC_SHAPES =
1.1038 + new UnicodeBlock("GEOMETRIC_SHAPES",
1.1039 + "GEOMETRIC SHAPES",
1.1040 + "GEOMETRICSHAPES");
1.1041 +
1.1042 + /**
1.1043 + * Constant for the "Miscellaneous Symbols" Unicode character block.
1.1044 + * @since 1.2
1.1045 + */
1.1046 + public static final UnicodeBlock MISCELLANEOUS_SYMBOLS =
1.1047 + new UnicodeBlock("MISCELLANEOUS_SYMBOLS",
1.1048 + "MISCELLANEOUS SYMBOLS",
1.1049 + "MISCELLANEOUSSYMBOLS");
1.1050 +
1.1051 + /**
1.1052 + * Constant for the "Dingbats" Unicode character block.
1.1053 + * @since 1.2
1.1054 + */
1.1055 + public static final UnicodeBlock DINGBATS =
1.1056 + new UnicodeBlock("DINGBATS");
1.1057 +
1.1058 + /**
1.1059 + * Constant for the "CJK Symbols and Punctuation" Unicode character block.
1.1060 + * @since 1.2
1.1061 + */
1.1062 + public static final UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION =
1.1063 + new UnicodeBlock("CJK_SYMBOLS_AND_PUNCTUATION",
1.1064 + "CJK SYMBOLS AND PUNCTUATION",
1.1065 + "CJKSYMBOLSANDPUNCTUATION");
1.1066 +
1.1067 + /**
1.1068 + * Constant for the "Hiragana" Unicode character block.
1.1069 + * @since 1.2
1.1070 + */
1.1071 + public static final UnicodeBlock HIRAGANA =
1.1072 + new UnicodeBlock("HIRAGANA");
1.1073 +
1.1074 + /**
1.1075 + * Constant for the "Katakana" Unicode character block.
1.1076 + * @since 1.2
1.1077 + */
1.1078 + public static final UnicodeBlock KATAKANA =
1.1079 + new UnicodeBlock("KATAKANA");
1.1080 +
1.1081 + /**
1.1082 + * Constant for the "Bopomofo" Unicode character block.
1.1083 + * @since 1.2
1.1084 + */
1.1085 + public static final UnicodeBlock BOPOMOFO =
1.1086 + new UnicodeBlock("BOPOMOFO");
1.1087 +
1.1088 + /**
1.1089 + * Constant for the "Hangul Compatibility Jamo" Unicode character block.
1.1090 + * @since 1.2
1.1091 + */
1.1092 + public static final UnicodeBlock HANGUL_COMPATIBILITY_JAMO =
1.1093 + new UnicodeBlock("HANGUL_COMPATIBILITY_JAMO",
1.1094 + "HANGUL COMPATIBILITY JAMO",
1.1095 + "HANGULCOMPATIBILITYJAMO");
1.1096 +
1.1097 + /**
1.1098 + * Constant for the "Kanbun" Unicode character block.
1.1099 + * @since 1.2
1.1100 + */
1.1101 + public static final UnicodeBlock KANBUN =
1.1102 + new UnicodeBlock("KANBUN");
1.1103 +
1.1104 + /**
1.1105 + * Constant for the "Enclosed CJK Letters and Months" Unicode character block.
1.1106 + * @since 1.2
1.1107 + */
1.1108 + public static final UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS =
1.1109 + new UnicodeBlock("ENCLOSED_CJK_LETTERS_AND_MONTHS",
1.1110 + "ENCLOSED CJK LETTERS AND MONTHS",
1.1111 + "ENCLOSEDCJKLETTERSANDMONTHS");
1.1112 +
1.1113 + /**
1.1114 + * Constant for the "CJK Compatibility" Unicode character block.
1.1115 + * @since 1.2
1.1116 + */
1.1117 + public static final UnicodeBlock CJK_COMPATIBILITY =
1.1118 + new UnicodeBlock("CJK_COMPATIBILITY",
1.1119 + "CJK COMPATIBILITY",
1.1120 + "CJKCOMPATIBILITY");
1.1121 +
1.1122 + /**
1.1123 + * Constant for the "CJK Unified Ideographs" Unicode character block.
1.1124 + * @since 1.2
1.1125 + */
1.1126 + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS =
1.1127 + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS",
1.1128 + "CJK UNIFIED IDEOGRAPHS",
1.1129 + "CJKUNIFIEDIDEOGRAPHS");
1.1130 +
1.1131 + /**
1.1132 + * Constant for the "Hangul Syllables" Unicode character block.
1.1133 + * @since 1.2
1.1134 + */
1.1135 + public static final UnicodeBlock HANGUL_SYLLABLES =
1.1136 + new UnicodeBlock("HANGUL_SYLLABLES",
1.1137 + "HANGUL SYLLABLES",
1.1138 + "HANGULSYLLABLES");
1.1139 +
1.1140 + /**
1.1141 + * Constant for the "Private Use Area" Unicode character block.
1.1142 + * @since 1.2
1.1143 + */
1.1144 + public static final UnicodeBlock PRIVATE_USE_AREA =
1.1145 + new UnicodeBlock("PRIVATE_USE_AREA",
1.1146 + "PRIVATE USE AREA",
1.1147 + "PRIVATEUSEAREA");
1.1148 +
1.1149 + /**
1.1150 + * Constant for the "CJK Compatibility Ideographs" Unicode character
1.1151 + * block.
1.1152 + * @since 1.2
1.1153 + */
1.1154 + public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS =
1.1155 + new UnicodeBlock("CJK_COMPATIBILITY_IDEOGRAPHS",
1.1156 + "CJK COMPATIBILITY IDEOGRAPHS",
1.1157 + "CJKCOMPATIBILITYIDEOGRAPHS");
1.1158 +
1.1159 + /**
1.1160 + * Constant for the "Alphabetic Presentation Forms" Unicode character block.
1.1161 + * @since 1.2
1.1162 + */
1.1163 + public static final UnicodeBlock ALPHABETIC_PRESENTATION_FORMS =
1.1164 + new UnicodeBlock("ALPHABETIC_PRESENTATION_FORMS",
1.1165 + "ALPHABETIC PRESENTATION FORMS",
1.1166 + "ALPHABETICPRESENTATIONFORMS");
1.1167 +
1.1168 + /**
1.1169 + * Constant for the "Arabic Presentation Forms-A" Unicode character
1.1170 + * block.
1.1171 + * @since 1.2
1.1172 + */
1.1173 + public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_A =
1.1174 + new UnicodeBlock("ARABIC_PRESENTATION_FORMS_A",
1.1175 + "ARABIC PRESENTATION FORMS-A",
1.1176 + "ARABICPRESENTATIONFORMS-A");
1.1177 +
1.1178 + /**
1.1179 + * Constant for the "Combining Half Marks" Unicode character block.
1.1180 + * @since 1.2
1.1181 + */
1.1182 + public static final UnicodeBlock COMBINING_HALF_MARKS =
1.1183 + new UnicodeBlock("COMBINING_HALF_MARKS",
1.1184 + "COMBINING HALF MARKS",
1.1185 + "COMBININGHALFMARKS");
1.1186 +
1.1187 + /**
1.1188 + * Constant for the "CJK Compatibility Forms" Unicode character block.
1.1189 + * @since 1.2
1.1190 + */
1.1191 + public static final UnicodeBlock CJK_COMPATIBILITY_FORMS =
1.1192 + new UnicodeBlock("CJK_COMPATIBILITY_FORMS",
1.1193 + "CJK COMPATIBILITY FORMS",
1.1194 + "CJKCOMPATIBILITYFORMS");
1.1195 +
1.1196 + /**
1.1197 + * Constant for the "Small Form Variants" Unicode character block.
1.1198 + * @since 1.2
1.1199 + */
1.1200 + public static final UnicodeBlock SMALL_FORM_VARIANTS =
1.1201 + new UnicodeBlock("SMALL_FORM_VARIANTS",
1.1202 + "SMALL FORM VARIANTS",
1.1203 + "SMALLFORMVARIANTS");
1.1204 +
1.1205 + /**
1.1206 + * Constant for the "Arabic Presentation Forms-B" Unicode character block.
1.1207 + * @since 1.2
1.1208 + */
1.1209 + public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_B =
1.1210 + new UnicodeBlock("ARABIC_PRESENTATION_FORMS_B",
1.1211 + "ARABIC PRESENTATION FORMS-B",
1.1212 + "ARABICPRESENTATIONFORMS-B");
1.1213 +
1.1214 + /**
1.1215 + * Constant for the "Halfwidth and Fullwidth Forms" Unicode character
1.1216 + * block.
1.1217 + * @since 1.2
1.1218 + */
1.1219 + public static final UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS =
1.1220 + new UnicodeBlock("HALFWIDTH_AND_FULLWIDTH_FORMS",
1.1221 + "HALFWIDTH AND FULLWIDTH FORMS",
1.1222 + "HALFWIDTHANDFULLWIDTHFORMS");
1.1223 +
1.1224 + /**
1.1225 + * Constant for the "Specials" Unicode character block.
1.1226 + * @since 1.2
1.1227 + */
1.1228 + public static final UnicodeBlock SPECIALS =
1.1229 + new UnicodeBlock("SPECIALS");
1.1230 +
1.1231 + /**
1.1232 + * @deprecated As of J2SE 5, use {@link #HIGH_SURROGATES},
1.1233 + * {@link #HIGH_PRIVATE_USE_SURROGATES}, and
1.1234 + * {@link #LOW_SURROGATES}. These new constants match
1.1235 + * the block definitions of the Unicode Standard.
1.1236 + * The {@link #of(char)} and {@link #of(int)} methods
1.1237 + * return the new constants, not SURROGATES_AREA.
1.1238 + */
1.1239 + @Deprecated
1.1240 + public static final UnicodeBlock SURROGATES_AREA =
1.1241 + new UnicodeBlock("SURROGATES_AREA");
1.1242 +
1.1243 + /**
1.1244 + * Constant for the "Syriac" Unicode character block.
1.1245 + * @since 1.4
1.1246 + */
1.1247 + public static final UnicodeBlock SYRIAC =
1.1248 + new UnicodeBlock("SYRIAC");
1.1249 +
1.1250 + /**
1.1251 + * Constant for the "Thaana" Unicode character block.
1.1252 + * @since 1.4
1.1253 + */
1.1254 + public static final UnicodeBlock THAANA =
1.1255 + new UnicodeBlock("THAANA");
1.1256 +
1.1257 + /**
1.1258 + * Constant for the "Sinhala" Unicode character block.
1.1259 + * @since 1.4
1.1260 + */
1.1261 + public static final UnicodeBlock SINHALA =
1.1262 + new UnicodeBlock("SINHALA");
1.1263 +
1.1264 + /**
1.1265 + * Constant for the "Myanmar" Unicode character block.
1.1266 + * @since 1.4
1.1267 + */
1.1268 + public static final UnicodeBlock MYANMAR =
1.1269 + new UnicodeBlock("MYANMAR");
1.1270 +
1.1271 + /**
1.1272 + * Constant for the "Ethiopic" Unicode character block.
1.1273 + * @since 1.4
1.1274 + */
1.1275 + public static final UnicodeBlock ETHIOPIC =
1.1276 + new UnicodeBlock("ETHIOPIC");
1.1277 +
1.1278 + /**
1.1279 + * Constant for the "Cherokee" Unicode character block.
1.1280 + * @since 1.4
1.1281 + */
1.1282 + public static final UnicodeBlock CHEROKEE =
1.1283 + new UnicodeBlock("CHEROKEE");
1.1284 +
1.1285 + /**
1.1286 + * Constant for the "Unified Canadian Aboriginal Syllabics" Unicode character block.
1.1287 + * @since 1.4
1.1288 + */
1.1289 + public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =
1.1290 + new UnicodeBlock("UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS",
1.1291 + "UNIFIED CANADIAN ABORIGINAL SYLLABICS",
1.1292 + "UNIFIEDCANADIANABORIGINALSYLLABICS");
1.1293 +
1.1294 + /**
1.1295 + * Constant for the "Ogham" Unicode character block.
1.1296 + * @since 1.4
1.1297 + */
1.1298 + public static final UnicodeBlock OGHAM =
1.1299 + new UnicodeBlock("OGHAM");
1.1300 +
1.1301 + /**
1.1302 + * Constant for the "Runic" Unicode character block.
1.1303 + * @since 1.4
1.1304 + */
1.1305 + public static final UnicodeBlock RUNIC =
1.1306 + new UnicodeBlock("RUNIC");
1.1307 +
1.1308 + /**
1.1309 + * Constant for the "Khmer" Unicode character block.
1.1310 + * @since 1.4
1.1311 + */
1.1312 + public static final UnicodeBlock KHMER =
1.1313 + new UnicodeBlock("KHMER");
1.1314 +
1.1315 + /**
1.1316 + * Constant for the "Mongolian" Unicode character block.
1.1317 + * @since 1.4
1.1318 + */
1.1319 + public static final UnicodeBlock MONGOLIAN =
1.1320 + new UnicodeBlock("MONGOLIAN");
1.1321 +
1.1322 + /**
1.1323 + * Constant for the "Braille Patterns" Unicode character block.
1.1324 + * @since 1.4
1.1325 + */
1.1326 + public static final UnicodeBlock BRAILLE_PATTERNS =
1.1327 + new UnicodeBlock("BRAILLE_PATTERNS",
1.1328 + "BRAILLE PATTERNS",
1.1329 + "BRAILLEPATTERNS");
1.1330 +
1.1331 + /**
1.1332 + * Constant for the "CJK Radicals Supplement" Unicode character block.
1.1333 + * @since 1.4
1.1334 + */
1.1335 + public static final UnicodeBlock CJK_RADICALS_SUPPLEMENT =
1.1336 + new UnicodeBlock("CJK_RADICALS_SUPPLEMENT",
1.1337 + "CJK RADICALS SUPPLEMENT",
1.1338 + "CJKRADICALSSUPPLEMENT");
1.1339 +
1.1340 + /**
1.1341 + * Constant for the "Kangxi Radicals" Unicode character block.
1.1342 + * @since 1.4
1.1343 + */
1.1344 + public static final UnicodeBlock KANGXI_RADICALS =
1.1345 + new UnicodeBlock("KANGXI_RADICALS",
1.1346 + "KANGXI RADICALS",
1.1347 + "KANGXIRADICALS");
1.1348 +
1.1349 + /**
1.1350 + * Constant for the "Ideographic Description Characters" Unicode character block.
1.1351 + * @since 1.4
1.1352 + */
1.1353 + public static final UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS =
1.1354 + new UnicodeBlock("IDEOGRAPHIC_DESCRIPTION_CHARACTERS",
1.1355 + "IDEOGRAPHIC DESCRIPTION CHARACTERS",
1.1356 + "IDEOGRAPHICDESCRIPTIONCHARACTERS");
1.1357 +
1.1358 + /**
1.1359 + * Constant for the "Bopomofo Extended" Unicode character block.
1.1360 + * @since 1.4
1.1361 + */
1.1362 + public static final UnicodeBlock BOPOMOFO_EXTENDED =
1.1363 + new UnicodeBlock("BOPOMOFO_EXTENDED",
1.1364 + "BOPOMOFO EXTENDED",
1.1365 + "BOPOMOFOEXTENDED");
1.1366 +
1.1367 + /**
1.1368 + * Constant for the "CJK Unified Ideographs Extension A" Unicode character block.
1.1369 + * @since 1.4
1.1370 + */
1.1371 + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =
1.1372 + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A",
1.1373 + "CJK UNIFIED IDEOGRAPHS EXTENSION A",
1.1374 + "CJKUNIFIEDIDEOGRAPHSEXTENSIONA");
1.1375 +
1.1376 + /**
1.1377 + * Constant for the "Yi Syllables" Unicode character block.
1.1378 + * @since 1.4
1.1379 + */
1.1380 + public static final UnicodeBlock YI_SYLLABLES =
1.1381 + new UnicodeBlock("YI_SYLLABLES",
1.1382 + "YI SYLLABLES",
1.1383 + "YISYLLABLES");
1.1384 +
1.1385 + /**
1.1386 + * Constant for the "Yi Radicals" Unicode character block.
1.1387 + * @since 1.4
1.1388 + */
1.1389 + public static final UnicodeBlock YI_RADICALS =
1.1390 + new UnicodeBlock("YI_RADICALS",
1.1391 + "YI RADICALS",
1.1392 + "YIRADICALS");
1.1393 +
1.1394 + /**
1.1395 + * Constant for the "Cyrillic Supplementary" Unicode character block.
1.1396 + * @since 1.5
1.1397 + */
1.1398 + public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY =
1.1399 + new UnicodeBlock("CYRILLIC_SUPPLEMENTARY",
1.1400 + "CYRILLIC SUPPLEMENTARY",
1.1401 + "CYRILLICSUPPLEMENTARY",
1.1402 + "CYRILLIC SUPPLEMENT",
1.1403 + "CYRILLICSUPPLEMENT");
1.1404 +
1.1405 + /**
1.1406 + * Constant for the "Tagalog" Unicode character block.
1.1407 + * @since 1.5
1.1408 + */
1.1409 + public static final UnicodeBlock TAGALOG =
1.1410 + new UnicodeBlock("TAGALOG");
1.1411 +
1.1412 + /**
1.1413 + * Constant for the "Hanunoo" Unicode character block.
1.1414 + * @since 1.5
1.1415 + */
1.1416 + public static final UnicodeBlock HANUNOO =
1.1417 + new UnicodeBlock("HANUNOO");
1.1418 +
1.1419 + /**
1.1420 + * Constant for the "Buhid" Unicode character block.
1.1421 + * @since 1.5
1.1422 + */
1.1423 + public static final UnicodeBlock BUHID =
1.1424 + new UnicodeBlock("BUHID");
1.1425 +
1.1426 + /**
1.1427 + * Constant for the "Tagbanwa" Unicode character block.
1.1428 + * @since 1.5
1.1429 + */
1.1430 + public static final UnicodeBlock TAGBANWA =
1.1431 + new UnicodeBlock("TAGBANWA");
1.1432 +
1.1433 + /**
1.1434 + * Constant for the "Limbu" Unicode character block.
1.1435 + * @since 1.5
1.1436 + */
1.1437 + public static final UnicodeBlock LIMBU =
1.1438 + new UnicodeBlock("LIMBU");
1.1439 +
1.1440 + /**
1.1441 + * Constant for the "Tai Le" Unicode character block.
1.1442 + * @since 1.5
1.1443 + */
1.1444 + public static final UnicodeBlock TAI_LE =
1.1445 + new UnicodeBlock("TAI_LE",
1.1446 + "TAI LE",
1.1447 + "TAILE");
1.1448 +
1.1449 + /**
1.1450 + * Constant for the "Khmer Symbols" Unicode character block.
1.1451 + * @since 1.5
1.1452 + */
1.1453 + public static final UnicodeBlock KHMER_SYMBOLS =
1.1454 + new UnicodeBlock("KHMER_SYMBOLS",
1.1455 + "KHMER SYMBOLS",
1.1456 + "KHMERSYMBOLS");
1.1457 +
1.1458 + /**
1.1459 + * Constant for the "Phonetic Extensions" Unicode character block.
1.1460 + * @since 1.5
1.1461 + */
1.1462 + public static final UnicodeBlock PHONETIC_EXTENSIONS =
1.1463 + new UnicodeBlock("PHONETIC_EXTENSIONS",
1.1464 + "PHONETIC EXTENSIONS",
1.1465 + "PHONETICEXTENSIONS");
1.1466 +
1.1467 + /**
1.1468 + * Constant for the "Miscellaneous Mathematical Symbols-A" Unicode character block.
1.1469 + * @since 1.5
1.1470 + */
1.1471 + public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A =
1.1472 + new UnicodeBlock("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A",
1.1473 + "MISCELLANEOUS MATHEMATICAL SYMBOLS-A",
1.1474 + "MISCELLANEOUSMATHEMATICALSYMBOLS-A");
1.1475 +
1.1476 + /**
1.1477 + * Constant for the "Supplemental Arrows-A" Unicode character block.
1.1478 + * @since 1.5
1.1479 + */
1.1480 + public static final UnicodeBlock SUPPLEMENTAL_ARROWS_A =
1.1481 + new UnicodeBlock("SUPPLEMENTAL_ARROWS_A",
1.1482 + "SUPPLEMENTAL ARROWS-A",
1.1483 + "SUPPLEMENTALARROWS-A");
1.1484 +
1.1485 + /**
1.1486 + * Constant for the "Supplemental Arrows-B" Unicode character block.
1.1487 + * @since 1.5
1.1488 + */
1.1489 + public static final UnicodeBlock SUPPLEMENTAL_ARROWS_B =
1.1490 + new UnicodeBlock("SUPPLEMENTAL_ARROWS_B",
1.1491 + "SUPPLEMENTAL ARROWS-B",
1.1492 + "SUPPLEMENTALARROWS-B");
1.1493 +
1.1494 + /**
1.1495 + * Constant for the "Miscellaneous Mathematical Symbols-B" Unicode
1.1496 + * character block.
1.1497 + * @since 1.5
1.1498 + */
1.1499 + public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B =
1.1500 + new UnicodeBlock("MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B",
1.1501 + "MISCELLANEOUS MATHEMATICAL SYMBOLS-B",
1.1502 + "MISCELLANEOUSMATHEMATICALSYMBOLS-B");
1.1503 +
1.1504 + /**
1.1505 + * Constant for the "Supplemental Mathematical Operators" Unicode
1.1506 + * character block.
1.1507 + * @since 1.5
1.1508 + */
1.1509 + public static final UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS =
1.1510 + new UnicodeBlock("SUPPLEMENTAL_MATHEMATICAL_OPERATORS",
1.1511 + "SUPPLEMENTAL MATHEMATICAL OPERATORS",
1.1512 + "SUPPLEMENTALMATHEMATICALOPERATORS");
1.1513 +
1.1514 + /**
1.1515 + * Constant for the "Miscellaneous Symbols and Arrows" Unicode character
1.1516 + * block.
1.1517 + * @since 1.5
1.1518 + */
1.1519 + public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS =
1.1520 + new UnicodeBlock("MISCELLANEOUS_SYMBOLS_AND_ARROWS",
1.1521 + "MISCELLANEOUS SYMBOLS AND ARROWS",
1.1522 + "MISCELLANEOUSSYMBOLSANDARROWS");
1.1523 +
1.1524 + /**
1.1525 + * Constant for the "Katakana Phonetic Extensions" Unicode character
1.1526 + * block.
1.1527 + * @since 1.5
1.1528 + */
1.1529 + public static final UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS =
1.1530 + new UnicodeBlock("KATAKANA_PHONETIC_EXTENSIONS",
1.1531 + "KATAKANA PHONETIC EXTENSIONS",
1.1532 + "KATAKANAPHONETICEXTENSIONS");
1.1533 +
1.1534 + /**
1.1535 + * Constant for the "Yijing Hexagram Symbols" Unicode character block.
1.1536 + * @since 1.5
1.1537 + */
1.1538 + public static final UnicodeBlock YIJING_HEXAGRAM_SYMBOLS =
1.1539 + new UnicodeBlock("YIJING_HEXAGRAM_SYMBOLS",
1.1540 + "YIJING HEXAGRAM SYMBOLS",
1.1541 + "YIJINGHEXAGRAMSYMBOLS");
1.1542 +
1.1543 + /**
1.1544 + * Constant for the "Variation Selectors" Unicode character block.
1.1545 + * @since 1.5
1.1546 + */
1.1547 + public static final UnicodeBlock VARIATION_SELECTORS =
1.1548 + new UnicodeBlock("VARIATION_SELECTORS",
1.1549 + "VARIATION SELECTORS",
1.1550 + "VARIATIONSELECTORS");
1.1551 +
1.1552 + /**
1.1553 + * Constant for the "Linear B Syllabary" Unicode character block.
1.1554 + * @since 1.5
1.1555 + */
1.1556 + public static final UnicodeBlock LINEAR_B_SYLLABARY =
1.1557 + new UnicodeBlock("LINEAR_B_SYLLABARY",
1.1558 + "LINEAR B SYLLABARY",
1.1559 + "LINEARBSYLLABARY");
1.1560 +
1.1561 + /**
1.1562 + * Constant for the "Linear B Ideograms" Unicode character block.
1.1563 + * @since 1.5
1.1564 + */
1.1565 + public static final UnicodeBlock LINEAR_B_IDEOGRAMS =
1.1566 + new UnicodeBlock("LINEAR_B_IDEOGRAMS",
1.1567 + "LINEAR B IDEOGRAMS",
1.1568 + "LINEARBIDEOGRAMS");
1.1569 +
1.1570 + /**
1.1571 + * Constant for the "Aegean Numbers" Unicode character block.
1.1572 + * @since 1.5
1.1573 + */
1.1574 + public static final UnicodeBlock AEGEAN_NUMBERS =
1.1575 + new UnicodeBlock("AEGEAN_NUMBERS",
1.1576 + "AEGEAN NUMBERS",
1.1577 + "AEGEANNUMBERS");
1.1578 +
1.1579 + /**
1.1580 + * Constant for the "Old Italic" Unicode character block.
1.1581 + * @since 1.5
1.1582 + */
1.1583 + public static final UnicodeBlock OLD_ITALIC =
1.1584 + new UnicodeBlock("OLD_ITALIC",
1.1585 + "OLD ITALIC",
1.1586 + "OLDITALIC");
1.1587 +
1.1588 + /**
1.1589 + * Constant for the "Gothic" Unicode character block.
1.1590 + * @since 1.5
1.1591 + */
1.1592 + public static final UnicodeBlock GOTHIC =
1.1593 + new UnicodeBlock("GOTHIC");
1.1594 +
1.1595 + /**
1.1596 + * Constant for the "Ugaritic" Unicode character block.
1.1597 + * @since 1.5
1.1598 + */
1.1599 + public static final UnicodeBlock UGARITIC =
1.1600 + new UnicodeBlock("UGARITIC");
1.1601 +
1.1602 + /**
1.1603 + * Constant for the "Deseret" Unicode character block.
1.1604 + * @since 1.5
1.1605 + */
1.1606 + public static final UnicodeBlock DESERET =
1.1607 + new UnicodeBlock("DESERET");
1.1608 +
1.1609 + /**
1.1610 + * Constant for the "Shavian" Unicode character block.
1.1611 + * @since 1.5
1.1612 + */
1.1613 + public static final UnicodeBlock SHAVIAN =
1.1614 + new UnicodeBlock("SHAVIAN");
1.1615 +
1.1616 + /**
1.1617 + * Constant for the "Osmanya" Unicode character block.
1.1618 + * @since 1.5
1.1619 + */
1.1620 + public static final UnicodeBlock OSMANYA =
1.1621 + new UnicodeBlock("OSMANYA");
1.1622 +
1.1623 + /**
1.1624 + * Constant for the "Cypriot Syllabary" Unicode character block.
1.1625 + * @since 1.5
1.1626 + */
1.1627 + public static final UnicodeBlock CYPRIOT_SYLLABARY =
1.1628 + new UnicodeBlock("CYPRIOT_SYLLABARY",
1.1629 + "CYPRIOT SYLLABARY",
1.1630 + "CYPRIOTSYLLABARY");
1.1631 +
1.1632 + /**
1.1633 + * Constant for the "Byzantine Musical Symbols" Unicode character block.
1.1634 + * @since 1.5
1.1635 + */
1.1636 + public static final UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS =
1.1637 + new UnicodeBlock("BYZANTINE_MUSICAL_SYMBOLS",
1.1638 + "BYZANTINE MUSICAL SYMBOLS",
1.1639 + "BYZANTINEMUSICALSYMBOLS");
1.1640 +
1.1641 + /**
1.1642 + * Constant for the "Musical Symbols" Unicode character block.
1.1643 + * @since 1.5
1.1644 + */
1.1645 + public static final UnicodeBlock MUSICAL_SYMBOLS =
1.1646 + new UnicodeBlock("MUSICAL_SYMBOLS",
1.1647 + "MUSICAL SYMBOLS",
1.1648 + "MUSICALSYMBOLS");
1.1649 +
1.1650 + /**
1.1651 + * Constant for the "Tai Xuan Jing Symbols" Unicode character block.
1.1652 + * @since 1.5
1.1653 + */
1.1654 + public static final UnicodeBlock TAI_XUAN_JING_SYMBOLS =
1.1655 + new UnicodeBlock("TAI_XUAN_JING_SYMBOLS",
1.1656 + "TAI XUAN JING SYMBOLS",
1.1657 + "TAIXUANJINGSYMBOLS");
1.1658 +
1.1659 + /**
1.1660 + * Constant for the "Mathematical Alphanumeric Symbols" Unicode
1.1661 + * character block.
1.1662 + * @since 1.5
1.1663 + */
1.1664 + public static final UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS =
1.1665 + new UnicodeBlock("MATHEMATICAL_ALPHANUMERIC_SYMBOLS",
1.1666 + "MATHEMATICAL ALPHANUMERIC SYMBOLS",
1.1667 + "MATHEMATICALALPHANUMERICSYMBOLS");
1.1668 +
1.1669 + /**
1.1670 + * Constant for the "CJK Unified Ideographs Extension B" Unicode
1.1671 + * character block.
1.1672 + * @since 1.5
1.1673 + */
1.1674 + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B =
1.1675 + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B",
1.1676 + "CJK UNIFIED IDEOGRAPHS EXTENSION B",
1.1677 + "CJKUNIFIEDIDEOGRAPHSEXTENSIONB");
1.1678 +
1.1679 + /**
1.1680 + * Constant for the "CJK Compatibility Ideographs Supplement" Unicode character block.
1.1681 + * @since 1.5
1.1682 + */
1.1683 + public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT =
1.1684 + new UnicodeBlock("CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT",
1.1685 + "CJK COMPATIBILITY IDEOGRAPHS SUPPLEMENT",
1.1686 + "CJKCOMPATIBILITYIDEOGRAPHSSUPPLEMENT");
1.1687 +
1.1688 + /**
1.1689 + * Constant for the "Tags" Unicode character block.
1.1690 + * @since 1.5
1.1691 + */
1.1692 + public static final UnicodeBlock TAGS =
1.1693 + new UnicodeBlock("TAGS");
1.1694 +
1.1695 + /**
1.1696 + * Constant for the "Variation Selectors Supplement" Unicode character
1.1697 + * block.
1.1698 + * @since 1.5
1.1699 + */
1.1700 + public static final UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT =
1.1701 + new UnicodeBlock("VARIATION_SELECTORS_SUPPLEMENT",
1.1702 + "VARIATION SELECTORS SUPPLEMENT",
1.1703 + "VARIATIONSELECTORSSUPPLEMENT");
1.1704 +
1.1705 + /**
1.1706 + * Constant for the "Supplementary Private Use Area-A" Unicode character
1.1707 + * block.
1.1708 + * @since 1.5
1.1709 + */
1.1710 + public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A =
1.1711 + new UnicodeBlock("SUPPLEMENTARY_PRIVATE_USE_AREA_A",
1.1712 + "SUPPLEMENTARY PRIVATE USE AREA-A",
1.1713 + "SUPPLEMENTARYPRIVATEUSEAREA-A");
1.1714 +
1.1715 + /**
1.1716 + * Constant for the "Supplementary Private Use Area-B" Unicode character
1.1717 + * block.
1.1718 + * @since 1.5
1.1719 + */
1.1720 + public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B =
1.1721 + new UnicodeBlock("SUPPLEMENTARY_PRIVATE_USE_AREA_B",
1.1722 + "SUPPLEMENTARY PRIVATE USE AREA-B",
1.1723 + "SUPPLEMENTARYPRIVATEUSEAREA-B");
1.1724 +
1.1725 + /**
1.1726 + * Constant for the "High Surrogates" Unicode character block.
1.1727 + * This block represents codepoint values in the high surrogate
1.1728 + * range: U+D800 through U+DB7F
1.1729 + *
1.1730 + * @since 1.5
1.1731 + */
1.1732 + public static final UnicodeBlock HIGH_SURROGATES =
1.1733 + new UnicodeBlock("HIGH_SURROGATES",
1.1734 + "HIGH SURROGATES",
1.1735 + "HIGHSURROGATES");
1.1736 +
1.1737 + /**
1.1738 + * Constant for the "High Private Use Surrogates" Unicode character
1.1739 + * block.
1.1740 + * This block represents codepoint values in the private use high
1.1741 + * surrogate range: U+DB80 through U+DBFF
1.1742 + *
1.1743 + * @since 1.5
1.1744 + */
1.1745 + public static final UnicodeBlock HIGH_PRIVATE_USE_SURROGATES =
1.1746 + new UnicodeBlock("HIGH_PRIVATE_USE_SURROGATES",
1.1747 + "HIGH PRIVATE USE SURROGATES",
1.1748 + "HIGHPRIVATEUSESURROGATES");
1.1749 +
1.1750 + /**
1.1751 + * Constant for the "Low Surrogates" Unicode character block.
1.1752 + * This block represents codepoint values in the low surrogate
1.1753 + * range: U+DC00 through U+DFFF
1.1754 + *
1.1755 + * @since 1.5
1.1756 + */
1.1757 + public static final UnicodeBlock LOW_SURROGATES =
1.1758 + new UnicodeBlock("LOW_SURROGATES",
1.1759 + "LOW SURROGATES",
1.1760 + "LOWSURROGATES");
1.1761 +
1.1762 + /**
1.1763 + * Constant for the "Arabic Supplement" Unicode character block.
1.1764 + * @since 1.7
1.1765 + */
1.1766 + public static final UnicodeBlock ARABIC_SUPPLEMENT =
1.1767 + new UnicodeBlock("ARABIC_SUPPLEMENT",
1.1768 + "ARABIC SUPPLEMENT",
1.1769 + "ARABICSUPPLEMENT");
1.1770 +
1.1771 + /**
1.1772 + * Constant for the "NKo" Unicode character block.
1.1773 + * @since 1.7
1.1774 + */
1.1775 + public static final UnicodeBlock NKO =
1.1776 + new UnicodeBlock("NKO");
1.1777 +
1.1778 + /**
1.1779 + * Constant for the "Samaritan" Unicode character block.
1.1780 + * @since 1.7
1.1781 + */
1.1782 + public static final UnicodeBlock SAMARITAN =
1.1783 + new UnicodeBlock("SAMARITAN");
1.1784 +
1.1785 + /**
1.1786 + * Constant for the "Mandaic" Unicode character block.
1.1787 + * @since 1.7
1.1788 + */
1.1789 + public static final UnicodeBlock MANDAIC =
1.1790 + new UnicodeBlock("MANDAIC");
1.1791 +
1.1792 + /**
1.1793 + * Constant for the "Ethiopic Supplement" Unicode character block.
1.1794 + * @since 1.7
1.1795 + */
1.1796 + public static final UnicodeBlock ETHIOPIC_SUPPLEMENT =
1.1797 + new UnicodeBlock("ETHIOPIC_SUPPLEMENT",
1.1798 + "ETHIOPIC SUPPLEMENT",
1.1799 + "ETHIOPICSUPPLEMENT");
1.1800 +
1.1801 + /**
1.1802 + * Constant for the "Unified Canadian Aboriginal Syllabics Extended"
1.1803 + * Unicode character block.
1.1804 + * @since 1.7
1.1805 + */
1.1806 + public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED =
1.1807 + new UnicodeBlock("UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED",
1.1808 + "UNIFIED CANADIAN ABORIGINAL SYLLABICS EXTENDED",
1.1809 + "UNIFIEDCANADIANABORIGINALSYLLABICSEXTENDED");
1.1810 +
1.1811 + /**
1.1812 + * Constant for the "New Tai Lue" Unicode character block.
1.1813 + * @since 1.7
1.1814 + */
1.1815 + public static final UnicodeBlock NEW_TAI_LUE =
1.1816 + new UnicodeBlock("NEW_TAI_LUE",
1.1817 + "NEW TAI LUE",
1.1818 + "NEWTAILUE");
1.1819 +
1.1820 + /**
1.1821 + * Constant for the "Buginese" Unicode character block.
1.1822 + * @since 1.7
1.1823 + */
1.1824 + public static final UnicodeBlock BUGINESE =
1.1825 + new UnicodeBlock("BUGINESE");
1.1826 +
1.1827 + /**
1.1828 + * Constant for the "Tai Tham" Unicode character block.
1.1829 + * @since 1.7
1.1830 + */
1.1831 + public static final UnicodeBlock TAI_THAM =
1.1832 + new UnicodeBlock("TAI_THAM",
1.1833 + "TAI THAM",
1.1834 + "TAITHAM");
1.1835 +
1.1836 + /**
1.1837 + * Constant for the "Balinese" Unicode character block.
1.1838 + * @since 1.7
1.1839 + */
1.1840 + public static final UnicodeBlock BALINESE =
1.1841 + new UnicodeBlock("BALINESE");
1.1842 +
1.1843 + /**
1.1844 + * Constant for the "Sundanese" Unicode character block.
1.1845 + * @since 1.7
1.1846 + */
1.1847 + public static final UnicodeBlock SUNDANESE =
1.1848 + new UnicodeBlock("SUNDANESE");
1.1849 +
1.1850 + /**
1.1851 + * Constant for the "Batak" Unicode character block.
1.1852 + * @since 1.7
1.1853 + */
1.1854 + public static final UnicodeBlock BATAK =
1.1855 + new UnicodeBlock("BATAK");
1.1856 +
1.1857 + /**
1.1858 + * Constant for the "Lepcha" Unicode character block.
1.1859 + * @since 1.7
1.1860 + */
1.1861 + public static final UnicodeBlock LEPCHA =
1.1862 + new UnicodeBlock("LEPCHA");
1.1863 +
1.1864 + /**
1.1865 + * Constant for the "Ol Chiki" Unicode character block.
1.1866 + * @since 1.7
1.1867 + */
1.1868 + public static final UnicodeBlock OL_CHIKI =
1.1869 + new UnicodeBlock("OL_CHIKI",
1.1870 + "OL CHIKI",
1.1871 + "OLCHIKI");
1.1872 +
1.1873 + /**
1.1874 + * Constant for the "Vedic Extensions" Unicode character block.
1.1875 + * @since 1.7
1.1876 + */
1.1877 + public static final UnicodeBlock VEDIC_EXTENSIONS =
1.1878 + new UnicodeBlock("VEDIC_EXTENSIONS",
1.1879 + "VEDIC EXTENSIONS",
1.1880 + "VEDICEXTENSIONS");
1.1881 +
1.1882 + /**
1.1883 + * Constant for the "Phonetic Extensions Supplement" Unicode character
1.1884 + * block.
1.1885 + * @since 1.7
1.1886 + */
1.1887 + public static final UnicodeBlock PHONETIC_EXTENSIONS_SUPPLEMENT =
1.1888 + new UnicodeBlock("PHONETIC_EXTENSIONS_SUPPLEMENT",
1.1889 + "PHONETIC EXTENSIONS SUPPLEMENT",
1.1890 + "PHONETICEXTENSIONSSUPPLEMENT");
1.1891 +
1.1892 + /**
1.1893 + * Constant for the "Combining Diacritical Marks Supplement" Unicode
1.1894 + * character block.
1.1895 + * @since 1.7
1.1896 + */
1.1897 + public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS_SUPPLEMENT =
1.1898 + new UnicodeBlock("COMBINING_DIACRITICAL_MARKS_SUPPLEMENT",
1.1899 + "COMBINING DIACRITICAL MARKS SUPPLEMENT",
1.1900 + "COMBININGDIACRITICALMARKSSUPPLEMENT");
1.1901 +
1.1902 + /**
1.1903 + * Constant for the "Glagolitic" Unicode character block.
1.1904 + * @since 1.7
1.1905 + */
1.1906 + public static final UnicodeBlock GLAGOLITIC =
1.1907 + new UnicodeBlock("GLAGOLITIC");
1.1908 +
1.1909 + /**
1.1910 + * Constant for the "Latin Extended-C" Unicode character block.
1.1911 + * @since 1.7
1.1912 + */
1.1913 + public static final UnicodeBlock LATIN_EXTENDED_C =
1.1914 + new UnicodeBlock("LATIN_EXTENDED_C",
1.1915 + "LATIN EXTENDED-C",
1.1916 + "LATINEXTENDED-C");
1.1917 +
1.1918 + /**
1.1919 + * Constant for the "Coptic" Unicode character block.
1.1920 + * @since 1.7
1.1921 + */
1.1922 + public static final UnicodeBlock COPTIC =
1.1923 + new UnicodeBlock("COPTIC");
1.1924 +
1.1925 + /**
1.1926 + * Constant for the "Georgian Supplement" Unicode character block.
1.1927 + * @since 1.7
1.1928 + */
1.1929 + public static final UnicodeBlock GEORGIAN_SUPPLEMENT =
1.1930 + new UnicodeBlock("GEORGIAN_SUPPLEMENT",
1.1931 + "GEORGIAN SUPPLEMENT",
1.1932 + "GEORGIANSUPPLEMENT");
1.1933 +
1.1934 + /**
1.1935 + * Constant for the "Tifinagh" Unicode character block.
1.1936 + * @since 1.7
1.1937 + */
1.1938 + public static final UnicodeBlock TIFINAGH =
1.1939 + new UnicodeBlock("TIFINAGH");
1.1940 +
1.1941 + /**
1.1942 + * Constant for the "Ethiopic Extended" Unicode character block.
1.1943 + * @since 1.7
1.1944 + */
1.1945 + public static final UnicodeBlock ETHIOPIC_EXTENDED =
1.1946 + new UnicodeBlock("ETHIOPIC_EXTENDED",
1.1947 + "ETHIOPIC EXTENDED",
1.1948 + "ETHIOPICEXTENDED");
1.1949 +
1.1950 + /**
1.1951 + * Constant for the "Cyrillic Extended-A" Unicode character block.
1.1952 + * @since 1.7
1.1953 + */
1.1954 + public static final UnicodeBlock CYRILLIC_EXTENDED_A =
1.1955 + new UnicodeBlock("CYRILLIC_EXTENDED_A",
1.1956 + "CYRILLIC EXTENDED-A",
1.1957 + "CYRILLICEXTENDED-A");
1.1958 +
1.1959 + /**
1.1960 + * Constant for the "Supplemental Punctuation" Unicode character block.
1.1961 + * @since 1.7
1.1962 + */
1.1963 + public static final UnicodeBlock SUPPLEMENTAL_PUNCTUATION =
1.1964 + new UnicodeBlock("SUPPLEMENTAL_PUNCTUATION",
1.1965 + "SUPPLEMENTAL PUNCTUATION",
1.1966 + "SUPPLEMENTALPUNCTUATION");
1.1967 +
1.1968 + /**
1.1969 + * Constant for the "CJK Strokes" Unicode character block.
1.1970 + * @since 1.7
1.1971 + */
1.1972 + public static final UnicodeBlock CJK_STROKES =
1.1973 + new UnicodeBlock("CJK_STROKES",
1.1974 + "CJK STROKES",
1.1975 + "CJKSTROKES");
1.1976 +
1.1977 + /**
1.1978 + * Constant for the "Lisu" Unicode character block.
1.1979 + * @since 1.7
1.1980 + */
1.1981 + public static final UnicodeBlock LISU =
1.1982 + new UnicodeBlock("LISU");
1.1983 +
1.1984 + /**
1.1985 + * Constant for the "Vai" Unicode character block.
1.1986 + * @since 1.7
1.1987 + */
1.1988 + public static final UnicodeBlock VAI =
1.1989 + new UnicodeBlock("VAI");
1.1990 +
1.1991 + /**
1.1992 + * Constant for the "Cyrillic Extended-B" Unicode character block.
1.1993 + * @since 1.7
1.1994 + */
1.1995 + public static final UnicodeBlock CYRILLIC_EXTENDED_B =
1.1996 + new UnicodeBlock("CYRILLIC_EXTENDED_B",
1.1997 + "CYRILLIC EXTENDED-B",
1.1998 + "CYRILLICEXTENDED-B");
1.1999 +
1.2000 + /**
1.2001 + * Constant for the "Bamum" Unicode character block.
1.2002 + * @since 1.7
1.2003 + */
1.2004 + public static final UnicodeBlock BAMUM =
1.2005 + new UnicodeBlock("BAMUM");
1.2006 +
1.2007 + /**
1.2008 + * Constant for the "Modifier Tone Letters" Unicode character block.
1.2009 + * @since 1.7
1.2010 + */
1.2011 + public static final UnicodeBlock MODIFIER_TONE_LETTERS =
1.2012 + new UnicodeBlock("MODIFIER_TONE_LETTERS",
1.2013 + "MODIFIER TONE LETTERS",
1.2014 + "MODIFIERTONELETTERS");
1.2015 +
1.2016 + /**
1.2017 + * Constant for the "Latin Extended-D" Unicode character block.
1.2018 + * @since 1.7
1.2019 + */
1.2020 + public static final UnicodeBlock LATIN_EXTENDED_D =
1.2021 + new UnicodeBlock("LATIN_EXTENDED_D",
1.2022 + "LATIN EXTENDED-D",
1.2023 + "LATINEXTENDED-D");
1.2024 +
1.2025 + /**
1.2026 + * Constant for the "Syloti Nagri" Unicode character block.
1.2027 + * @since 1.7
1.2028 + */
1.2029 + public static final UnicodeBlock SYLOTI_NAGRI =
1.2030 + new UnicodeBlock("SYLOTI_NAGRI",
1.2031 + "SYLOTI NAGRI",
1.2032 + "SYLOTINAGRI");
1.2033 +
1.2034 + /**
1.2035 + * Constant for the "Common Indic Number Forms" Unicode character block.
1.2036 + * @since 1.7
1.2037 + */
1.2038 + public static final UnicodeBlock COMMON_INDIC_NUMBER_FORMS =
1.2039 + new UnicodeBlock("COMMON_INDIC_NUMBER_FORMS",
1.2040 + "COMMON INDIC NUMBER FORMS",
1.2041 + "COMMONINDICNUMBERFORMS");
1.2042 +
1.2043 + /**
1.2044 + * Constant for the "Phags-pa" Unicode character block.
1.2045 + * @since 1.7
1.2046 + */
1.2047 + public static final UnicodeBlock PHAGS_PA =
1.2048 + new UnicodeBlock("PHAGS_PA",
1.2049 + "PHAGS-PA");
1.2050 +
1.2051 + /**
1.2052 + * Constant for the "Saurashtra" Unicode character block.
1.2053 + * @since 1.7
1.2054 + */
1.2055 + public static final UnicodeBlock SAURASHTRA =
1.2056 + new UnicodeBlock("SAURASHTRA");
1.2057 +
1.2058 + /**
1.2059 + * Constant for the "Devanagari Extended" Unicode character block.
1.2060 + * @since 1.7
1.2061 + */
1.2062 + public static final UnicodeBlock DEVANAGARI_EXTENDED =
1.2063 + new UnicodeBlock("DEVANAGARI_EXTENDED",
1.2064 + "DEVANAGARI EXTENDED",
1.2065 + "DEVANAGARIEXTENDED");
1.2066 +
1.2067 + /**
1.2068 + * Constant for the "Kayah Li" Unicode character block.
1.2069 + * @since 1.7
1.2070 + */
1.2071 + public static final UnicodeBlock KAYAH_LI =
1.2072 + new UnicodeBlock("KAYAH_LI",
1.2073 + "KAYAH LI",
1.2074 + "KAYAHLI");
1.2075 +
1.2076 + /**
1.2077 + * Constant for the "Rejang" Unicode character block.
1.2078 + * @since 1.7
1.2079 + */
1.2080 + public static final UnicodeBlock REJANG =
1.2081 + new UnicodeBlock("REJANG");
1.2082 +
1.2083 + /**
1.2084 + * Constant for the "Hangul Jamo Extended-A" Unicode character block.
1.2085 + * @since 1.7
1.2086 + */
1.2087 + public static final UnicodeBlock HANGUL_JAMO_EXTENDED_A =
1.2088 + new UnicodeBlock("HANGUL_JAMO_EXTENDED_A",
1.2089 + "HANGUL JAMO EXTENDED-A",
1.2090 + "HANGULJAMOEXTENDED-A");
1.2091 +
1.2092 + /**
1.2093 + * Constant for the "Javanese" Unicode character block.
1.2094 + * @since 1.7
1.2095 + */
1.2096 + public static final UnicodeBlock JAVANESE =
1.2097 + new UnicodeBlock("JAVANESE");
1.2098 +
1.2099 + /**
1.2100 + * Constant for the "Cham" Unicode character block.
1.2101 + * @since 1.7
1.2102 + */
1.2103 + public static final UnicodeBlock CHAM =
1.2104 + new UnicodeBlock("CHAM");
1.2105 +
1.2106 + /**
1.2107 + * Constant for the "Myanmar Extended-A" Unicode character block.
1.2108 + * @since 1.7
1.2109 + */
1.2110 + public static final UnicodeBlock MYANMAR_EXTENDED_A =
1.2111 + new UnicodeBlock("MYANMAR_EXTENDED_A",
1.2112 + "MYANMAR EXTENDED-A",
1.2113 + "MYANMAREXTENDED-A");
1.2114 +
1.2115 + /**
1.2116 + * Constant for the "Tai Viet" Unicode character block.
1.2117 + * @since 1.7
1.2118 + */
1.2119 + public static final UnicodeBlock TAI_VIET =
1.2120 + new UnicodeBlock("TAI_VIET",
1.2121 + "TAI VIET",
1.2122 + "TAIVIET");
1.2123 +
1.2124 + /**
1.2125 + * Constant for the "Ethiopic Extended-A" Unicode character block.
1.2126 + * @since 1.7
1.2127 + */
1.2128 + public static final UnicodeBlock ETHIOPIC_EXTENDED_A =
1.2129 + new UnicodeBlock("ETHIOPIC_EXTENDED_A",
1.2130 + "ETHIOPIC EXTENDED-A",
1.2131 + "ETHIOPICEXTENDED-A");
1.2132 +
1.2133 + /**
1.2134 + * Constant for the "Meetei Mayek" Unicode character block.
1.2135 + * @since 1.7
1.2136 + */
1.2137 + public static final UnicodeBlock MEETEI_MAYEK =
1.2138 + new UnicodeBlock("MEETEI_MAYEK",
1.2139 + "MEETEI MAYEK",
1.2140 + "MEETEIMAYEK");
1.2141 +
1.2142 + /**
1.2143 + * Constant for the "Hangul Jamo Extended-B" Unicode character block.
1.2144 + * @since 1.7
1.2145 + */
1.2146 + public static final UnicodeBlock HANGUL_JAMO_EXTENDED_B =
1.2147 + new UnicodeBlock("HANGUL_JAMO_EXTENDED_B",
1.2148 + "HANGUL JAMO EXTENDED-B",
1.2149 + "HANGULJAMOEXTENDED-B");
1.2150 +
1.2151 + /**
1.2152 + * Constant for the "Vertical Forms" Unicode character block.
1.2153 + * @since 1.7
1.2154 + */
1.2155 + public static final UnicodeBlock VERTICAL_FORMS =
1.2156 + new UnicodeBlock("VERTICAL_FORMS",
1.2157 + "VERTICAL FORMS",
1.2158 + "VERTICALFORMS");
1.2159 +
1.2160 + /**
1.2161 + * Constant for the "Ancient Greek Numbers" Unicode character block.
1.2162 + * @since 1.7
1.2163 + */
1.2164 + public static final UnicodeBlock ANCIENT_GREEK_NUMBERS =
1.2165 + new UnicodeBlock("ANCIENT_GREEK_NUMBERS",
1.2166 + "ANCIENT GREEK NUMBERS",
1.2167 + "ANCIENTGREEKNUMBERS");
1.2168 +
1.2169 + /**
1.2170 + * Constant for the "Ancient Symbols" Unicode character block.
1.2171 + * @since 1.7
1.2172 + */
1.2173 + public static final UnicodeBlock ANCIENT_SYMBOLS =
1.2174 + new UnicodeBlock("ANCIENT_SYMBOLS",
1.2175 + "ANCIENT SYMBOLS",
1.2176 + "ANCIENTSYMBOLS");
1.2177 +
1.2178 + /**
1.2179 + * Constant for the "Phaistos Disc" Unicode character block.
1.2180 + * @since 1.7
1.2181 + */
1.2182 + public static final UnicodeBlock PHAISTOS_DISC =
1.2183 + new UnicodeBlock("PHAISTOS_DISC",
1.2184 + "PHAISTOS DISC",
1.2185 + "PHAISTOSDISC");
1.2186 +
1.2187 + /**
1.2188 + * Constant for the "Lycian" Unicode character block.
1.2189 + * @since 1.7
1.2190 + */
1.2191 + public static final UnicodeBlock LYCIAN =
1.2192 + new UnicodeBlock("LYCIAN");
1.2193 +
1.2194 + /**
1.2195 + * Constant for the "Carian" Unicode character block.
1.2196 + * @since 1.7
1.2197 + */
1.2198 + public static final UnicodeBlock CARIAN =
1.2199 + new UnicodeBlock("CARIAN");
1.2200 +
1.2201 + /**
1.2202 + * Constant for the "Old Persian" Unicode character block.
1.2203 + * @since 1.7
1.2204 + */
1.2205 + public static final UnicodeBlock OLD_PERSIAN =
1.2206 + new UnicodeBlock("OLD_PERSIAN",
1.2207 + "OLD PERSIAN",
1.2208 + "OLDPERSIAN");
1.2209 +
1.2210 + /**
1.2211 + * Constant for the "Imperial Aramaic" Unicode character block.
1.2212 + * @since 1.7
1.2213 + */
1.2214 + public static final UnicodeBlock IMPERIAL_ARAMAIC =
1.2215 + new UnicodeBlock("IMPERIAL_ARAMAIC",
1.2216 + "IMPERIAL ARAMAIC",
1.2217 + "IMPERIALARAMAIC");
1.2218 +
1.2219 + /**
1.2220 + * Constant for the "Phoenician" Unicode character block.
1.2221 + * @since 1.7
1.2222 + */
1.2223 + public static final UnicodeBlock PHOENICIAN =
1.2224 + new UnicodeBlock("PHOENICIAN");
1.2225 +
1.2226 + /**
1.2227 + * Constant for the "Lydian" Unicode character block.
1.2228 + * @since 1.7
1.2229 + */
1.2230 + public static final UnicodeBlock LYDIAN =
1.2231 + new UnicodeBlock("LYDIAN");
1.2232 +
1.2233 + /**
1.2234 + * Constant for the "Kharoshthi" Unicode character block.
1.2235 + * @since 1.7
1.2236 + */
1.2237 + public static final UnicodeBlock KHAROSHTHI =
1.2238 + new UnicodeBlock("KHAROSHTHI");
1.2239 +
1.2240 + /**
1.2241 + * Constant for the "Old South Arabian" Unicode character block.
1.2242 + * @since 1.7
1.2243 + */
1.2244 + public static final UnicodeBlock OLD_SOUTH_ARABIAN =
1.2245 + new UnicodeBlock("OLD_SOUTH_ARABIAN",
1.2246 + "OLD SOUTH ARABIAN",
1.2247 + "OLDSOUTHARABIAN");
1.2248 +
1.2249 + /**
1.2250 + * Constant for the "Avestan" Unicode character block.
1.2251 + * @since 1.7
1.2252 + */
1.2253 + public static final UnicodeBlock AVESTAN =
1.2254 + new UnicodeBlock("AVESTAN");
1.2255 +
1.2256 + /**
1.2257 + * Constant for the "Inscriptional Parthian" Unicode character block.
1.2258 + * @since 1.7
1.2259 + */
1.2260 + public static final UnicodeBlock INSCRIPTIONAL_PARTHIAN =
1.2261 + new UnicodeBlock("INSCRIPTIONAL_PARTHIAN",
1.2262 + "INSCRIPTIONAL PARTHIAN",
1.2263 + "INSCRIPTIONALPARTHIAN");
1.2264 +
1.2265 + /**
1.2266 + * Constant for the "Inscriptional Pahlavi" Unicode character block.
1.2267 + * @since 1.7
1.2268 + */
1.2269 + public static final UnicodeBlock INSCRIPTIONAL_PAHLAVI =
1.2270 + new UnicodeBlock("INSCRIPTIONAL_PAHLAVI",
1.2271 + "INSCRIPTIONAL PAHLAVI",
1.2272 + "INSCRIPTIONALPAHLAVI");
1.2273 +
1.2274 + /**
1.2275 + * Constant for the "Old Turkic" Unicode character block.
1.2276 + * @since 1.7
1.2277 + */
1.2278 + public static final UnicodeBlock OLD_TURKIC =
1.2279 + new UnicodeBlock("OLD_TURKIC",
1.2280 + "OLD TURKIC",
1.2281 + "OLDTURKIC");
1.2282 +
1.2283 + /**
1.2284 + * Constant for the "Rumi Numeral Symbols" Unicode character block.
1.2285 + * @since 1.7
1.2286 + */
1.2287 + public static final UnicodeBlock RUMI_NUMERAL_SYMBOLS =
1.2288 + new UnicodeBlock("RUMI_NUMERAL_SYMBOLS",
1.2289 + "RUMI NUMERAL SYMBOLS",
1.2290 + "RUMINUMERALSYMBOLS");
1.2291 +
1.2292 + /**
1.2293 + * Constant for the "Brahmi" Unicode character block.
1.2294 + * @since 1.7
1.2295 + */
1.2296 + public static final UnicodeBlock BRAHMI =
1.2297 + new UnicodeBlock("BRAHMI");
1.2298 +
1.2299 + /**
1.2300 + * Constant for the "Kaithi" Unicode character block.
1.2301 + * @since 1.7
1.2302 + */
1.2303 + public static final UnicodeBlock KAITHI =
1.2304 + new UnicodeBlock("KAITHI");
1.2305 +
1.2306 + /**
1.2307 + * Constant for the "Cuneiform" Unicode character block.
1.2308 + * @since 1.7
1.2309 + */
1.2310 + public static final UnicodeBlock CUNEIFORM =
1.2311 + new UnicodeBlock("CUNEIFORM");
1.2312 +
1.2313 + /**
1.2314 + * Constant for the "Cuneiform Numbers and Punctuation" Unicode
1.2315 + * character block.
1.2316 + * @since 1.7
1.2317 + */
1.2318 + public static final UnicodeBlock CUNEIFORM_NUMBERS_AND_PUNCTUATION =
1.2319 + new UnicodeBlock("CUNEIFORM_NUMBERS_AND_PUNCTUATION",
1.2320 + "CUNEIFORM NUMBERS AND PUNCTUATION",
1.2321 + "CUNEIFORMNUMBERSANDPUNCTUATION");
1.2322 +
1.2323 + /**
1.2324 + * Constant for the "Egyptian Hieroglyphs" Unicode character block.
1.2325 + * @since 1.7
1.2326 + */
1.2327 + public static final UnicodeBlock EGYPTIAN_HIEROGLYPHS =
1.2328 + new UnicodeBlock("EGYPTIAN_HIEROGLYPHS",
1.2329 + "EGYPTIAN HIEROGLYPHS",
1.2330 + "EGYPTIANHIEROGLYPHS");
1.2331 +
1.2332 + /**
1.2333 + * Constant for the "Bamum Supplement" Unicode character block.
1.2334 + * @since 1.7
1.2335 + */
1.2336 + public static final UnicodeBlock BAMUM_SUPPLEMENT =
1.2337 + new UnicodeBlock("BAMUM_SUPPLEMENT",
1.2338 + "BAMUM SUPPLEMENT",
1.2339 + "BAMUMSUPPLEMENT");
1.2340 +
1.2341 + /**
1.2342 + * Constant for the "Kana Supplement" Unicode character block.
1.2343 + * @since 1.7
1.2344 + */
1.2345 + public static final UnicodeBlock KANA_SUPPLEMENT =
1.2346 + new UnicodeBlock("KANA_SUPPLEMENT",
1.2347 + "KANA SUPPLEMENT",
1.2348 + "KANASUPPLEMENT");
1.2349 +
1.2350 + /**
1.2351 + * Constant for the "Ancient Greek Musical Notation" Unicode character
1.2352 + * block.
1.2353 + * @since 1.7
1.2354 + */
1.2355 + public static final UnicodeBlock ANCIENT_GREEK_MUSICAL_NOTATION =
1.2356 + new UnicodeBlock("ANCIENT_GREEK_MUSICAL_NOTATION",
1.2357 + "ANCIENT GREEK MUSICAL NOTATION",
1.2358 + "ANCIENTGREEKMUSICALNOTATION");
1.2359 +
1.2360 + /**
1.2361 + * Constant for the "Counting Rod Numerals" Unicode character block.
1.2362 + * @since 1.7
1.2363 + */
1.2364 + public static final UnicodeBlock COUNTING_ROD_NUMERALS =
1.2365 + new UnicodeBlock("COUNTING_ROD_NUMERALS",
1.2366 + "COUNTING ROD NUMERALS",
1.2367 + "COUNTINGRODNUMERALS");
1.2368 +
1.2369 + /**
1.2370 + * Constant for the "Mahjong Tiles" Unicode character block.
1.2371 + * @since 1.7
1.2372 + */
1.2373 + public static final UnicodeBlock MAHJONG_TILES =
1.2374 + new UnicodeBlock("MAHJONG_TILES",
1.2375 + "MAHJONG TILES",
1.2376 + "MAHJONGTILES");
1.2377 +
1.2378 + /**
1.2379 + * Constant for the "Domino Tiles" Unicode character block.
1.2380 + * @since 1.7
1.2381 + */
1.2382 + public static final UnicodeBlock DOMINO_TILES =
1.2383 + new UnicodeBlock("DOMINO_TILES",
1.2384 + "DOMINO TILES",
1.2385 + "DOMINOTILES");
1.2386 +
1.2387 + /**
1.2388 + * Constant for the "Playing Cards" Unicode character block.
1.2389 + * @since 1.7
1.2390 + */
1.2391 + public static final UnicodeBlock PLAYING_CARDS =
1.2392 + new UnicodeBlock("PLAYING_CARDS",
1.2393 + "PLAYING CARDS",
1.2394 + "PLAYINGCARDS");
1.2395 +
1.2396 + /**
1.2397 + * Constant for the "Enclosed Alphanumeric Supplement" Unicode character
1.2398 + * block.
1.2399 + * @since 1.7
1.2400 + */
1.2401 + public static final UnicodeBlock ENCLOSED_ALPHANUMERIC_SUPPLEMENT =
1.2402 + new UnicodeBlock("ENCLOSED_ALPHANUMERIC_SUPPLEMENT",
1.2403 + "ENCLOSED ALPHANUMERIC SUPPLEMENT",
1.2404 + "ENCLOSEDALPHANUMERICSUPPLEMENT");
1.2405 +
1.2406 + /**
1.2407 + * Constant for the "Enclosed Ideographic Supplement" Unicode character
1.2408 + * block.
1.2409 + * @since 1.7
1.2410 + */
1.2411 + public static final UnicodeBlock ENCLOSED_IDEOGRAPHIC_SUPPLEMENT =
1.2412 + new UnicodeBlock("ENCLOSED_IDEOGRAPHIC_SUPPLEMENT",
1.2413 + "ENCLOSED IDEOGRAPHIC SUPPLEMENT",
1.2414 + "ENCLOSEDIDEOGRAPHICSUPPLEMENT");
1.2415 +
1.2416 + /**
1.2417 + * Constant for the "Miscellaneous Symbols And Pictographs" Unicode
1.2418 + * character block.
1.2419 + * @since 1.7
1.2420 + */
1.2421 + public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS =
1.2422 + new UnicodeBlock("MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS",
1.2423 + "MISCELLANEOUS SYMBOLS AND PICTOGRAPHS",
1.2424 + "MISCELLANEOUSSYMBOLSANDPICTOGRAPHS");
1.2425 +
1.2426 + /**
1.2427 + * Constant for the "Emoticons" Unicode character block.
1.2428 + * @since 1.7
1.2429 + */
1.2430 + public static final UnicodeBlock EMOTICONS =
1.2431 + new UnicodeBlock("EMOTICONS");
1.2432 +
1.2433 + /**
1.2434 + * Constant for the "Transport And Map Symbols" Unicode character block.
1.2435 + * @since 1.7
1.2436 + */
1.2437 + public static final UnicodeBlock TRANSPORT_AND_MAP_SYMBOLS =
1.2438 + new UnicodeBlock("TRANSPORT_AND_MAP_SYMBOLS",
1.2439 + "TRANSPORT AND MAP SYMBOLS",
1.2440 + "TRANSPORTANDMAPSYMBOLS");
1.2441 +
1.2442 + /**
1.2443 + * Constant for the "Alchemical Symbols" Unicode character block.
1.2444 + * @since 1.7
1.2445 + */
1.2446 + public static final UnicodeBlock ALCHEMICAL_SYMBOLS =
1.2447 + new UnicodeBlock("ALCHEMICAL_SYMBOLS",
1.2448 + "ALCHEMICAL SYMBOLS",
1.2449 + "ALCHEMICALSYMBOLS");
1.2450 +
1.2451 + /**
1.2452 + * Constant for the "CJK Unified Ideographs Extension C" Unicode
1.2453 + * character block.
1.2454 + * @since 1.7
1.2455 + */
1.2456 + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C =
1.2457 + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C",
1.2458 + "CJK UNIFIED IDEOGRAPHS EXTENSION C",
1.2459 + "CJKUNIFIEDIDEOGRAPHSEXTENSIONC");
1.2460 +
1.2461 + /**
1.2462 + * Constant for the "CJK Unified Ideographs Extension D" Unicode
1.2463 + * character block.
1.2464 + * @since 1.7
1.2465 + */
1.2466 + public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D =
1.2467 + new UnicodeBlock("CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D",
1.2468 + "CJK UNIFIED IDEOGRAPHS EXTENSION D",
1.2469 + "CJKUNIFIEDIDEOGRAPHSEXTENSIOND");
1.2470 +
1.2471 + private static final int blockStarts[] = {
1.2472 + 0x0000, // 0000..007F; Basic Latin
1.2473 + 0x0080, // 0080..00FF; Latin-1 Supplement
1.2474 + 0x0100, // 0100..017F; Latin Extended-A
1.2475 + 0x0180, // 0180..024F; Latin Extended-B
1.2476 + 0x0250, // 0250..02AF; IPA Extensions
1.2477 + 0x02B0, // 02B0..02FF; Spacing Modifier Letters
1.2478 + 0x0300, // 0300..036F; Combining Diacritical Marks
1.2479 + 0x0370, // 0370..03FF; Greek and Coptic
1.2480 + 0x0400, // 0400..04FF; Cyrillic
1.2481 + 0x0500, // 0500..052F; Cyrillic Supplement
1.2482 + 0x0530, // 0530..058F; Armenian
1.2483 + 0x0590, // 0590..05FF; Hebrew
1.2484 + 0x0600, // 0600..06FF; Arabic
1.2485 + 0x0700, // 0700..074F; Syriac
1.2486 + 0x0750, // 0750..077F; Arabic Supplement
1.2487 + 0x0780, // 0780..07BF; Thaana
1.2488 + 0x07C0, // 07C0..07FF; NKo
1.2489 + 0x0800, // 0800..083F; Samaritan
1.2490 + 0x0840, // 0840..085F; Mandaic
1.2491 + 0x0860, // unassigned
1.2492 + 0x0900, // 0900..097F; Devanagari
1.2493 + 0x0980, // 0980..09FF; Bengali
1.2494 + 0x0A00, // 0A00..0A7F; Gurmukhi
1.2495 + 0x0A80, // 0A80..0AFF; Gujarati
1.2496 + 0x0B00, // 0B00..0B7F; Oriya
1.2497 + 0x0B80, // 0B80..0BFF; Tamil
1.2498 + 0x0C00, // 0C00..0C7F; Telugu
1.2499 + 0x0C80, // 0C80..0CFF; Kannada
1.2500 + 0x0D00, // 0D00..0D7F; Malayalam
1.2501 + 0x0D80, // 0D80..0DFF; Sinhala
1.2502 + 0x0E00, // 0E00..0E7F; Thai
1.2503 + 0x0E80, // 0E80..0EFF; Lao
1.2504 + 0x0F00, // 0F00..0FFF; Tibetan
1.2505 + 0x1000, // 1000..109F; Myanmar
1.2506 + 0x10A0, // 10A0..10FF; Georgian
1.2507 + 0x1100, // 1100..11FF; Hangul Jamo
1.2508 + 0x1200, // 1200..137F; Ethiopic
1.2509 + 0x1380, // 1380..139F; Ethiopic Supplement
1.2510 + 0x13A0, // 13A0..13FF; Cherokee
1.2511 + 0x1400, // 1400..167F; Unified Canadian Aboriginal Syllabics
1.2512 + 0x1680, // 1680..169F; Ogham
1.2513 + 0x16A0, // 16A0..16FF; Runic
1.2514 + 0x1700, // 1700..171F; Tagalog
1.2515 + 0x1720, // 1720..173F; Hanunoo
1.2516 + 0x1740, // 1740..175F; Buhid
1.2517 + 0x1760, // 1760..177F; Tagbanwa
1.2518 + 0x1780, // 1780..17FF; Khmer
1.2519 + 0x1800, // 1800..18AF; Mongolian
1.2520 + 0x18B0, // 18B0..18FF; Unified Canadian Aboriginal Syllabics Extended
1.2521 + 0x1900, // 1900..194F; Limbu
1.2522 + 0x1950, // 1950..197F; Tai Le
1.2523 + 0x1980, // 1980..19DF; New Tai Lue
1.2524 + 0x19E0, // 19E0..19FF; Khmer Symbols
1.2525 + 0x1A00, // 1A00..1A1F; Buginese
1.2526 + 0x1A20, // 1A20..1AAF; Tai Tham
1.2527 + 0x1AB0, // unassigned
1.2528 + 0x1B00, // 1B00..1B7F; Balinese
1.2529 + 0x1B80, // 1B80..1BBF; Sundanese
1.2530 + 0x1BC0, // 1BC0..1BFF; Batak
1.2531 + 0x1C00, // 1C00..1C4F; Lepcha
1.2532 + 0x1C50, // 1C50..1C7F; Ol Chiki
1.2533 + 0x1C80, // unassigned
1.2534 + 0x1CD0, // 1CD0..1CFF; Vedic Extensions
1.2535 + 0x1D00, // 1D00..1D7F; Phonetic Extensions
1.2536 + 0x1D80, // 1D80..1DBF; Phonetic Extensions Supplement
1.2537 + 0x1DC0, // 1DC0..1DFF; Combining Diacritical Marks Supplement
1.2538 + 0x1E00, // 1E00..1EFF; Latin Extended Additional
1.2539 + 0x1F00, // 1F00..1FFF; Greek Extended
1.2540 + 0x2000, // 2000..206F; General Punctuation
1.2541 + 0x2070, // 2070..209F; Superscripts and Subscripts
1.2542 + 0x20A0, // 20A0..20CF; Currency Symbols
1.2543 + 0x20D0, // 20D0..20FF; Combining Diacritical Marks for Symbols
1.2544 + 0x2100, // 2100..214F; Letterlike Symbols
1.2545 + 0x2150, // 2150..218F; Number Forms
1.2546 + 0x2190, // 2190..21FF; Arrows
1.2547 + 0x2200, // 2200..22FF; Mathematical Operators
1.2548 + 0x2300, // 2300..23FF; Miscellaneous Technical
1.2549 + 0x2400, // 2400..243F; Control Pictures
1.2550 + 0x2440, // 2440..245F; Optical Character Recognition
1.2551 + 0x2460, // 2460..24FF; Enclosed Alphanumerics
1.2552 + 0x2500, // 2500..257F; Box Drawing
1.2553 + 0x2580, // 2580..259F; Block Elements
1.2554 + 0x25A0, // 25A0..25FF; Geometric Shapes
1.2555 + 0x2600, // 2600..26FF; Miscellaneous Symbols
1.2556 + 0x2700, // 2700..27BF; Dingbats
1.2557 + 0x27C0, // 27C0..27EF; Miscellaneous Mathematical Symbols-A
1.2558 + 0x27F0, // 27F0..27FF; Supplemental Arrows-A
1.2559 + 0x2800, // 2800..28FF; Braille Patterns
1.2560 + 0x2900, // 2900..297F; Supplemental Arrows-B
1.2561 + 0x2980, // 2980..29FF; Miscellaneous Mathematical Symbols-B
1.2562 + 0x2A00, // 2A00..2AFF; Supplemental Mathematical Operators
1.2563 + 0x2B00, // 2B00..2BFF; Miscellaneous Symbols and Arrows
1.2564 + 0x2C00, // 2C00..2C5F; Glagolitic
1.2565 + 0x2C60, // 2C60..2C7F; Latin Extended-C
1.2566 + 0x2C80, // 2C80..2CFF; Coptic
1.2567 + 0x2D00, // 2D00..2D2F; Georgian Supplement
1.2568 + 0x2D30, // 2D30..2D7F; Tifinagh
1.2569 + 0x2D80, // 2D80..2DDF; Ethiopic Extended
1.2570 + 0x2DE0, // 2DE0..2DFF; Cyrillic Extended-A
1.2571 + 0x2E00, // 2E00..2E7F; Supplemental Punctuation
1.2572 + 0x2E80, // 2E80..2EFF; CJK Radicals Supplement
1.2573 + 0x2F00, // 2F00..2FDF; Kangxi Radicals
1.2574 + 0x2FE0, // unassigned
1.2575 + 0x2FF0, // 2FF0..2FFF; Ideographic Description Characters
1.2576 + 0x3000, // 3000..303F; CJK Symbols and Punctuation
1.2577 + 0x3040, // 3040..309F; Hiragana
1.2578 + 0x30A0, // 30A0..30FF; Katakana
1.2579 + 0x3100, // 3100..312F; Bopomofo
1.2580 + 0x3130, // 3130..318F; Hangul Compatibility Jamo
1.2581 + 0x3190, // 3190..319F; Kanbun
1.2582 + 0x31A0, // 31A0..31BF; Bopomofo Extended
1.2583 + 0x31C0, // 31C0..31EF; CJK Strokes
1.2584 + 0x31F0, // 31F0..31FF; Katakana Phonetic Extensions
1.2585 + 0x3200, // 3200..32FF; Enclosed CJK Letters and Months
1.2586 + 0x3300, // 3300..33FF; CJK Compatibility
1.2587 + 0x3400, // 3400..4DBF; CJK Unified Ideographs Extension A
1.2588 + 0x4DC0, // 4DC0..4DFF; Yijing Hexagram Symbols
1.2589 + 0x4E00, // 4E00..9FFF; CJK Unified Ideographs
1.2590 + 0xA000, // A000..A48F; Yi Syllables
1.2591 + 0xA490, // A490..A4CF; Yi Radicals
1.2592 + 0xA4D0, // A4D0..A4FF; Lisu
1.2593 + 0xA500, // A500..A63F; Vai
1.2594 + 0xA640, // A640..A69F; Cyrillic Extended-B
1.2595 + 0xA6A0, // A6A0..A6FF; Bamum
1.2596 + 0xA700, // A700..A71F; Modifier Tone Letters
1.2597 + 0xA720, // A720..A7FF; Latin Extended-D
1.2598 + 0xA800, // A800..A82F; Syloti Nagri
1.2599 + 0xA830, // A830..A83F; Common Indic Number Forms
1.2600 + 0xA840, // A840..A87F; Phags-pa
1.2601 + 0xA880, // A880..A8DF; Saurashtra
1.2602 + 0xA8E0, // A8E0..A8FF; Devanagari Extended
1.2603 + 0xA900, // A900..A92F; Kayah Li
1.2604 + 0xA930, // A930..A95F; Rejang
1.2605 + 0xA960, // A960..A97F; Hangul Jamo Extended-A
1.2606 + 0xA980, // A980..A9DF; Javanese
1.2607 + 0xA9E0, // unassigned
1.2608 + 0xAA00, // AA00..AA5F; Cham
1.2609 + 0xAA60, // AA60..AA7F; Myanmar Extended-A
1.2610 + 0xAA80, // AA80..AADF; Tai Viet
1.2611 + 0xAAE0, // unassigned
1.2612 + 0xAB00, // AB00..AB2F; Ethiopic Extended-A
1.2613 + 0xAB30, // unassigned
1.2614 + 0xABC0, // ABC0..ABFF; Meetei Mayek
1.2615 + 0xAC00, // AC00..D7AF; Hangul Syllables
1.2616 + 0xD7B0, // D7B0..D7FF; Hangul Jamo Extended-B
1.2617 + 0xD800, // D800..DB7F; High Surrogates
1.2618 + 0xDB80, // DB80..DBFF; High Private Use Surrogates
1.2619 + 0xDC00, // DC00..DFFF; Low Surrogates
1.2620 + 0xE000, // E000..F8FF; Private Use Area
1.2621 + 0xF900, // F900..FAFF; CJK Compatibility Ideographs
1.2622 + 0xFB00, // FB00..FB4F; Alphabetic Presentation Forms
1.2623 + 0xFB50, // FB50..FDFF; Arabic Presentation Forms-A
1.2624 + 0xFE00, // FE00..FE0F; Variation Selectors
1.2625 + 0xFE10, // FE10..FE1F; Vertical Forms
1.2626 + 0xFE20, // FE20..FE2F; Combining Half Marks
1.2627 + 0xFE30, // FE30..FE4F; CJK Compatibility Forms
1.2628 + 0xFE50, // FE50..FE6F; Small Form Variants
1.2629 + 0xFE70, // FE70..FEFF; Arabic Presentation Forms-B
1.2630 + 0xFF00, // FF00..FFEF; Halfwidth and Fullwidth Forms
1.2631 + 0xFFF0, // FFF0..FFFF; Specials
1.2632 + 0x10000, // 10000..1007F; Linear B Syllabary
1.2633 + 0x10080, // 10080..100FF; Linear B Ideograms
1.2634 + 0x10100, // 10100..1013F; Aegean Numbers
1.2635 + 0x10140, // 10140..1018F; Ancient Greek Numbers
1.2636 + 0x10190, // 10190..101CF; Ancient Symbols
1.2637 + 0x101D0, // 101D0..101FF; Phaistos Disc
1.2638 + 0x10200, // unassigned
1.2639 + 0x10280, // 10280..1029F; Lycian
1.2640 + 0x102A0, // 102A0..102DF; Carian
1.2641 + 0x102E0, // unassigned
1.2642 + 0x10300, // 10300..1032F; Old Italic
1.2643 + 0x10330, // 10330..1034F; Gothic
1.2644 + 0x10350, // unassigned
1.2645 + 0x10380, // 10380..1039F; Ugaritic
1.2646 + 0x103A0, // 103A0..103DF; Old Persian
1.2647 + 0x103E0, // unassigned
1.2648 + 0x10400, // 10400..1044F; Deseret
1.2649 + 0x10450, // 10450..1047F; Shavian
1.2650 + 0x10480, // 10480..104AF; Osmanya
1.2651 + 0x104B0, // unassigned
1.2652 + 0x10800, // 10800..1083F; Cypriot Syllabary
1.2653 + 0x10840, // 10840..1085F; Imperial Aramaic
1.2654 + 0x10860, // unassigned
1.2655 + 0x10900, // 10900..1091F; Phoenician
1.2656 + 0x10920, // 10920..1093F; Lydian
1.2657 + 0x10940, // unassigned
1.2658 + 0x10A00, // 10A00..10A5F; Kharoshthi
1.2659 + 0x10A60, // 10A60..10A7F; Old South Arabian
1.2660 + 0x10A80, // unassigned
1.2661 + 0x10B00, // 10B00..10B3F; Avestan
1.2662 + 0x10B40, // 10B40..10B5F; Inscriptional Parthian
1.2663 + 0x10B60, // 10B60..10B7F; Inscriptional Pahlavi
1.2664 + 0x10B80, // unassigned
1.2665 + 0x10C00, // 10C00..10C4F; Old Turkic
1.2666 + 0x10C50, // unassigned
1.2667 + 0x10E60, // 10E60..10E7F; Rumi Numeral Symbols
1.2668 + 0x10E80, // unassigned
1.2669 + 0x11000, // 11000..1107F; Brahmi
1.2670 + 0x11080, // 11080..110CF; Kaithi
1.2671 + 0x110D0, // unassigned
1.2672 + 0x12000, // 12000..123FF; Cuneiform
1.2673 + 0x12400, // 12400..1247F; Cuneiform Numbers and Punctuation
1.2674 + 0x12480, // unassigned
1.2675 + 0x13000, // 13000..1342F; Egyptian Hieroglyphs
1.2676 + 0x13430, // unassigned
1.2677 + 0x16800, // 16800..16A3F; Bamum Supplement
1.2678 + 0x16A40, // unassigned
1.2679 + 0x1B000, // 1B000..1B0FF; Kana Supplement
1.2680 + 0x1B100, // unassigned
1.2681 + 0x1D000, // 1D000..1D0FF; Byzantine Musical Symbols
1.2682 + 0x1D100, // 1D100..1D1FF; Musical Symbols
1.2683 + 0x1D200, // 1D200..1D24F; Ancient Greek Musical Notation
1.2684 + 0x1D250, // unassigned
1.2685 + 0x1D300, // 1D300..1D35F; Tai Xuan Jing Symbols
1.2686 + 0x1D360, // 1D360..1D37F; Counting Rod Numerals
1.2687 + 0x1D380, // unassigned
1.2688 + 0x1D400, // 1D400..1D7FF; Mathematical Alphanumeric Symbols
1.2689 + 0x1D800, // unassigned
1.2690 + 0x1F000, // 1F000..1F02F; Mahjong Tiles
1.2691 + 0x1F030, // 1F030..1F09F; Domino Tiles
1.2692 + 0x1F0A0, // 1F0A0..1F0FF; Playing Cards
1.2693 + 0x1F100, // 1F100..1F1FF; Enclosed Alphanumeric Supplement
1.2694 + 0x1F200, // 1F200..1F2FF; Enclosed Ideographic Supplement
1.2695 + 0x1F300, // 1F300..1F5FF; Miscellaneous Symbols And Pictographs
1.2696 + 0x1F600, // 1F600..1F64F; Emoticons
1.2697 + 0x1F650, // unassigned
1.2698 + 0x1F680, // 1F680..1F6FF; Transport And Map Symbols
1.2699 + 0x1F700, // 1F700..1F77F; Alchemical Symbols
1.2700 + 0x1F780, // unassigned
1.2701 + 0x20000, // 20000..2A6DF; CJK Unified Ideographs Extension B
1.2702 + 0x2A6E0, // unassigned
1.2703 + 0x2A700, // 2A700..2B73F; CJK Unified Ideographs Extension C
1.2704 + 0x2B740, // 2B740..2B81F; CJK Unified Ideographs Extension D
1.2705 + 0x2B820, // unassigned
1.2706 + 0x2F800, // 2F800..2FA1F; CJK Compatibility Ideographs Supplement
1.2707 + 0x2FA20, // unassigned
1.2708 + 0xE0000, // E0000..E007F; Tags
1.2709 + 0xE0080, // unassigned
1.2710 + 0xE0100, // E0100..E01EF; Variation Selectors Supplement
1.2711 + 0xE01F0, // unassigned
1.2712 + 0xF0000, // F0000..FFFFF; Supplementary Private Use Area-A
1.2713 + 0x100000 // 100000..10FFFF; Supplementary Private Use Area-B
1.2714 + };
1.2715 +
1.2716 + private static final UnicodeBlock[] blocks = {
1.2717 + BASIC_LATIN,
1.2718 + LATIN_1_SUPPLEMENT,
1.2719 + LATIN_EXTENDED_A,
1.2720 + LATIN_EXTENDED_B,
1.2721 + IPA_EXTENSIONS,
1.2722 + SPACING_MODIFIER_LETTERS,
1.2723 + COMBINING_DIACRITICAL_MARKS,
1.2724 + GREEK,
1.2725 + CYRILLIC,
1.2726 + CYRILLIC_SUPPLEMENTARY,
1.2727 + ARMENIAN,
1.2728 + HEBREW,
1.2729 + ARABIC,
1.2730 + SYRIAC,
1.2731 + ARABIC_SUPPLEMENT,
1.2732 + THAANA,
1.2733 + NKO,
1.2734 + SAMARITAN,
1.2735 + MANDAIC,
1.2736 + null,
1.2737 + DEVANAGARI,
1.2738 + BENGALI,
1.2739 + GURMUKHI,
1.2740 + GUJARATI,
1.2741 + ORIYA,
1.2742 + TAMIL,
1.2743 + TELUGU,
1.2744 + KANNADA,
1.2745 + MALAYALAM,
1.2746 + SINHALA,
1.2747 + THAI,
1.2748 + LAO,
1.2749 + TIBETAN,
1.2750 + MYANMAR,
1.2751 + GEORGIAN,
1.2752 + HANGUL_JAMO,
1.2753 + ETHIOPIC,
1.2754 + ETHIOPIC_SUPPLEMENT,
1.2755 + CHEROKEE,
1.2756 + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS,
1.2757 + OGHAM,
1.2758 + RUNIC,
1.2759 + TAGALOG,
1.2760 + HANUNOO,
1.2761 + BUHID,
1.2762 + TAGBANWA,
1.2763 + KHMER,
1.2764 + MONGOLIAN,
1.2765 + UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED,
1.2766 + LIMBU,
1.2767 + TAI_LE,
1.2768 + NEW_TAI_LUE,
1.2769 + KHMER_SYMBOLS,
1.2770 + BUGINESE,
1.2771 + TAI_THAM,
1.2772 + null,
1.2773 + BALINESE,
1.2774 + SUNDANESE,
1.2775 + BATAK,
1.2776 + LEPCHA,
1.2777 + OL_CHIKI,
1.2778 + null,
1.2779 + VEDIC_EXTENSIONS,
1.2780 + PHONETIC_EXTENSIONS,
1.2781 + PHONETIC_EXTENSIONS_SUPPLEMENT,
1.2782 + COMBINING_DIACRITICAL_MARKS_SUPPLEMENT,
1.2783 + LATIN_EXTENDED_ADDITIONAL,
1.2784 + GREEK_EXTENDED,
1.2785 + GENERAL_PUNCTUATION,
1.2786 + SUPERSCRIPTS_AND_SUBSCRIPTS,
1.2787 + CURRENCY_SYMBOLS,
1.2788 + COMBINING_MARKS_FOR_SYMBOLS,
1.2789 + LETTERLIKE_SYMBOLS,
1.2790 + NUMBER_FORMS,
1.2791 + ARROWS,
1.2792 + MATHEMATICAL_OPERATORS,
1.2793 + MISCELLANEOUS_TECHNICAL,
1.2794 + CONTROL_PICTURES,
1.2795 + OPTICAL_CHARACTER_RECOGNITION,
1.2796 + ENCLOSED_ALPHANUMERICS,
1.2797 + BOX_DRAWING,
1.2798 + BLOCK_ELEMENTS,
1.2799 + GEOMETRIC_SHAPES,
1.2800 + MISCELLANEOUS_SYMBOLS,
1.2801 + DINGBATS,
1.2802 + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A,
1.2803 + SUPPLEMENTAL_ARROWS_A,
1.2804 + BRAILLE_PATTERNS,
1.2805 + SUPPLEMENTAL_ARROWS_B,
1.2806 + MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B,
1.2807 + SUPPLEMENTAL_MATHEMATICAL_OPERATORS,
1.2808 + MISCELLANEOUS_SYMBOLS_AND_ARROWS,
1.2809 + GLAGOLITIC,
1.2810 + LATIN_EXTENDED_C,
1.2811 + COPTIC,
1.2812 + GEORGIAN_SUPPLEMENT,
1.2813 + TIFINAGH,
1.2814 + ETHIOPIC_EXTENDED,
1.2815 + CYRILLIC_EXTENDED_A,
1.2816 + SUPPLEMENTAL_PUNCTUATION,
1.2817 + CJK_RADICALS_SUPPLEMENT,
1.2818 + KANGXI_RADICALS,
1.2819 + null,
1.2820 + IDEOGRAPHIC_DESCRIPTION_CHARACTERS,
1.2821 + CJK_SYMBOLS_AND_PUNCTUATION,
1.2822 + HIRAGANA,
1.2823 + KATAKANA,
1.2824 + BOPOMOFO,
1.2825 + HANGUL_COMPATIBILITY_JAMO,
1.2826 + KANBUN,
1.2827 + BOPOMOFO_EXTENDED,
1.2828 + CJK_STROKES,
1.2829 + KATAKANA_PHONETIC_EXTENSIONS,
1.2830 + ENCLOSED_CJK_LETTERS_AND_MONTHS,
1.2831 + CJK_COMPATIBILITY,
1.2832 + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A,
1.2833 + YIJING_HEXAGRAM_SYMBOLS,
1.2834 + CJK_UNIFIED_IDEOGRAPHS,
1.2835 + YI_SYLLABLES,
1.2836 + YI_RADICALS,
1.2837 + LISU,
1.2838 + VAI,
1.2839 + CYRILLIC_EXTENDED_B,
1.2840 + BAMUM,
1.2841 + MODIFIER_TONE_LETTERS,
1.2842 + LATIN_EXTENDED_D,
1.2843 + SYLOTI_NAGRI,
1.2844 + COMMON_INDIC_NUMBER_FORMS,
1.2845 + PHAGS_PA,
1.2846 + SAURASHTRA,
1.2847 + DEVANAGARI_EXTENDED,
1.2848 + KAYAH_LI,
1.2849 + REJANG,
1.2850 + HANGUL_JAMO_EXTENDED_A,
1.2851 + JAVANESE,
1.2852 + null,
1.2853 + CHAM,
1.2854 + MYANMAR_EXTENDED_A,
1.2855 + TAI_VIET,
1.2856 + null,
1.2857 + ETHIOPIC_EXTENDED_A,
1.2858 + null,
1.2859 + MEETEI_MAYEK,
1.2860 + HANGUL_SYLLABLES,
1.2861 + HANGUL_JAMO_EXTENDED_B,
1.2862 + HIGH_SURROGATES,
1.2863 + HIGH_PRIVATE_USE_SURROGATES,
1.2864 + LOW_SURROGATES,
1.2865 + PRIVATE_USE_AREA,
1.2866 + CJK_COMPATIBILITY_IDEOGRAPHS,
1.2867 + ALPHABETIC_PRESENTATION_FORMS,
1.2868 + ARABIC_PRESENTATION_FORMS_A,
1.2869 + VARIATION_SELECTORS,
1.2870 + VERTICAL_FORMS,
1.2871 + COMBINING_HALF_MARKS,
1.2872 + CJK_COMPATIBILITY_FORMS,
1.2873 + SMALL_FORM_VARIANTS,
1.2874 + ARABIC_PRESENTATION_FORMS_B,
1.2875 + HALFWIDTH_AND_FULLWIDTH_FORMS,
1.2876 + SPECIALS,
1.2877 + LINEAR_B_SYLLABARY,
1.2878 + LINEAR_B_IDEOGRAMS,
1.2879 + AEGEAN_NUMBERS,
1.2880 + ANCIENT_GREEK_NUMBERS,
1.2881 + ANCIENT_SYMBOLS,
1.2882 + PHAISTOS_DISC,
1.2883 + null,
1.2884 + LYCIAN,
1.2885 + CARIAN,
1.2886 + null,
1.2887 + OLD_ITALIC,
1.2888 + GOTHIC,
1.2889 + null,
1.2890 + UGARITIC,
1.2891 + OLD_PERSIAN,
1.2892 + null,
1.2893 + DESERET,
1.2894 + SHAVIAN,
1.2895 + OSMANYA,
1.2896 + null,
1.2897 + CYPRIOT_SYLLABARY,
1.2898 + IMPERIAL_ARAMAIC,
1.2899 + null,
1.2900 + PHOENICIAN,
1.2901 + LYDIAN,
1.2902 + null,
1.2903 + KHAROSHTHI,
1.2904 + OLD_SOUTH_ARABIAN,
1.2905 + null,
1.2906 + AVESTAN,
1.2907 + INSCRIPTIONAL_PARTHIAN,
1.2908 + INSCRIPTIONAL_PAHLAVI,
1.2909 + null,
1.2910 + OLD_TURKIC,
1.2911 + null,
1.2912 + RUMI_NUMERAL_SYMBOLS,
1.2913 + null,
1.2914 + BRAHMI,
1.2915 + KAITHI,
1.2916 + null,
1.2917 + CUNEIFORM,
1.2918 + CUNEIFORM_NUMBERS_AND_PUNCTUATION,
1.2919 + null,
1.2920 + EGYPTIAN_HIEROGLYPHS,
1.2921 + null,
1.2922 + BAMUM_SUPPLEMENT,
1.2923 + null,
1.2924 + KANA_SUPPLEMENT,
1.2925 + null,
1.2926 + BYZANTINE_MUSICAL_SYMBOLS,
1.2927 + MUSICAL_SYMBOLS,
1.2928 + ANCIENT_GREEK_MUSICAL_NOTATION,
1.2929 + null,
1.2930 + TAI_XUAN_JING_SYMBOLS,
1.2931 + COUNTING_ROD_NUMERALS,
1.2932 + null,
1.2933 + MATHEMATICAL_ALPHANUMERIC_SYMBOLS,
1.2934 + null,
1.2935 + MAHJONG_TILES,
1.2936 + DOMINO_TILES,
1.2937 + PLAYING_CARDS,
1.2938 + ENCLOSED_ALPHANUMERIC_SUPPLEMENT,
1.2939 + ENCLOSED_IDEOGRAPHIC_SUPPLEMENT,
1.2940 + MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS,
1.2941 + EMOTICONS,
1.2942 + null,
1.2943 + TRANSPORT_AND_MAP_SYMBOLS,
1.2944 + ALCHEMICAL_SYMBOLS,
1.2945 + null,
1.2946 + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B,
1.2947 + null,
1.2948 + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C,
1.2949 + CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D,
1.2950 + null,
1.2951 + CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT,
1.2952 + null,
1.2953 + TAGS,
1.2954 + null,
1.2955 + VARIATION_SELECTORS_SUPPLEMENT,
1.2956 + null,
1.2957 + SUPPLEMENTARY_PRIVATE_USE_AREA_A,
1.2958 + SUPPLEMENTARY_PRIVATE_USE_AREA_B
1.2959 + };
1.2960 +
1.2961 +
1.2962 + /**
1.2963 + * Returns the object representing the Unicode block containing the
1.2964 + * given character, or {@code null} if the character is not a
1.2965 + * member of a defined block.
1.2966 + *
1.2967 + * <p><b>Note:</b> This method cannot handle
1.2968 + * <a href="Character.html#supplementary"> supplementary
1.2969 + * characters</a>. To support all Unicode characters, including
1.2970 + * supplementary characters, use the {@link #of(int)} method.
1.2971 + *
1.2972 + * @param c The character in question
1.2973 + * @return The {@code UnicodeBlock} instance representing the
1.2974 + * Unicode block of which this character is a member, or
1.2975 + * {@code null} if the character is not a member of any
1.2976 + * Unicode block
1.2977 + */
1.2978 + public static UnicodeBlock of(char c) {
1.2979 + return of((int)c);
1.2980 + }
1.2981 +
1.2982 + /**
1.2983 + * Returns the object representing the Unicode block
1.2984 + * containing the given character (Unicode code point), or
1.2985 + * {@code null} if the character is not a member of a
1.2986 + * defined block.
1.2987 + *
1.2988 + * @param codePoint the character (Unicode code point) in question.
1.2989 + * @return The {@code UnicodeBlock} instance representing the
1.2990 + * Unicode block of which this character is a member, or
1.2991 + * {@code null} if the character is not a member of any
1.2992 + * Unicode block
1.2993 + * @exception IllegalArgumentException if the specified
1.2994 + * {@code codePoint} is an invalid Unicode code point.
1.2995 + * @see Character#isValidCodePoint(int)
1.2996 + * @since 1.5
1.2997 + */
1.2998 + public static UnicodeBlock of(int codePoint) {
1.2999 + if (!isValidCodePoint(codePoint)) {
1.3000 + throw new IllegalArgumentException();
1.3001 + }
1.3002 +
1.3003 + int top, bottom, current;
1.3004 + bottom = 0;
1.3005 + top = blockStarts.length;
1.3006 + current = top/2;
1.3007 +
1.3008 + // invariant: top > current >= bottom && codePoint >= unicodeBlockStarts[bottom]
1.3009 + while (top - bottom > 1) {
1.3010 + if (codePoint >= blockStarts[current]) {
1.3011 + bottom = current;
1.3012 + } else {
1.3013 + top = current;
1.3014 + }
1.3015 + current = (top + bottom) / 2;
1.3016 + }
1.3017 + return blocks[current];
1.3018 + }
1.3019 +
1.3020 + /**
1.3021 + * Returns the UnicodeBlock with the given name. Block
1.3022 + * names are determined by The Unicode Standard. The file
1.3023 + * Blocks-<version>.txt defines blocks for a particular
1.3024 + * version of the standard. The {@link Character} class specifies
1.3025 + * the version of the standard that it supports.
1.3026 + * <p>
1.3027 + * This method accepts block names in the following forms:
1.3028 + * <ol>
1.3029 + * <li> Canonical block names as defined by the Unicode Standard.
1.3030 + * For example, the standard defines a "Basic Latin" block. Therefore, this
1.3031 + * method accepts "Basic Latin" as a valid block name. The documentation of
1.3032 + * each UnicodeBlock provides the canonical name.
1.3033 + * <li>Canonical block names with all spaces removed. For example, "BasicLatin"
1.3034 + * is a valid block name for the "Basic Latin" block.
1.3035 + * <li>The text representation of each constant UnicodeBlock identifier.
1.3036 + * For example, this method will return the {@link #BASIC_LATIN} block if
1.3037 + * provided with the "BASIC_LATIN" name. This form replaces all spaces and
1.3038 + * hyphens in the canonical name with underscores.
1.3039 + * </ol>
1.3040 + * Finally, character case is ignored for all of the valid block name forms.
1.3041 + * For example, "BASIC_LATIN" and "basic_latin" are both valid block names.
1.3042 + * The en_US locale's case mapping rules are used to provide case-insensitive
1.3043 + * string comparisons for block name validation.
1.3044 + * <p>
1.3045 + * If the Unicode Standard changes block names, both the previous and
1.3046 + * current names will be accepted.
1.3047 + *
1.3048 + * @param blockName A {@code UnicodeBlock} name.
1.3049 + * @return The {@code UnicodeBlock} instance identified
1.3050 + * by {@code blockName}
1.3051 + * @throws IllegalArgumentException if {@code blockName} is an
1.3052 + * invalid name
1.3053 + * @throws NullPointerException if {@code blockName} is null
1.3054 + * @since 1.5
1.3055 + */
1.3056 + public static final UnicodeBlock forName(String blockName) {
1.3057 + UnicodeBlock block = map.get(blockName.toUpperCase(Locale.US));
1.3058 + if (block == null) {
1.3059 + throw new IllegalArgumentException();
1.3060 + }
1.3061 + return block;
1.3062 + }
1.3063 + }
1.3064 +
1.3065 +
1.3066 + /**
1.3067 + * A family of character subsets representing the character scripts
1.3068 + * defined in the <a href="http://www.unicode.org/reports/tr24/">
1.3069 + * <i>Unicode Standard Annex #24: Script Names</i></a>. Every Unicode
1.3070 + * character is assigned to a single Unicode script, either a specific
1.3071 + * script, such as {@link Character.UnicodeScript#LATIN Latin}, or
1.3072 + * one of the following three special values,
1.3073 + * {@link Character.UnicodeScript#INHERITED Inherited},
1.3074 + * {@link Character.UnicodeScript#COMMON Common} or
1.3075 + * {@link Character.UnicodeScript#UNKNOWN Unknown}.
1.3076 + *
1.3077 + * @since 1.7
1.3078 + */
1.3079 + public static enum UnicodeScript {
1.3080 + /**
1.3081 + * Unicode script "Common".
1.3082 + */
1.3083 + COMMON,
1.3084 +
1.3085 + /**
1.3086 + * Unicode script "Latin".
1.3087 + */
1.3088 + LATIN,
1.3089 +
1.3090 + /**
1.3091 + * Unicode script "Greek".
1.3092 + */
1.3093 + GREEK,
1.3094 +
1.3095 + /**
1.3096 + * Unicode script "Cyrillic".
1.3097 + */
1.3098 + CYRILLIC,
1.3099 +
1.3100 + /**
1.3101 + * Unicode script "Armenian".
1.3102 + */
1.3103 + ARMENIAN,
1.3104 +
1.3105 + /**
1.3106 + * Unicode script "Hebrew".
1.3107 + */
1.3108 + HEBREW,
1.3109 +
1.3110 + /**
1.3111 + * Unicode script "Arabic".
1.3112 + */
1.3113 + ARABIC,
1.3114 +
1.3115 + /**
1.3116 + * Unicode script "Syriac".
1.3117 + */
1.3118 + SYRIAC,
1.3119 +
1.3120 + /**
1.3121 + * Unicode script "Thaana".
1.3122 + */
1.3123 + THAANA,
1.3124 +
1.3125 + /**
1.3126 + * Unicode script "Devanagari".
1.3127 + */
1.3128 + DEVANAGARI,
1.3129 +
1.3130 + /**
1.3131 + * Unicode script "Bengali".
1.3132 + */
1.3133 + BENGALI,
1.3134 +
1.3135 + /**
1.3136 + * Unicode script "Gurmukhi".
1.3137 + */
1.3138 + GURMUKHI,
1.3139 +
1.3140 + /**
1.3141 + * Unicode script "Gujarati".
1.3142 + */
1.3143 + GUJARATI,
1.3144 +
1.3145 + /**
1.3146 + * Unicode script "Oriya".
1.3147 + */
1.3148 + ORIYA,
1.3149 +
1.3150 + /**
1.3151 + * Unicode script "Tamil".
1.3152 + */
1.3153 + TAMIL,
1.3154 +
1.3155 + /**
1.3156 + * Unicode script "Telugu".
1.3157 + */
1.3158 + TELUGU,
1.3159 +
1.3160 + /**
1.3161 + * Unicode script "Kannada".
1.3162 + */
1.3163 + KANNADA,
1.3164 +
1.3165 + /**
1.3166 + * Unicode script "Malayalam".
1.3167 + */
1.3168 + MALAYALAM,
1.3169 +
1.3170 + /**
1.3171 + * Unicode script "Sinhala".
1.3172 + */
1.3173 + SINHALA,
1.3174 +
1.3175 + /**
1.3176 + * Unicode script "Thai".
1.3177 + */
1.3178 + THAI,
1.3179 +
1.3180 + /**
1.3181 + * Unicode script "Lao".
1.3182 + */
1.3183 + LAO,
1.3184 +
1.3185 + /**
1.3186 + * Unicode script "Tibetan".
1.3187 + */
1.3188 + TIBETAN,
1.3189 +
1.3190 + /**
1.3191 + * Unicode script "Myanmar".
1.3192 + */
1.3193 + MYANMAR,
1.3194 +
1.3195 + /**
1.3196 + * Unicode script "Georgian".
1.3197 + */
1.3198 + GEORGIAN,
1.3199 +
1.3200 + /**
1.3201 + * Unicode script "Hangul".
1.3202 + */
1.3203 + HANGUL,
1.3204 +
1.3205 + /**
1.3206 + * Unicode script "Ethiopic".
1.3207 + */
1.3208 + ETHIOPIC,
1.3209 +
1.3210 + /**
1.3211 + * Unicode script "Cherokee".
1.3212 + */
1.3213 + CHEROKEE,
1.3214 +
1.3215 + /**
1.3216 + * Unicode script "Canadian_Aboriginal".
1.3217 + */
1.3218 + CANADIAN_ABORIGINAL,
1.3219 +
1.3220 + /**
1.3221 + * Unicode script "Ogham".
1.3222 + */
1.3223 + OGHAM,
1.3224 +
1.3225 + /**
1.3226 + * Unicode script "Runic".
1.3227 + */
1.3228 + RUNIC,
1.3229 +
1.3230 + /**
1.3231 + * Unicode script "Khmer".
1.3232 + */
1.3233 + KHMER,
1.3234 +
1.3235 + /**
1.3236 + * Unicode script "Mongolian".
1.3237 + */
1.3238 + MONGOLIAN,
1.3239 +
1.3240 + /**
1.3241 + * Unicode script "Hiragana".
1.3242 + */
1.3243 + HIRAGANA,
1.3244 +
1.3245 + /**
1.3246 + * Unicode script "Katakana".
1.3247 + */
1.3248 + KATAKANA,
1.3249 +
1.3250 + /**
1.3251 + * Unicode script "Bopomofo".
1.3252 + */
1.3253 + BOPOMOFO,
1.3254 +
1.3255 + /**
1.3256 + * Unicode script "Han".
1.3257 + */
1.3258 + HAN,
1.3259 +
1.3260 + /**
1.3261 + * Unicode script "Yi".
1.3262 + */
1.3263 + YI,
1.3264 +
1.3265 + /**
1.3266 + * Unicode script "Old_Italic".
1.3267 + */
1.3268 + OLD_ITALIC,
1.3269 +
1.3270 + /**
1.3271 + * Unicode script "Gothic".
1.3272 + */
1.3273 + GOTHIC,
1.3274 +
1.3275 + /**
1.3276 + * Unicode script "Deseret".
1.3277 + */
1.3278 + DESERET,
1.3279 +
1.3280 + /**
1.3281 + * Unicode script "Inherited".
1.3282 + */
1.3283 + INHERITED,
1.3284 +
1.3285 + /**
1.3286 + * Unicode script "Tagalog".
1.3287 + */
1.3288 + TAGALOG,
1.3289 +
1.3290 + /**
1.3291 + * Unicode script "Hanunoo".
1.3292 + */
1.3293 + HANUNOO,
1.3294 +
1.3295 + /**
1.3296 + * Unicode script "Buhid".
1.3297 + */
1.3298 + BUHID,
1.3299 +
1.3300 + /**
1.3301 + * Unicode script "Tagbanwa".
1.3302 + */
1.3303 + TAGBANWA,
1.3304 +
1.3305 + /**
1.3306 + * Unicode script "Limbu".
1.3307 + */
1.3308 + LIMBU,
1.3309 +
1.3310 + /**
1.3311 + * Unicode script "Tai_Le".
1.3312 + */
1.3313 + TAI_LE,
1.3314 +
1.3315 + /**
1.3316 + * Unicode script "Linear_B".
1.3317 + */
1.3318 + LINEAR_B,
1.3319 +
1.3320 + /**
1.3321 + * Unicode script "Ugaritic".
1.3322 + */
1.3323 + UGARITIC,
1.3324 +
1.3325 + /**
1.3326 + * Unicode script "Shavian".
1.3327 + */
1.3328 + SHAVIAN,
1.3329 +
1.3330 + /**
1.3331 + * Unicode script "Osmanya".
1.3332 + */
1.3333 + OSMANYA,
1.3334 +
1.3335 + /**
1.3336 + * Unicode script "Cypriot".
1.3337 + */
1.3338 + CYPRIOT,
1.3339 +
1.3340 + /**
1.3341 + * Unicode script "Braille".
1.3342 + */
1.3343 + BRAILLE,
1.3344 +
1.3345 + /**
1.3346 + * Unicode script "Buginese".
1.3347 + */
1.3348 + BUGINESE,
1.3349 +
1.3350 + /**
1.3351 + * Unicode script "Coptic".
1.3352 + */
1.3353 + COPTIC,
1.3354 +
1.3355 + /**
1.3356 + * Unicode script "New_Tai_Lue".
1.3357 + */
1.3358 + NEW_TAI_LUE,
1.3359 +
1.3360 + /**
1.3361 + * Unicode script "Glagolitic".
1.3362 + */
1.3363 + GLAGOLITIC,
1.3364 +
1.3365 + /**
1.3366 + * Unicode script "Tifinagh".
1.3367 + */
1.3368 + TIFINAGH,
1.3369 +
1.3370 + /**
1.3371 + * Unicode script "Syloti_Nagri".
1.3372 + */
1.3373 + SYLOTI_NAGRI,
1.3374 +
1.3375 + /**
1.3376 + * Unicode script "Old_Persian".
1.3377 + */
1.3378 + OLD_PERSIAN,
1.3379 +
1.3380 + /**
1.3381 + * Unicode script "Kharoshthi".
1.3382 + */
1.3383 + KHAROSHTHI,
1.3384 +
1.3385 + /**
1.3386 + * Unicode script "Balinese".
1.3387 + */
1.3388 + BALINESE,
1.3389 +
1.3390 + /**
1.3391 + * Unicode script "Cuneiform".
1.3392 + */
1.3393 + CUNEIFORM,
1.3394 +
1.3395 + /**
1.3396 + * Unicode script "Phoenician".
1.3397 + */
1.3398 + PHOENICIAN,
1.3399 +
1.3400 + /**
1.3401 + * Unicode script "Phags_Pa".
1.3402 + */
1.3403 + PHAGS_PA,
1.3404 +
1.3405 + /**
1.3406 + * Unicode script "Nko".
1.3407 + */
1.3408 + NKO,
1.3409 +
1.3410 + /**
1.3411 + * Unicode script "Sundanese".
1.3412 + */
1.3413 + SUNDANESE,
1.3414 +
1.3415 + /**
1.3416 + * Unicode script "Batak".
1.3417 + */
1.3418 + BATAK,
1.3419 +
1.3420 + /**
1.3421 + * Unicode script "Lepcha".
1.3422 + */
1.3423 + LEPCHA,
1.3424 +
1.3425 + /**
1.3426 + * Unicode script "Ol_Chiki".
1.3427 + */
1.3428 + OL_CHIKI,
1.3429 +
1.3430 + /**
1.3431 + * Unicode script "Vai".
1.3432 + */
1.3433 + VAI,
1.3434 +
1.3435 + /**
1.3436 + * Unicode script "Saurashtra".
1.3437 + */
1.3438 + SAURASHTRA,
1.3439 +
1.3440 + /**
1.3441 + * Unicode script "Kayah_Li".
1.3442 + */
1.3443 + KAYAH_LI,
1.3444 +
1.3445 + /**
1.3446 + * Unicode script "Rejang".
1.3447 + */
1.3448 + REJANG,
1.3449 +
1.3450 + /**
1.3451 + * Unicode script "Lycian".
1.3452 + */
1.3453 + LYCIAN,
1.3454 +
1.3455 + /**
1.3456 + * Unicode script "Carian".
1.3457 + */
1.3458 + CARIAN,
1.3459 +
1.3460 + /**
1.3461 + * Unicode script "Lydian".
1.3462 + */
1.3463 + LYDIAN,
1.3464 +
1.3465 + /**
1.3466 + * Unicode script "Cham".
1.3467 + */
1.3468 + CHAM,
1.3469 +
1.3470 + /**
1.3471 + * Unicode script "Tai_Tham".
1.3472 + */
1.3473 + TAI_THAM,
1.3474 +
1.3475 + /**
1.3476 + * Unicode script "Tai_Viet".
1.3477 + */
1.3478 + TAI_VIET,
1.3479 +
1.3480 + /**
1.3481 + * Unicode script "Avestan".
1.3482 + */
1.3483 + AVESTAN,
1.3484 +
1.3485 + /**
1.3486 + * Unicode script "Egyptian_Hieroglyphs".
1.3487 + */
1.3488 + EGYPTIAN_HIEROGLYPHS,
1.3489 +
1.3490 + /**
1.3491 + * Unicode script "Samaritan".
1.3492 + */
1.3493 + SAMARITAN,
1.3494 +
1.3495 + /**
1.3496 + * Unicode script "Mandaic".
1.3497 + */
1.3498 + MANDAIC,
1.3499 +
1.3500 + /**
1.3501 + * Unicode script "Lisu".
1.3502 + */
1.3503 + LISU,
1.3504 +
1.3505 + /**
1.3506 + * Unicode script "Bamum".
1.3507 + */
1.3508 + BAMUM,
1.3509 +
1.3510 + /**
1.3511 + * Unicode script "Javanese".
1.3512 + */
1.3513 + JAVANESE,
1.3514 +
1.3515 + /**
1.3516 + * Unicode script "Meetei_Mayek".
1.3517 + */
1.3518 + MEETEI_MAYEK,
1.3519 +
1.3520 + /**
1.3521 + * Unicode script "Imperial_Aramaic".
1.3522 + */
1.3523 + IMPERIAL_ARAMAIC,
1.3524 +
1.3525 + /**
1.3526 + * Unicode script "Old_South_Arabian".
1.3527 + */
1.3528 + OLD_SOUTH_ARABIAN,
1.3529 +
1.3530 + /**
1.3531 + * Unicode script "Inscriptional_Parthian".
1.3532 + */
1.3533 + INSCRIPTIONAL_PARTHIAN,
1.3534 +
1.3535 + /**
1.3536 + * Unicode script "Inscriptional_Pahlavi".
1.3537 + */
1.3538 + INSCRIPTIONAL_PAHLAVI,
1.3539 +
1.3540 + /**
1.3541 + * Unicode script "Old_Turkic".
1.3542 + */
1.3543 + OLD_TURKIC,
1.3544 +
1.3545 + /**
1.3546 + * Unicode script "Brahmi".
1.3547 + */
1.3548 + BRAHMI,
1.3549 +
1.3550 + /**
1.3551 + * Unicode script "Kaithi".
1.3552 + */
1.3553 + KAITHI,
1.3554 +
1.3555 + /**
1.3556 + * Unicode script "Unknown".
1.3557 + */
1.3558 + UNKNOWN;
1.3559 +
1.3560 + private static final int[] scriptStarts = {
1.3561 + 0x0000, // 0000..0040; COMMON
1.3562 + 0x0041, // 0041..005A; LATIN
1.3563 + 0x005B, // 005B..0060; COMMON
1.3564 + 0x0061, // 0061..007A; LATIN
1.3565 + 0x007B, // 007B..00A9; COMMON
1.3566 + 0x00AA, // 00AA..00AA; LATIN
1.3567 + 0x00AB, // 00AB..00B9; COMMON
1.3568 + 0x00BA, // 00BA..00BA; LATIN
1.3569 + 0x00BB, // 00BB..00BF; COMMON
1.3570 + 0x00C0, // 00C0..00D6; LATIN
1.3571 + 0x00D7, // 00D7..00D7; COMMON
1.3572 + 0x00D8, // 00D8..00F6; LATIN
1.3573 + 0x00F7, // 00F7..00F7; COMMON
1.3574 + 0x00F8, // 00F8..02B8; LATIN
1.3575 + 0x02B9, // 02B9..02DF; COMMON
1.3576 + 0x02E0, // 02E0..02E4; LATIN
1.3577 + 0x02E5, // 02E5..02E9; COMMON
1.3578 + 0x02EA, // 02EA..02EB; BOPOMOFO
1.3579 + 0x02EC, // 02EC..02FF; COMMON
1.3580 + 0x0300, // 0300..036F; INHERITED
1.3581 + 0x0370, // 0370..0373; GREEK
1.3582 + 0x0374, // 0374..0374; COMMON
1.3583 + 0x0375, // 0375..037D; GREEK
1.3584 + 0x037E, // 037E..0383; COMMON
1.3585 + 0x0384, // 0384..0384; GREEK
1.3586 + 0x0385, // 0385..0385; COMMON
1.3587 + 0x0386, // 0386..0386; GREEK
1.3588 + 0x0387, // 0387..0387; COMMON
1.3589 + 0x0388, // 0388..03E1; GREEK
1.3590 + 0x03E2, // 03E2..03EF; COPTIC
1.3591 + 0x03F0, // 03F0..03FF; GREEK
1.3592 + 0x0400, // 0400..0484; CYRILLIC
1.3593 + 0x0485, // 0485..0486; INHERITED
1.3594 + 0x0487, // 0487..0530; CYRILLIC
1.3595 + 0x0531, // 0531..0588; ARMENIAN
1.3596 + 0x0589, // 0589..0589; COMMON
1.3597 + 0x058A, // 058A..0590; ARMENIAN
1.3598 + 0x0591, // 0591..05FF; HEBREW
1.3599 + 0x0600, // 0600..060B; ARABIC
1.3600 + 0x060C, // 060C..060C; COMMON
1.3601 + 0x060D, // 060D..061A; ARABIC
1.3602 + 0x061B, // 061B..061D; COMMON
1.3603 + 0x061E, // 061E..061E; ARABIC
1.3604 + 0x061F, // 061F..061F; COMMON
1.3605 + 0x0620, // 0620..063F; ARABIC
1.3606 + 0x0640, // 0640..0640; COMMON
1.3607 + 0x0641, // 0641..064A; ARABIC
1.3608 + 0x064B, // 064B..0655; INHERITED
1.3609 + 0x0656, // 0656..065E; ARABIC
1.3610 + 0x065F, // 065F..065F; INHERITED
1.3611 + 0x0660, // 0660..0669; COMMON
1.3612 + 0x066A, // 066A..066F; ARABIC
1.3613 + 0x0670, // 0670..0670; INHERITED
1.3614 + 0x0671, // 0671..06DC; ARABIC
1.3615 + 0x06DD, // 06DD..06DD; COMMON
1.3616 + 0x06DE, // 06DE..06FF; ARABIC
1.3617 + 0x0700, // 0700..074F; SYRIAC
1.3618 + 0x0750, // 0750..077F; ARABIC
1.3619 + 0x0780, // 0780..07BF; THAANA
1.3620 + 0x07C0, // 07C0..07FF; NKO
1.3621 + 0x0800, // 0800..083F; SAMARITAN
1.3622 + 0x0840, // 0840..08FF; MANDAIC
1.3623 + 0x0900, // 0900..0950; DEVANAGARI
1.3624 + 0x0951, // 0951..0952; INHERITED
1.3625 + 0x0953, // 0953..0963; DEVANAGARI
1.3626 + 0x0964, // 0964..0965; COMMON
1.3627 + 0x0966, // 0966..096F; DEVANAGARI
1.3628 + 0x0970, // 0970..0970; COMMON
1.3629 + 0x0971, // 0971..0980; DEVANAGARI
1.3630 + 0x0981, // 0981..0A00; BENGALI
1.3631 + 0x0A01, // 0A01..0A80; GURMUKHI
1.3632 + 0x0A81, // 0A81..0B00; GUJARATI
1.3633 + 0x0B01, // 0B01..0B81; ORIYA
1.3634 + 0x0B82, // 0B82..0C00; TAMIL
1.3635 + 0x0C01, // 0C01..0C81; TELUGU
1.3636 + 0x0C82, // 0C82..0CF0; KANNADA
1.3637 + 0x0D02, // 0D02..0D81; MALAYALAM
1.3638 + 0x0D82, // 0D82..0E00; SINHALA
1.3639 + 0x0E01, // 0E01..0E3E; THAI
1.3640 + 0x0E3F, // 0E3F..0E3F; COMMON
1.3641 + 0x0E40, // 0E40..0E80; THAI
1.3642 + 0x0E81, // 0E81..0EFF; LAO
1.3643 + 0x0F00, // 0F00..0FD4; TIBETAN
1.3644 + 0x0FD5, // 0FD5..0FD8; COMMON
1.3645 + 0x0FD9, // 0FD9..0FFF; TIBETAN
1.3646 + 0x1000, // 1000..109F; MYANMAR
1.3647 + 0x10A0, // 10A0..10FA; GEORGIAN
1.3648 + 0x10FB, // 10FB..10FB; COMMON
1.3649 + 0x10FC, // 10FC..10FF; GEORGIAN
1.3650 + 0x1100, // 1100..11FF; HANGUL
1.3651 + 0x1200, // 1200..139F; ETHIOPIC
1.3652 + 0x13A0, // 13A0..13FF; CHEROKEE
1.3653 + 0x1400, // 1400..167F; CANADIAN_ABORIGINAL
1.3654 + 0x1680, // 1680..169F; OGHAM
1.3655 + 0x16A0, // 16A0..16EA; RUNIC
1.3656 + 0x16EB, // 16EB..16ED; COMMON
1.3657 + 0x16EE, // 16EE..16FF; RUNIC
1.3658 + 0x1700, // 1700..171F; TAGALOG
1.3659 + 0x1720, // 1720..1734; HANUNOO
1.3660 + 0x1735, // 1735..173F; COMMON
1.3661 + 0x1740, // 1740..175F; BUHID
1.3662 + 0x1760, // 1760..177F; TAGBANWA
1.3663 + 0x1780, // 1780..17FF; KHMER
1.3664 + 0x1800, // 1800..1801; MONGOLIAN
1.3665 + 0x1802, // 1802..1803; COMMON
1.3666 + 0x1804, // 1804..1804; MONGOLIAN
1.3667 + 0x1805, // 1805..1805; COMMON
1.3668 + 0x1806, // 1806..18AF; MONGOLIAN
1.3669 + 0x18B0, // 18B0..18FF; CANADIAN_ABORIGINAL
1.3670 + 0x1900, // 1900..194F; LIMBU
1.3671 + 0x1950, // 1950..197F; TAI_LE
1.3672 + 0x1980, // 1980..19DF; NEW_TAI_LUE
1.3673 + 0x19E0, // 19E0..19FF; KHMER
1.3674 + 0x1A00, // 1A00..1A1F; BUGINESE
1.3675 + 0x1A20, // 1A20..1AFF; TAI_THAM
1.3676 + 0x1B00, // 1B00..1B7F; BALINESE
1.3677 + 0x1B80, // 1B80..1BBF; SUNDANESE
1.3678 + 0x1BC0, // 1BC0..1BFF; BATAK
1.3679 + 0x1C00, // 1C00..1C4F; LEPCHA
1.3680 + 0x1C50, // 1C50..1CCF; OL_CHIKI
1.3681 + 0x1CD0, // 1CD0..1CD2; INHERITED
1.3682 + 0x1CD3, // 1CD3..1CD3; COMMON
1.3683 + 0x1CD4, // 1CD4..1CE0; INHERITED
1.3684 + 0x1CE1, // 1CE1..1CE1; COMMON
1.3685 + 0x1CE2, // 1CE2..1CE8; INHERITED
1.3686 + 0x1CE9, // 1CE9..1CEC; COMMON
1.3687 + 0x1CED, // 1CED..1CED; INHERITED
1.3688 + 0x1CEE, // 1CEE..1CFF; COMMON
1.3689 + 0x1D00, // 1D00..1D25; LATIN
1.3690 + 0x1D26, // 1D26..1D2A; GREEK
1.3691 + 0x1D2B, // 1D2B..1D2B; CYRILLIC
1.3692 + 0x1D2C, // 1D2C..1D5C; LATIN
1.3693 + 0x1D5D, // 1D5D..1D61; GREEK
1.3694 + 0x1D62, // 1D62..1D65; LATIN
1.3695 + 0x1D66, // 1D66..1D6A; GREEK
1.3696 + 0x1D6B, // 1D6B..1D77; LATIN
1.3697 + 0x1D78, // 1D78..1D78; CYRILLIC
1.3698 + 0x1D79, // 1D79..1DBE; LATIN
1.3699 + 0x1DBF, // 1DBF..1DBF; GREEK
1.3700 + 0x1DC0, // 1DC0..1DFF; INHERITED
1.3701 + 0x1E00, // 1E00..1EFF; LATIN
1.3702 + 0x1F00, // 1F00..1FFF; GREEK
1.3703 + 0x2000, // 2000..200B; COMMON
1.3704 + 0x200C, // 200C..200D; INHERITED
1.3705 + 0x200E, // 200E..2070; COMMON
1.3706 + 0x2071, // 2071..2073; LATIN
1.3707 + 0x2074, // 2074..207E; COMMON
1.3708 + 0x207F, // 207F..207F; LATIN
1.3709 + 0x2080, // 2080..208F; COMMON
1.3710 + 0x2090, // 2090..209F; LATIN
1.3711 + 0x20A0, // 20A0..20CF; COMMON
1.3712 + 0x20D0, // 20D0..20FF; INHERITED
1.3713 + 0x2100, // 2100..2125; COMMON
1.3714 + 0x2126, // 2126..2126; GREEK
1.3715 + 0x2127, // 2127..2129; COMMON
1.3716 + 0x212A, // 212A..212B; LATIN
1.3717 + 0x212C, // 212C..2131; COMMON
1.3718 + 0x2132, // 2132..2132; LATIN
1.3719 + 0x2133, // 2133..214D; COMMON
1.3720 + 0x214E, // 214E..214E; LATIN
1.3721 + 0x214F, // 214F..215F; COMMON
1.3722 + 0x2160, // 2160..2188; LATIN
1.3723 + 0x2189, // 2189..27FF; COMMON
1.3724 + 0x2800, // 2800..28FF; BRAILLE
1.3725 + 0x2900, // 2900..2BFF; COMMON
1.3726 + 0x2C00, // 2C00..2C5F; GLAGOLITIC
1.3727 + 0x2C60, // 2C60..2C7F; LATIN
1.3728 + 0x2C80, // 2C80..2CFF; COPTIC
1.3729 + 0x2D00, // 2D00..2D2F; GEORGIAN
1.3730 + 0x2D30, // 2D30..2D7F; TIFINAGH
1.3731 + 0x2D80, // 2D80..2DDF; ETHIOPIC
1.3732 + 0x2DE0, // 2DE0..2DFF; CYRILLIC
1.3733 + 0x2E00, // 2E00..2E7F; COMMON
1.3734 + 0x2E80, // 2E80..2FEF; HAN
1.3735 + 0x2FF0, // 2FF0..3004; COMMON
1.3736 + 0x3005, // 3005..3005; HAN
1.3737 + 0x3006, // 3006..3006; COMMON
1.3738 + 0x3007, // 3007..3007; HAN
1.3739 + 0x3008, // 3008..3020; COMMON
1.3740 + 0x3021, // 3021..3029; HAN
1.3741 + 0x302A, // 302A..302D; INHERITED
1.3742 + 0x302E, // 302E..302F; HANGUL
1.3743 + 0x3030, // 3030..3037; COMMON
1.3744 + 0x3038, // 3038..303B; HAN
1.3745 + 0x303C, // 303C..3040; COMMON
1.3746 + 0x3041, // 3041..3098; HIRAGANA
1.3747 + 0x3099, // 3099..309A; INHERITED
1.3748 + 0x309B, // 309B..309C; COMMON
1.3749 + 0x309D, // 309D..309F; HIRAGANA
1.3750 + 0x30A0, // 30A0..30A0; COMMON
1.3751 + 0x30A1, // 30A1..30FA; KATAKANA
1.3752 + 0x30FB, // 30FB..30FC; COMMON
1.3753 + 0x30FD, // 30FD..3104; KATAKANA
1.3754 + 0x3105, // 3105..3130; BOPOMOFO
1.3755 + 0x3131, // 3131..318F; HANGUL
1.3756 + 0x3190, // 3190..319F; COMMON
1.3757 + 0x31A0, // 31A0..31BF; BOPOMOFO
1.3758 + 0x31C0, // 31C0..31EF; COMMON
1.3759 + 0x31F0, // 31F0..31FF; KATAKANA
1.3760 + 0x3200, // 3200..321F; HANGUL
1.3761 + 0x3220, // 3220..325F; COMMON
1.3762 + 0x3260, // 3260..327E; HANGUL
1.3763 + 0x327F, // 327F..32CF; COMMON
1.3764 + 0x32D0, // 32D0..3357; KATAKANA
1.3765 + 0x3358, // 3358..33FF; COMMON
1.3766 + 0x3400, // 3400..4DBF; HAN
1.3767 + 0x4DC0, // 4DC0..4DFF; COMMON
1.3768 + 0x4E00, // 4E00..9FFF; HAN
1.3769 + 0xA000, // A000..A4CF; YI
1.3770 + 0xA4D0, // A4D0..A4FF; LISU
1.3771 + 0xA500, // A500..A63F; VAI
1.3772 + 0xA640, // A640..A69F; CYRILLIC
1.3773 + 0xA6A0, // A6A0..A6FF; BAMUM
1.3774 + 0xA700, // A700..A721; COMMON
1.3775 + 0xA722, // A722..A787; LATIN
1.3776 + 0xA788, // A788..A78A; COMMON
1.3777 + 0xA78B, // A78B..A7FF; LATIN
1.3778 + 0xA800, // A800..A82F; SYLOTI_NAGRI
1.3779 + 0xA830, // A830..A83F; COMMON
1.3780 + 0xA840, // A840..A87F; PHAGS_PA
1.3781 + 0xA880, // A880..A8DF; SAURASHTRA
1.3782 + 0xA8E0, // A8E0..A8FF; DEVANAGARI
1.3783 + 0xA900, // A900..A92F; KAYAH_LI
1.3784 + 0xA930, // A930..A95F; REJANG
1.3785 + 0xA960, // A960..A97F; HANGUL
1.3786 + 0xA980, // A980..A9FF; JAVANESE
1.3787 + 0xAA00, // AA00..AA5F; CHAM
1.3788 + 0xAA60, // AA60..AA7F; MYANMAR
1.3789 + 0xAA80, // AA80..AB00; TAI_VIET
1.3790 + 0xAB01, // AB01..ABBF; ETHIOPIC
1.3791 + 0xABC0, // ABC0..ABFF; MEETEI_MAYEK
1.3792 + 0xAC00, // AC00..D7FB; HANGUL
1.3793 + 0xD7FC, // D7FC..F8FF; UNKNOWN
1.3794 + 0xF900, // F900..FAFF; HAN
1.3795 + 0xFB00, // FB00..FB12; LATIN
1.3796 + 0xFB13, // FB13..FB1C; ARMENIAN
1.3797 + 0xFB1D, // FB1D..FB4F; HEBREW
1.3798 + 0xFB50, // FB50..FD3D; ARABIC
1.3799 + 0xFD3E, // FD3E..FD4F; COMMON
1.3800 + 0xFD50, // FD50..FDFC; ARABIC
1.3801 + 0xFDFD, // FDFD..FDFF; COMMON
1.3802 + 0xFE00, // FE00..FE0F; INHERITED
1.3803 + 0xFE10, // FE10..FE1F; COMMON
1.3804 + 0xFE20, // FE20..FE2F; INHERITED
1.3805 + 0xFE30, // FE30..FE6F; COMMON
1.3806 + 0xFE70, // FE70..FEFE; ARABIC
1.3807 + 0xFEFF, // FEFF..FF20; COMMON
1.3808 + 0xFF21, // FF21..FF3A; LATIN
1.3809 + 0xFF3B, // FF3B..FF40; COMMON
1.3810 + 0xFF41, // FF41..FF5A; LATIN
1.3811 + 0xFF5B, // FF5B..FF65; COMMON
1.3812 + 0xFF66, // FF66..FF6F; KATAKANA
1.3813 + 0xFF70, // FF70..FF70; COMMON
1.3814 + 0xFF71, // FF71..FF9D; KATAKANA
1.3815 + 0xFF9E, // FF9E..FF9F; COMMON
1.3816 + 0xFFA0, // FFA0..FFDF; HANGUL
1.3817 + 0xFFE0, // FFE0..FFFF; COMMON
1.3818 + 0x10000, // 10000..100FF; LINEAR_B
1.3819 + 0x10100, // 10100..1013F; COMMON
1.3820 + 0x10140, // 10140..1018F; GREEK
1.3821 + 0x10190, // 10190..101FC; COMMON
1.3822 + 0x101FD, // 101FD..1027F; INHERITED
1.3823 + 0x10280, // 10280..1029F; LYCIAN
1.3824 + 0x102A0, // 102A0..102FF; CARIAN
1.3825 + 0x10300, // 10300..1032F; OLD_ITALIC
1.3826 + 0x10330, // 10330..1037F; GOTHIC
1.3827 + 0x10380, // 10380..1039F; UGARITIC
1.3828 + 0x103A0, // 103A0..103FF; OLD_PERSIAN
1.3829 + 0x10400, // 10400..1044F; DESERET
1.3830 + 0x10450, // 10450..1047F; SHAVIAN
1.3831 + 0x10480, // 10480..107FF; OSMANYA
1.3832 + 0x10800, // 10800..1083F; CYPRIOT
1.3833 + 0x10840, // 10840..108FF; IMPERIAL_ARAMAIC
1.3834 + 0x10900, // 10900..1091F; PHOENICIAN
1.3835 + 0x10920, // 10920..109FF; LYDIAN
1.3836 + 0x10A00, // 10A00..10A5F; KHAROSHTHI
1.3837 + 0x10A60, // 10A60..10AFF; OLD_SOUTH_ARABIAN
1.3838 + 0x10B00, // 10B00..10B3F; AVESTAN
1.3839 + 0x10B40, // 10B40..10B5F; INSCRIPTIONAL_PARTHIAN
1.3840 + 0x10B60, // 10B60..10BFF; INSCRIPTIONAL_PAHLAVI
1.3841 + 0x10C00, // 10C00..10E5F; OLD_TURKIC
1.3842 + 0x10E60, // 10E60..10FFF; ARABIC
1.3843 + 0x11000, // 11000..1107F; BRAHMI
1.3844 + 0x11080, // 11080..11FFF; KAITHI
1.3845 + 0x12000, // 12000..12FFF; CUNEIFORM
1.3846 + 0x13000, // 13000..167FF; EGYPTIAN_HIEROGLYPHS
1.3847 + 0x16800, // 16800..16A38; BAMUM
1.3848 + 0x1B000, // 1B000..1B000; KATAKANA
1.3849 + 0x1B001, // 1B001..1CFFF; HIRAGANA
1.3850 + 0x1D000, // 1D000..1D166; COMMON
1.3851 + 0x1D167, // 1D167..1D169; INHERITED
1.3852 + 0x1D16A, // 1D16A..1D17A; COMMON
1.3853 + 0x1D17B, // 1D17B..1D182; INHERITED
1.3854 + 0x1D183, // 1D183..1D184; COMMON
1.3855 + 0x1D185, // 1D185..1D18B; INHERITED
1.3856 + 0x1D18C, // 1D18C..1D1A9; COMMON
1.3857 + 0x1D1AA, // 1D1AA..1D1AD; INHERITED
1.3858 + 0x1D1AE, // 1D1AE..1D1FF; COMMON
1.3859 + 0x1D200, // 1D200..1D2FF; GREEK
1.3860 + 0x1D300, // 1D300..1F1FF; COMMON
1.3861 + 0x1F200, // 1F200..1F200; HIRAGANA
1.3862 + 0x1F201, // 1F210..1FFFF; COMMON
1.3863 + 0x20000, // 20000..E0000; HAN
1.3864 + 0xE0001, // E0001..E00FF; COMMON
1.3865 + 0xE0100, // E0100..E01EF; INHERITED
1.3866 + 0xE01F0 // E01F0..10FFFF; UNKNOWN
1.3867 +
1.3868 + };
1.3869 +
1.3870 + private static final UnicodeScript[] scripts = {
1.3871 + COMMON,
1.3872 + LATIN,
1.3873 + COMMON,
1.3874 + LATIN,
1.3875 + COMMON,
1.3876 + LATIN,
1.3877 + COMMON,
1.3878 + LATIN,
1.3879 + COMMON,
1.3880 + LATIN,
1.3881 + COMMON,
1.3882 + LATIN,
1.3883 + COMMON,
1.3884 + LATIN,
1.3885 + COMMON,
1.3886 + LATIN,
1.3887 + COMMON,
1.3888 + BOPOMOFO,
1.3889 + COMMON,
1.3890 + INHERITED,
1.3891 + GREEK,
1.3892 + COMMON,
1.3893 + GREEK,
1.3894 + COMMON,
1.3895 + GREEK,
1.3896 + COMMON,
1.3897 + GREEK,
1.3898 + COMMON,
1.3899 + GREEK,
1.3900 + COPTIC,
1.3901 + GREEK,
1.3902 + CYRILLIC,
1.3903 + INHERITED,
1.3904 + CYRILLIC,
1.3905 + ARMENIAN,
1.3906 + COMMON,
1.3907 + ARMENIAN,
1.3908 + HEBREW,
1.3909 + ARABIC,
1.3910 + COMMON,
1.3911 + ARABIC,
1.3912 + COMMON,
1.3913 + ARABIC,
1.3914 + COMMON,
1.3915 + ARABIC,
1.3916 + COMMON,
1.3917 + ARABIC,
1.3918 + INHERITED,
1.3919 + ARABIC,
1.3920 + INHERITED,
1.3921 + COMMON,
1.3922 + ARABIC,
1.3923 + INHERITED,
1.3924 + ARABIC,
1.3925 + COMMON,
1.3926 + ARABIC,
1.3927 + SYRIAC,
1.3928 + ARABIC,
1.3929 + THAANA,
1.3930 + NKO,
1.3931 + SAMARITAN,
1.3932 + MANDAIC,
1.3933 + DEVANAGARI,
1.3934 + INHERITED,
1.3935 + DEVANAGARI,
1.3936 + COMMON,
1.3937 + DEVANAGARI,
1.3938 + COMMON,
1.3939 + DEVANAGARI,
1.3940 + BENGALI,
1.3941 + GURMUKHI,
1.3942 + GUJARATI,
1.3943 + ORIYA,
1.3944 + TAMIL,
1.3945 + TELUGU,
1.3946 + KANNADA,
1.3947 + MALAYALAM,
1.3948 + SINHALA,
1.3949 + THAI,
1.3950 + COMMON,
1.3951 + THAI,
1.3952 + LAO,
1.3953 + TIBETAN,
1.3954 + COMMON,
1.3955 + TIBETAN,
1.3956 + MYANMAR,
1.3957 + GEORGIAN,
1.3958 + COMMON,
1.3959 + GEORGIAN,
1.3960 + HANGUL,
1.3961 + ETHIOPIC,
1.3962 + CHEROKEE,
1.3963 + CANADIAN_ABORIGINAL,
1.3964 + OGHAM,
1.3965 + RUNIC,
1.3966 + COMMON,
1.3967 + RUNIC,
1.3968 + TAGALOG,
1.3969 + HANUNOO,
1.3970 + COMMON,
1.3971 + BUHID,
1.3972 + TAGBANWA,
1.3973 + KHMER,
1.3974 + MONGOLIAN,
1.3975 + COMMON,
1.3976 + MONGOLIAN,
1.3977 + COMMON,
1.3978 + MONGOLIAN,
1.3979 + CANADIAN_ABORIGINAL,
1.3980 + LIMBU,
1.3981 + TAI_LE,
1.3982 + NEW_TAI_LUE,
1.3983 + KHMER,
1.3984 + BUGINESE,
1.3985 + TAI_THAM,
1.3986 + BALINESE,
1.3987 + SUNDANESE,
1.3988 + BATAK,
1.3989 + LEPCHA,
1.3990 + OL_CHIKI,
1.3991 + INHERITED,
1.3992 + COMMON,
1.3993 + INHERITED,
1.3994 + COMMON,
1.3995 + INHERITED,
1.3996 + COMMON,
1.3997 + INHERITED,
1.3998 + COMMON,
1.3999 + LATIN,
1.4000 + GREEK,
1.4001 + CYRILLIC,
1.4002 + LATIN,
1.4003 + GREEK,
1.4004 + LATIN,
1.4005 + GREEK,
1.4006 + LATIN,
1.4007 + CYRILLIC,
1.4008 + LATIN,
1.4009 + GREEK,
1.4010 + INHERITED,
1.4011 + LATIN,
1.4012 + GREEK,
1.4013 + COMMON,
1.4014 + INHERITED,
1.4015 + COMMON,
1.4016 + LATIN,
1.4017 + COMMON,
1.4018 + LATIN,
1.4019 + COMMON,
1.4020 + LATIN,
1.4021 + COMMON,
1.4022 + INHERITED,
1.4023 + COMMON,
1.4024 + GREEK,
1.4025 + COMMON,
1.4026 + LATIN,
1.4027 + COMMON,
1.4028 + LATIN,
1.4029 + COMMON,
1.4030 + LATIN,
1.4031 + COMMON,
1.4032 + LATIN,
1.4033 + COMMON,
1.4034 + BRAILLE,
1.4035 + COMMON,
1.4036 + GLAGOLITIC,
1.4037 + LATIN,
1.4038 + COPTIC,
1.4039 + GEORGIAN,
1.4040 + TIFINAGH,
1.4041 + ETHIOPIC,
1.4042 + CYRILLIC,
1.4043 + COMMON,
1.4044 + HAN,
1.4045 + COMMON,
1.4046 + HAN,
1.4047 + COMMON,
1.4048 + HAN,
1.4049 + COMMON,
1.4050 + HAN,
1.4051 + INHERITED,
1.4052 + HANGUL,
1.4053 + COMMON,
1.4054 + HAN,
1.4055 + COMMON,
1.4056 + HIRAGANA,
1.4057 + INHERITED,
1.4058 + COMMON,
1.4059 + HIRAGANA,
1.4060 + COMMON,
1.4061 + KATAKANA,
1.4062 + COMMON,
1.4063 + KATAKANA,
1.4064 + BOPOMOFO,
1.4065 + HANGUL,
1.4066 + COMMON,
1.4067 + BOPOMOFO,
1.4068 + COMMON,
1.4069 + KATAKANA,
1.4070 + HANGUL,
1.4071 + COMMON,
1.4072 + HANGUL,
1.4073 + COMMON,
1.4074 + KATAKANA,
1.4075 + COMMON,
1.4076 + HAN,
1.4077 + COMMON,
1.4078 + HAN,
1.4079 + YI,
1.4080 + LISU,
1.4081 + VAI,
1.4082 + CYRILLIC,
1.4083 + BAMUM,
1.4084 + COMMON,
1.4085 + LATIN,
1.4086 + COMMON,
1.4087 + LATIN,
1.4088 + SYLOTI_NAGRI,
1.4089 + COMMON,
1.4090 + PHAGS_PA,
1.4091 + SAURASHTRA,
1.4092 + DEVANAGARI,
1.4093 + KAYAH_LI,
1.4094 + REJANG,
1.4095 + HANGUL,
1.4096 + JAVANESE,
1.4097 + CHAM,
1.4098 + MYANMAR,
1.4099 + TAI_VIET,
1.4100 + ETHIOPIC,
1.4101 + MEETEI_MAYEK,
1.4102 + HANGUL,
1.4103 + UNKNOWN,
1.4104 + HAN,
1.4105 + LATIN,
1.4106 + ARMENIAN,
1.4107 + HEBREW,
1.4108 + ARABIC,
1.4109 + COMMON,
1.4110 + ARABIC,
1.4111 + COMMON,
1.4112 + INHERITED,
1.4113 + COMMON,
1.4114 + INHERITED,
1.4115 + COMMON,
1.4116 + ARABIC,
1.4117 + COMMON,
1.4118 + LATIN,
1.4119 + COMMON,
1.4120 + LATIN,
1.4121 + COMMON,
1.4122 + KATAKANA,
1.4123 + COMMON,
1.4124 + KATAKANA,
1.4125 + COMMON,
1.4126 + HANGUL,
1.4127 + COMMON,
1.4128 + LINEAR_B,
1.4129 + COMMON,
1.4130 + GREEK,
1.4131 + COMMON,
1.4132 + INHERITED,
1.4133 + LYCIAN,
1.4134 + CARIAN,
1.4135 + OLD_ITALIC,
1.4136 + GOTHIC,
1.4137 + UGARITIC,
1.4138 + OLD_PERSIAN,
1.4139 + DESERET,
1.4140 + SHAVIAN,
1.4141 + OSMANYA,
1.4142 + CYPRIOT,
1.4143 + IMPERIAL_ARAMAIC,
1.4144 + PHOENICIAN,
1.4145 + LYDIAN,
1.4146 + KHAROSHTHI,
1.4147 + OLD_SOUTH_ARABIAN,
1.4148 + AVESTAN,
1.4149 + INSCRIPTIONAL_PARTHIAN,
1.4150 + INSCRIPTIONAL_PAHLAVI,
1.4151 + OLD_TURKIC,
1.4152 + ARABIC,
1.4153 + BRAHMI,
1.4154 + KAITHI,
1.4155 + CUNEIFORM,
1.4156 + EGYPTIAN_HIEROGLYPHS,
1.4157 + BAMUM,
1.4158 + KATAKANA,
1.4159 + HIRAGANA,
1.4160 + COMMON,
1.4161 + INHERITED,
1.4162 + COMMON,
1.4163 + INHERITED,
1.4164 + COMMON,
1.4165 + INHERITED,
1.4166 + COMMON,
1.4167 + INHERITED,
1.4168 + COMMON,
1.4169 + GREEK,
1.4170 + COMMON,
1.4171 + HIRAGANA,
1.4172 + COMMON,
1.4173 + HAN,
1.4174 + COMMON,
1.4175 + INHERITED,
1.4176 + UNKNOWN
1.4177 + };
1.4178 +
1.4179 + private static HashMap<String, Character.UnicodeScript> aliases;
1.4180 + static {
1.4181 + aliases = new HashMap<>(128);
1.4182 + aliases.put("ARAB", ARABIC);
1.4183 + aliases.put("ARMI", IMPERIAL_ARAMAIC);
1.4184 + aliases.put("ARMN", ARMENIAN);
1.4185 + aliases.put("AVST", AVESTAN);
1.4186 + aliases.put("BALI", BALINESE);
1.4187 + aliases.put("BAMU", BAMUM);
1.4188 + aliases.put("BATK", BATAK);
1.4189 + aliases.put("BENG", BENGALI);
1.4190 + aliases.put("BOPO", BOPOMOFO);
1.4191 + aliases.put("BRAI", BRAILLE);
1.4192 + aliases.put("BRAH", BRAHMI);
1.4193 + aliases.put("BUGI", BUGINESE);
1.4194 + aliases.put("BUHD", BUHID);
1.4195 + aliases.put("CANS", CANADIAN_ABORIGINAL);
1.4196 + aliases.put("CARI", CARIAN);
1.4197 + aliases.put("CHAM", CHAM);
1.4198 + aliases.put("CHER", CHEROKEE);
1.4199 + aliases.put("COPT", COPTIC);
1.4200 + aliases.put("CPRT", CYPRIOT);
1.4201 + aliases.put("CYRL", CYRILLIC);
1.4202 + aliases.put("DEVA", DEVANAGARI);
1.4203 + aliases.put("DSRT", DESERET);
1.4204 + aliases.put("EGYP", EGYPTIAN_HIEROGLYPHS);
1.4205 + aliases.put("ETHI", ETHIOPIC);
1.4206 + aliases.put("GEOR", GEORGIAN);
1.4207 + aliases.put("GLAG", GLAGOLITIC);
1.4208 + aliases.put("GOTH", GOTHIC);
1.4209 + aliases.put("GREK", GREEK);
1.4210 + aliases.put("GUJR", GUJARATI);
1.4211 + aliases.put("GURU", GURMUKHI);
1.4212 + aliases.put("HANG", HANGUL);
1.4213 + aliases.put("HANI", HAN);
1.4214 + aliases.put("HANO", HANUNOO);
1.4215 + aliases.put("HEBR", HEBREW);
1.4216 + aliases.put("HIRA", HIRAGANA);
1.4217 + // it appears we don't have the KATAKANA_OR_HIRAGANA
1.4218 + //aliases.put("HRKT", KATAKANA_OR_HIRAGANA);
1.4219 + aliases.put("ITAL", OLD_ITALIC);
1.4220 + aliases.put("JAVA", JAVANESE);
1.4221 + aliases.put("KALI", KAYAH_LI);
1.4222 + aliases.put("KANA", KATAKANA);
1.4223 + aliases.put("KHAR", KHAROSHTHI);
1.4224 + aliases.put("KHMR", KHMER);
1.4225 + aliases.put("KNDA", KANNADA);
1.4226 + aliases.put("KTHI", KAITHI);
1.4227 + aliases.put("LANA", TAI_THAM);
1.4228 + aliases.put("LAOO", LAO);
1.4229 + aliases.put("LATN", LATIN);
1.4230 + aliases.put("LEPC", LEPCHA);
1.4231 + aliases.put("LIMB", LIMBU);
1.4232 + aliases.put("LINB", LINEAR_B);
1.4233 + aliases.put("LISU", LISU);
1.4234 + aliases.put("LYCI", LYCIAN);
1.4235 + aliases.put("LYDI", LYDIAN);
1.4236 + aliases.put("MAND", MANDAIC);
1.4237 + aliases.put("MLYM", MALAYALAM);
1.4238 + aliases.put("MONG", MONGOLIAN);
1.4239 + aliases.put("MTEI", MEETEI_MAYEK);
1.4240 + aliases.put("MYMR", MYANMAR);
1.4241 + aliases.put("NKOO", NKO);
1.4242 + aliases.put("OGAM", OGHAM);
1.4243 + aliases.put("OLCK", OL_CHIKI);
1.4244 + aliases.put("ORKH", OLD_TURKIC);
1.4245 + aliases.put("ORYA", ORIYA);
1.4246 + aliases.put("OSMA", OSMANYA);
1.4247 + aliases.put("PHAG", PHAGS_PA);
1.4248 + aliases.put("PHLI", INSCRIPTIONAL_PAHLAVI);
1.4249 + aliases.put("PHNX", PHOENICIAN);
1.4250 + aliases.put("PRTI", INSCRIPTIONAL_PARTHIAN);
1.4251 + aliases.put("RJNG", REJANG);
1.4252 + aliases.put("RUNR", RUNIC);
1.4253 + aliases.put("SAMR", SAMARITAN);
1.4254 + aliases.put("SARB", OLD_SOUTH_ARABIAN);
1.4255 + aliases.put("SAUR", SAURASHTRA);
1.4256 + aliases.put("SHAW", SHAVIAN);
1.4257 + aliases.put("SINH", SINHALA);
1.4258 + aliases.put("SUND", SUNDANESE);
1.4259 + aliases.put("SYLO", SYLOTI_NAGRI);
1.4260 + aliases.put("SYRC", SYRIAC);
1.4261 + aliases.put("TAGB", TAGBANWA);
1.4262 + aliases.put("TALE", TAI_LE);
1.4263 + aliases.put("TALU", NEW_TAI_LUE);
1.4264 + aliases.put("TAML", TAMIL);
1.4265 + aliases.put("TAVT", TAI_VIET);
1.4266 + aliases.put("TELU", TELUGU);
1.4267 + aliases.put("TFNG", TIFINAGH);
1.4268 + aliases.put("TGLG", TAGALOG);
1.4269 + aliases.put("THAA", THAANA);
1.4270 + aliases.put("THAI", THAI);
1.4271 + aliases.put("TIBT", TIBETAN);
1.4272 + aliases.put("UGAR", UGARITIC);
1.4273 + aliases.put("VAII", VAI);
1.4274 + aliases.put("XPEO", OLD_PERSIAN);
1.4275 + aliases.put("XSUX", CUNEIFORM);
1.4276 + aliases.put("YIII", YI);
1.4277 + aliases.put("ZINH", INHERITED);
1.4278 + aliases.put("ZYYY", COMMON);
1.4279 + aliases.put("ZZZZ", UNKNOWN);
1.4280 + }
1.4281 +
1.4282 + /**
1.4283 + * Returns the enum constant representing the Unicode script of which
1.4284 + * the given character (Unicode code point) is assigned to.
1.4285 + *
1.4286 + * @param codePoint the character (Unicode code point) in question.
1.4287 + * @return The {@code UnicodeScript} constant representing the
1.4288 + * Unicode script of which this character is assigned to.
1.4289 + *
1.4290 + * @exception IllegalArgumentException if the specified
1.4291 + * {@code codePoint} is an invalid Unicode code point.
1.4292 + * @see Character#isValidCodePoint(int)
1.4293 + *
1.4294 + */
1.4295 + public static UnicodeScript of(int codePoint) {
1.4296 + if (!isValidCodePoint(codePoint))
1.4297 + throw new IllegalArgumentException();
1.4298 + int type = getType(codePoint);
1.4299 + // leave SURROGATE and PRIVATE_USE for table lookup
1.4300 + if (type == UNASSIGNED)
1.4301 + return UNKNOWN;
1.4302 + int index = Arrays.binarySearch(scriptStarts, codePoint);
1.4303 + if (index < 0)
1.4304 + index = -index - 2;
1.4305 + return scripts[index];
1.4306 + }
1.4307 +
1.4308 + /**
1.4309 + * Returns the UnicodeScript constant with the given Unicode script
1.4310 + * name or the script name alias. Script names and their aliases are
1.4311 + * determined by The Unicode Standard. The files Scripts<version>.txt
1.4312 + * and PropertyValueAliases<version>.txt define script names
1.4313 + * and the script name aliases for a particular version of the
1.4314 + * standard. The {@link Character} class specifies the version of
1.4315 + * the standard that it supports.
1.4316 + * <p>
1.4317 + * Character case is ignored for all of the valid script names.
1.4318 + * The en_US locale's case mapping rules are used to provide
1.4319 + * case-insensitive string comparisons for script name validation.
1.4320 + * <p>
1.4321 + *
1.4322 + * @param scriptName A {@code UnicodeScript} name.
1.4323 + * @return The {@code UnicodeScript} constant identified
1.4324 + * by {@code scriptName}
1.4325 + * @throws IllegalArgumentException if {@code scriptName} is an
1.4326 + * invalid name
1.4327 + * @throws NullPointerException if {@code scriptName} is null
1.4328 + */
1.4329 + public static final UnicodeScript forName(String scriptName) {
1.4330 + scriptName = scriptName.toUpperCase(Locale.ENGLISH);
1.4331 + //.replace(' ', '_'));
1.4332 + UnicodeScript sc = aliases.get(scriptName);
1.4333 + if (sc != null)
1.4334 + return sc;
1.4335 + return valueOf(scriptName);
1.4336 + }
1.4337 + }
1.4338 +
1.4339 + /**
1.4340 + * The value of the {@code Character}.
1.4341 + *
1.4342 + * @serial
1.4343 + */
1.4344 + private final char value;
1.4345 +
1.4346 + /** use serialVersionUID from JDK 1.0.2 for interoperability */
1.4347 + private static final long serialVersionUID = 3786198910865385080L;
1.4348 +
1.4349 + /**
1.4350 + * Constructs a newly allocated {@code Character} object that
1.4351 + * represents the specified {@code char} value.
1.4352 + *
1.4353 + * @param value the value to be represented by the
1.4354 + * {@code Character} object.
1.4355 + */
1.4356 + public Character(char value) {
1.4357 + this.value = value;
1.4358 + }
1.4359 +
1.4360 + private static class CharacterCache {
1.4361 + private CharacterCache(){}
1.4362 +
1.4363 + static final Character cache[] = new Character[127 + 1];
1.4364 +
1.4365 + static {
1.4366 + for (int i = 0; i < cache.length; i++)
1.4367 + cache[i] = new Character((char)i);
1.4368 + }
1.4369 + }
1.4370 +
1.4371 + /**
1.4372 + * Returns a <tt>Character</tt> instance representing the specified
1.4373 + * <tt>char</tt> value.
1.4374 + * If a new <tt>Character</tt> instance is not required, this method
1.4375 + * should generally be used in preference to the constructor
1.4376 + * {@link #Character(char)}, as this method is likely to yield
1.4377 + * significantly better space and time performance by caching
1.4378 + * frequently requested values.
1.4379 + *
1.4380 + * This method will always cache values in the range {@code
1.4381 + * '\u005Cu0000'} to {@code '\u005Cu007F'}, inclusive, and may
1.4382 + * cache other values outside of this range.
1.4383 + *
1.4384 + * @param c a char value.
1.4385 + * @return a <tt>Character</tt> instance representing <tt>c</tt>.
1.4386 + * @since 1.5
1.4387 + */
1.4388 + public static Character valueOf(char c) {
1.4389 + if (c <= 127) { // must cache
1.4390 + return CharacterCache.cache[(int)c];
1.4391 + }
1.4392 + return new Character(c);
1.4393 + }
1.4394 +
1.4395 + /**
1.4396 + * Returns the value of this {@code Character} object.
1.4397 + * @return the primitive {@code char} value represented by
1.4398 + * this object.
1.4399 + */
1.4400 + public char charValue() {
1.4401 + return value;
1.4402 + }
1.4403 +
1.4404 + /**
1.4405 + * Returns a hash code for this {@code Character}; equal to the result
1.4406 + * of invoking {@code charValue()}.
1.4407 + *
1.4408 + * @return a hash code value for this {@code Character}
1.4409 + */
1.4410 + public int hashCode() {
1.4411 + return (int)value;
1.4412 + }
1.4413 +
1.4414 + /**
1.4415 + * Compares this object against the specified object.
1.4416 + * The result is {@code true} if and only if the argument is not
1.4417 + * {@code null} and is a {@code Character} object that
1.4418 + * represents the same {@code char} value as this object.
1.4419 + *
1.4420 + * @param obj the object to compare with.
1.4421 + * @return {@code true} if the objects are the same;
1.4422 + * {@code false} otherwise.
1.4423 + */
1.4424 + public boolean equals(Object obj) {
1.4425 + if (obj instanceof Character) {
1.4426 + return value == ((Character)obj).charValue();
1.4427 + }
1.4428 + return false;
1.4429 + }
1.4430 +
1.4431 + /**
1.4432 + * Returns a {@code String} object representing this
1.4433 + * {@code Character}'s value. The result is a string of
1.4434 + * length 1 whose sole component is the primitive
1.4435 + * {@code char} value represented by this
1.4436 + * {@code Character} object.
1.4437 + *
1.4438 + * @return a string representation of this object.
1.4439 + */
1.4440 + public String toString() {
1.4441 + char buf[] = {value};
1.4442 + return String.valueOf(buf);
1.4443 + }
1.4444 +
1.4445 + /**
1.4446 + * Returns a {@code String} object representing the
1.4447 + * specified {@code char}. The result is a string of length
1.4448 + * 1 consisting solely of the specified {@code char}.
1.4449 + *
1.4450 + * @param c the {@code char} to be converted
1.4451 + * @return the string representation of the specified {@code char}
1.4452 + * @since 1.4
1.4453 + */
1.4454 + public static String toString(char c) {
1.4455 + return String.valueOf(c);
1.4456 + }
1.4457 +
1.4458 + /**
1.4459 + * Determines whether the specified code point is a valid
1.4460 + * <a href="http://www.unicode.org/glossary/#code_point">
1.4461 + * Unicode code point value</a>.
1.4462 + *
1.4463 + * @param codePoint the Unicode code point to be tested
1.4464 + * @return {@code true} if the specified code point value is between
1.4465 + * {@link #MIN_CODE_POINT} and
1.4466 + * {@link #MAX_CODE_POINT} inclusive;
1.4467 + * {@code false} otherwise.
1.4468 + * @since 1.5
1.4469 + */
1.4470 + public static boolean isValidCodePoint(int codePoint) {
1.4471 + // Optimized form of:
1.4472 + // codePoint >= MIN_CODE_POINT && codePoint <= MAX_CODE_POINT
1.4473 + int plane = codePoint >>> 16;
1.4474 + return plane < ((MAX_CODE_POINT + 1) >>> 16);
1.4475 + }
1.4476 +
1.4477 + /**
1.4478 + * Determines whether the specified character (Unicode code point)
1.4479 + * is in the <a href="#BMP">Basic Multilingual Plane (BMP)</a>.
1.4480 + * Such code points can be represented using a single {@code char}.
1.4481 + *
1.4482 + * @param codePoint the character (Unicode code point) to be tested
1.4483 + * @return {@code true} if the specified code point is between
1.4484 + * {@link #MIN_VALUE} and {@link #MAX_VALUE} inclusive;
1.4485 + * {@code false} otherwise.
1.4486 + * @since 1.7
1.4487 + */
1.4488 + public static boolean isBmpCodePoint(int codePoint) {
1.4489 + return codePoint >>> 16 == 0;
1.4490 + // Optimized form of:
1.4491 + // codePoint >= MIN_VALUE && codePoint <= MAX_VALUE
1.4492 + // We consistently use logical shift (>>>) to facilitate
1.4493 + // additional runtime optimizations.
1.4494 + }
1.4495 +
1.4496 + /**
1.4497 + * Determines whether the specified character (Unicode code point)
1.4498 + * is in the <a href="#supplementary">supplementary character</a> range.
1.4499 + *
1.4500 + * @param codePoint the character (Unicode code point) to be tested
1.4501 + * @return {@code true} if the specified code point is between
1.4502 + * {@link #MIN_SUPPLEMENTARY_CODE_POINT} and
1.4503 + * {@link #MAX_CODE_POINT} inclusive;
1.4504 + * {@code false} otherwise.
1.4505 + * @since 1.5
1.4506 + */
1.4507 + public static boolean isSupplementaryCodePoint(int codePoint) {
1.4508 + return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT
1.4509 + && codePoint < MAX_CODE_POINT + 1;
1.4510 + }
1.4511 +
1.4512 + /**
1.4513 + * Determines if the given {@code char} value is a
1.4514 + * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit">
1.4515 + * Unicode high-surrogate code unit</a>
1.4516 + * (also known as <i>leading-surrogate code unit</i>).
1.4517 + *
1.4518 + * <p>Such values do not represent characters by themselves,
1.4519 + * but are used in the representation of
1.4520 + * <a href="#supplementary">supplementary characters</a>
1.4521 + * in the UTF-16 encoding.
1.4522 + *
1.4523 + * @param ch the {@code char} value to be tested.
1.4524 + * @return {@code true} if the {@code char} value is between
1.4525 + * {@link #MIN_HIGH_SURROGATE} and
1.4526 + * {@link #MAX_HIGH_SURROGATE} inclusive;
1.4527 + * {@code false} otherwise.
1.4528 + * @see Character#isLowSurrogate(char)
1.4529 + * @see Character.UnicodeBlock#of(int)
1.4530 + * @since 1.5
1.4531 + */
1.4532 + public static boolean isHighSurrogate(char ch) {
1.4533 + // Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE
1.4534 + return ch >= MIN_HIGH_SURROGATE && ch < (MAX_HIGH_SURROGATE + 1);
1.4535 + }
1.4536 +
1.4537 + /**
1.4538 + * Determines if the given {@code char} value is a
1.4539 + * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit">
1.4540 + * Unicode low-surrogate code unit</a>
1.4541 + * (also known as <i>trailing-surrogate code unit</i>).
1.4542 + *
1.4543 + * <p>Such values do not represent characters by themselves,
1.4544 + * but are used in the representation of
1.4545 + * <a href="#supplementary">supplementary characters</a>
1.4546 + * in the UTF-16 encoding.
1.4547 + *
1.4548 + * @param ch the {@code char} value to be tested.
1.4549 + * @return {@code true} if the {@code char} value is between
1.4550 + * {@link #MIN_LOW_SURROGATE} and
1.4551 + * {@link #MAX_LOW_SURROGATE} inclusive;
1.4552 + * {@code false} otherwise.
1.4553 + * @see Character#isHighSurrogate(char)
1.4554 + * @since 1.5
1.4555 + */
1.4556 + public static boolean isLowSurrogate(char ch) {
1.4557 + return ch >= MIN_LOW_SURROGATE && ch < (MAX_LOW_SURROGATE + 1);
1.4558 + }
1.4559 +
1.4560 + /**
1.4561 + * Determines if the given {@code char} value is a Unicode
1.4562 + * <i>surrogate code unit</i>.
1.4563 + *
1.4564 + * <p>Such values do not represent characters by themselves,
1.4565 + * but are used in the representation of
1.4566 + * <a href="#supplementary">supplementary characters</a>
1.4567 + * in the UTF-16 encoding.
1.4568 + *
1.4569 + * <p>A char value is a surrogate code unit if and only if it is either
1.4570 + * a {@linkplain #isLowSurrogate(char) low-surrogate code unit} or
1.4571 + * a {@linkplain #isHighSurrogate(char) high-surrogate code unit}.
1.4572 + *
1.4573 + * @param ch the {@code char} value to be tested.
1.4574 + * @return {@code true} if the {@code char} value is between
1.4575 + * {@link #MIN_SURROGATE} and
1.4576 + * {@link #MAX_SURROGATE} inclusive;
1.4577 + * {@code false} otherwise.
1.4578 + * @since 1.7
1.4579 + */
1.4580 + public static boolean isSurrogate(char ch) {
1.4581 + return ch >= MIN_SURROGATE && ch < (MAX_SURROGATE + 1);
1.4582 + }
1.4583 +
1.4584 + /**
1.4585 + * Determines whether the specified pair of {@code char}
1.4586 + * values is a valid
1.4587 + * <a href="http://www.unicode.org/glossary/#surrogate_pair">
1.4588 + * Unicode surrogate pair</a>.
1.4589 +
1.4590 + * <p>This method is equivalent to the expression:
1.4591 + * <blockquote><pre>
1.4592 + * isHighSurrogate(high) && isLowSurrogate(low)
1.4593 + * </pre></blockquote>
1.4594 + *
1.4595 + * @param high the high-surrogate code value to be tested
1.4596 + * @param low the low-surrogate code value to be tested
1.4597 + * @return {@code true} if the specified high and
1.4598 + * low-surrogate code values represent a valid surrogate pair;
1.4599 + * {@code false} otherwise.
1.4600 + * @since 1.5
1.4601 + */
1.4602 + public static boolean isSurrogatePair(char high, char low) {
1.4603 + return isHighSurrogate(high) && isLowSurrogate(low);
1.4604 + }
1.4605 +
1.4606 + /**
1.4607 + * Determines the number of {@code char} values needed to
1.4608 + * represent the specified character (Unicode code point). If the
1.4609 + * specified character is equal to or greater than 0x10000, then
1.4610 + * the method returns 2. Otherwise, the method returns 1.
1.4611 + *
1.4612 + * <p>This method doesn't validate the specified character to be a
1.4613 + * valid Unicode code point. The caller must validate the
1.4614 + * character value using {@link #isValidCodePoint(int) isValidCodePoint}
1.4615 + * if necessary.
1.4616 + *
1.4617 + * @param codePoint the character (Unicode code point) to be tested.
1.4618 + * @return 2 if the character is a valid supplementary character; 1 otherwise.
1.4619 + * @see Character#isSupplementaryCodePoint(int)
1.4620 + * @since 1.5
1.4621 + */
1.4622 + public static int charCount(int codePoint) {
1.4623 + return codePoint >= MIN_SUPPLEMENTARY_CODE_POINT ? 2 : 1;
1.4624 + }
1.4625 +
1.4626 + /**
1.4627 + * Converts the specified surrogate pair to its supplementary code
1.4628 + * point value. This method does not validate the specified
1.4629 + * surrogate pair. The caller must validate it using {@link
1.4630 + * #isSurrogatePair(char, char) isSurrogatePair} if necessary.
1.4631 + *
1.4632 + * @param high the high-surrogate code unit
1.4633 + * @param low the low-surrogate code unit
1.4634 + * @return the supplementary code point composed from the
1.4635 + * specified surrogate pair.
1.4636 + * @since 1.5
1.4637 + */
1.4638 + public static int toCodePoint(char high, char low) {
1.4639 + // Optimized form of:
1.4640 + // return ((high - MIN_HIGH_SURROGATE) << 10)
1.4641 + // + (low - MIN_LOW_SURROGATE)
1.4642 + // + MIN_SUPPLEMENTARY_CODE_POINT;
1.4643 + return ((high << 10) + low) + (MIN_SUPPLEMENTARY_CODE_POINT
1.4644 + - (MIN_HIGH_SURROGATE << 10)
1.4645 + - MIN_LOW_SURROGATE);
1.4646 + }
1.4647 +
1.4648 + /**
1.4649 + * Returns the code point at the given index of the
1.4650 + * {@code CharSequence}. If the {@code char} value at
1.4651 + * the given index in the {@code CharSequence} is in the
1.4652 + * high-surrogate range, the following index is less than the
1.4653 + * length of the {@code CharSequence}, and the
1.4654 + * {@code char} value at the following index is in the
1.4655 + * low-surrogate range, then the supplementary code point
1.4656 + * corresponding to this surrogate pair is returned. Otherwise,
1.4657 + * the {@code char} value at the given index is returned.
1.4658 + *
1.4659 + * @param seq a sequence of {@code char} values (Unicode code
1.4660 + * units)
1.4661 + * @param index the index to the {@code char} values (Unicode
1.4662 + * code units) in {@code seq} to be converted
1.4663 + * @return the Unicode code point at the given index
1.4664 + * @exception NullPointerException if {@code seq} is null.
1.4665 + * @exception IndexOutOfBoundsException if the value
1.4666 + * {@code index} is negative or not less than
1.4667 + * {@link CharSequence#length() seq.length()}.
1.4668 + * @since 1.5
1.4669 + */
1.4670 + public static int codePointAt(CharSequence seq, int index) {
1.4671 + char c1 = seq.charAt(index++);
1.4672 + if (isHighSurrogate(c1)) {
1.4673 + if (index < seq.length()) {
1.4674 + char c2 = seq.charAt(index);
1.4675 + if (isLowSurrogate(c2)) {
1.4676 + return toCodePoint(c1, c2);
1.4677 + }
1.4678 + }
1.4679 + }
1.4680 + return c1;
1.4681 + }
1.4682 +
1.4683 + /**
1.4684 + * Returns the code point at the given index of the
1.4685 + * {@code char} array. If the {@code char} value at
1.4686 + * the given index in the {@code char} array is in the
1.4687 + * high-surrogate range, the following index is less than the
1.4688 + * length of the {@code char} array, and the
1.4689 + * {@code char} value at the following index is in the
1.4690 + * low-surrogate range, then the supplementary code point
1.4691 + * corresponding to this surrogate pair is returned. Otherwise,
1.4692 + * the {@code char} value at the given index is returned.
1.4693 + *
1.4694 + * @param a the {@code char} array
1.4695 + * @param index the index to the {@code char} values (Unicode
1.4696 + * code units) in the {@code char} array to be converted
1.4697 + * @return the Unicode code point at the given index
1.4698 + * @exception NullPointerException if {@code a} is null.
1.4699 + * @exception IndexOutOfBoundsException if the value
1.4700 + * {@code index} is negative or not less than
1.4701 + * the length of the {@code char} array.
1.4702 + * @since 1.5
1.4703 + */
1.4704 + public static int codePointAt(char[] a, int index) {
1.4705 + return codePointAtImpl(a, index, a.length);
1.4706 + }
1.4707 +
1.4708 + /**
1.4709 + * Returns the code point at the given index of the
1.4710 + * {@code char} array, where only array elements with
1.4711 + * {@code index} less than {@code limit} can be used. If
1.4712 + * the {@code char} value at the given index in the
1.4713 + * {@code char} array is in the high-surrogate range, the
1.4714 + * following index is less than the {@code limit}, and the
1.4715 + * {@code char} value at the following index is in the
1.4716 + * low-surrogate range, then the supplementary code point
1.4717 + * corresponding to this surrogate pair is returned. Otherwise,
1.4718 + * the {@code char} value at the given index is returned.
1.4719 + *
1.4720 + * @param a the {@code char} array
1.4721 + * @param index the index to the {@code char} values (Unicode
1.4722 + * code units) in the {@code char} array to be converted
1.4723 + * @param limit the index after the last array element that
1.4724 + * can be used in the {@code char} array
1.4725 + * @return the Unicode code point at the given index
1.4726 + * @exception NullPointerException if {@code a} is null.
1.4727 + * @exception IndexOutOfBoundsException if the {@code index}
1.4728 + * argument is negative or not less than the {@code limit}
1.4729 + * argument, or if the {@code limit} argument is negative or
1.4730 + * greater than the length of the {@code char} array.
1.4731 + * @since 1.5
1.4732 + */
1.4733 + public static int codePointAt(char[] a, int index, int limit) {
1.4734 + if (index >= limit || limit < 0 || limit > a.length) {
1.4735 + throw new IndexOutOfBoundsException();
1.4736 + }
1.4737 + return codePointAtImpl(a, index, limit);
1.4738 + }
1.4739 +
1.4740 + // throws ArrayIndexOutofBoundsException if index out of bounds
1.4741 + static int codePointAtImpl(char[] a, int index, int limit) {
1.4742 + char c1 = a[index++];
1.4743 + if (isHighSurrogate(c1)) {
1.4744 + if (index < limit) {
1.4745 + char c2 = a[index];
1.4746 + if (isLowSurrogate(c2)) {
1.4747 + return toCodePoint(c1, c2);
1.4748 + }
1.4749 + }
1.4750 + }
1.4751 + return c1;
1.4752 + }
1.4753 +
1.4754 + /**
1.4755 + * Returns the code point preceding the given index of the
1.4756 + * {@code CharSequence}. If the {@code char} value at
1.4757 + * {@code (index - 1)} in the {@code CharSequence} is in
1.4758 + * the low-surrogate range, {@code (index - 2)} is not
1.4759 + * negative, and the {@code char} value at {@code (index - 2)}
1.4760 + * in the {@code CharSequence} is in the
1.4761 + * high-surrogate range, then the supplementary code point
1.4762 + * corresponding to this surrogate pair is returned. Otherwise,
1.4763 + * the {@code char} value at {@code (index - 1)} is
1.4764 + * returned.
1.4765 + *
1.4766 + * @param seq the {@code CharSequence} instance
1.4767 + * @param index the index following the code point that should be returned
1.4768 + * @return the Unicode code point value before the given index.
1.4769 + * @exception NullPointerException if {@code seq} is null.
1.4770 + * @exception IndexOutOfBoundsException if the {@code index}
1.4771 + * argument is less than 1 or greater than {@link
1.4772 + * CharSequence#length() seq.length()}.
1.4773 + * @since 1.5
1.4774 + */
1.4775 + public static int codePointBefore(CharSequence seq, int index) {
1.4776 + char c2 = seq.charAt(--index);
1.4777 + if (isLowSurrogate(c2)) {
1.4778 + if (index > 0) {
1.4779 + char c1 = seq.charAt(--index);
1.4780 + if (isHighSurrogate(c1)) {
1.4781 + return toCodePoint(c1, c2);
1.4782 + }
1.4783 + }
1.4784 + }
1.4785 + return c2;
1.4786 + }
1.4787 +
1.4788 + /**
1.4789 + * Returns the code point preceding the given index of the
1.4790 + * {@code char} array. If the {@code char} value at
1.4791 + * {@code (index - 1)} in the {@code char} array is in
1.4792 + * the low-surrogate range, {@code (index - 2)} is not
1.4793 + * negative, and the {@code char} value at {@code (index - 2)}
1.4794 + * in the {@code char} array is in the
1.4795 + * high-surrogate range, then the supplementary code point
1.4796 + * corresponding to this surrogate pair is returned. Otherwise,
1.4797 + * the {@code char} value at {@code (index - 1)} is
1.4798 + * returned.
1.4799 + *
1.4800 + * @param a the {@code char} array
1.4801 + * @param index the index following the code point that should be returned
1.4802 + * @return the Unicode code point value before the given index.
1.4803 + * @exception NullPointerException if {@code a} is null.
1.4804 + * @exception IndexOutOfBoundsException if the {@code index}
1.4805 + * argument is less than 1 or greater than the length of the
1.4806 + * {@code char} array
1.4807 + * @since 1.5
1.4808 + */
1.4809 + public static int codePointBefore(char[] a, int index) {
1.4810 + return codePointBeforeImpl(a, index, 0);
1.4811 + }
1.4812 +
1.4813 + /**
1.4814 + * Returns the code point preceding the given index of the
1.4815 + * {@code char} array, where only array elements with
1.4816 + * {@code index} greater than or equal to {@code start}
1.4817 + * can be used. If the {@code char} value at {@code (index - 1)}
1.4818 + * in the {@code char} array is in the
1.4819 + * low-surrogate range, {@code (index - 2)} is not less than
1.4820 + * {@code start}, and the {@code char} value at
1.4821 + * {@code (index - 2)} in the {@code char} array is in
1.4822 + * the high-surrogate range, then the supplementary code point
1.4823 + * corresponding to this surrogate pair is returned. Otherwise,
1.4824 + * the {@code char} value at {@code (index - 1)} is
1.4825 + * returned.
1.4826 + *
1.4827 + * @param a the {@code char} array
1.4828 + * @param index the index following the code point that should be returned
1.4829 + * @param start the index of the first array element in the
1.4830 + * {@code char} array
1.4831 + * @return the Unicode code point value before the given index.
1.4832 + * @exception NullPointerException if {@code a} is null.
1.4833 + * @exception IndexOutOfBoundsException if the {@code index}
1.4834 + * argument is not greater than the {@code start} argument or
1.4835 + * is greater than the length of the {@code char} array, or
1.4836 + * if the {@code start} argument is negative or not less than
1.4837 + * the length of the {@code char} array.
1.4838 + * @since 1.5
1.4839 + */
1.4840 + public static int codePointBefore(char[] a, int index, int start) {
1.4841 + if (index <= start || start < 0 || start >= a.length) {
1.4842 + throw new IndexOutOfBoundsException();
1.4843 + }
1.4844 + return codePointBeforeImpl(a, index, start);
1.4845 + }
1.4846 +
1.4847 + // throws ArrayIndexOutofBoundsException if index-1 out of bounds
1.4848 + static int codePointBeforeImpl(char[] a, int index, int start) {
1.4849 + char c2 = a[--index];
1.4850 + if (isLowSurrogate(c2)) {
1.4851 + if (index > start) {
1.4852 + char c1 = a[--index];
1.4853 + if (isHighSurrogate(c1)) {
1.4854 + return toCodePoint(c1, c2);
1.4855 + }
1.4856 + }
1.4857 + }
1.4858 + return c2;
1.4859 + }
1.4860 +
1.4861 + /**
1.4862 + * Returns the leading surrogate (a
1.4863 + * <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit">
1.4864 + * high surrogate code unit</a>) of the
1.4865 + * <a href="http://www.unicode.org/glossary/#surrogate_pair">
1.4866 + * surrogate pair</a>
1.4867 + * representing the specified supplementary character (Unicode
1.4868 + * code point) in the UTF-16 encoding. If the specified character
1.4869 + * is not a
1.4870 + * <a href="Character.html#supplementary">supplementary character</a>,
1.4871 + * an unspecified {@code char} is returned.
1.4872 + *
1.4873 + * <p>If
1.4874 + * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)}
1.4875 + * is {@code true}, then
1.4876 + * {@link #isHighSurrogate isHighSurrogate}{@code (highSurrogate(x))} and
1.4877 + * {@link #toCodePoint toCodePoint}{@code (highSurrogate(x), }{@link #lowSurrogate lowSurrogate}{@code (x)) == x}
1.4878 + * are also always {@code true}.
1.4879 + *
1.4880 + * @param codePoint a supplementary character (Unicode code point)
1.4881 + * @return the leading surrogate code unit used to represent the
1.4882 + * character in the UTF-16 encoding
1.4883 + * @since 1.7
1.4884 + */
1.4885 + public static char highSurrogate(int codePoint) {
1.4886 + return (char) ((codePoint >>> 10)
1.4887 + + (MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT >>> 10)));
1.4888 + }
1.4889 +
1.4890 + /**
1.4891 + * Returns the trailing surrogate (a
1.4892 + * <a href="http://www.unicode.org/glossary/#low_surrogate_code_unit">
1.4893 + * low surrogate code unit</a>) of the
1.4894 + * <a href="http://www.unicode.org/glossary/#surrogate_pair">
1.4895 + * surrogate pair</a>
1.4896 + * representing the specified supplementary character (Unicode
1.4897 + * code point) in the UTF-16 encoding. If the specified character
1.4898 + * is not a
1.4899 + * <a href="Character.html#supplementary">supplementary character</a>,
1.4900 + * an unspecified {@code char} is returned.
1.4901 + *
1.4902 + * <p>If
1.4903 + * {@link #isSupplementaryCodePoint isSupplementaryCodePoint(x)}
1.4904 + * is {@code true}, then
1.4905 + * {@link #isLowSurrogate isLowSurrogate}{@code (lowSurrogate(x))} and
1.4906 + * {@link #toCodePoint toCodePoint}{@code (}{@link #highSurrogate highSurrogate}{@code (x), lowSurrogate(x)) == x}
1.4907 + * are also always {@code true}.
1.4908 + *
1.4909 + * @param codePoint a supplementary character (Unicode code point)
1.4910 + * @return the trailing surrogate code unit used to represent the
1.4911 + * character in the UTF-16 encoding
1.4912 + * @since 1.7
1.4913 + */
1.4914 + public static char lowSurrogate(int codePoint) {
1.4915 + return (char) ((codePoint & 0x3ff) + MIN_LOW_SURROGATE);
1.4916 + }
1.4917 +
1.4918 + /**
1.4919 + * Converts the specified character (Unicode code point) to its
1.4920 + * UTF-16 representation. If the specified code point is a BMP
1.4921 + * (Basic Multilingual Plane or Plane 0) value, the same value is
1.4922 + * stored in {@code dst[dstIndex]}, and 1 is returned. If the
1.4923 + * specified code point is a supplementary character, its
1.4924 + * surrogate values are stored in {@code dst[dstIndex]}
1.4925 + * (high-surrogate) and {@code dst[dstIndex+1]}
1.4926 + * (low-surrogate), and 2 is returned.
1.4927 + *
1.4928 + * @param codePoint the character (Unicode code point) to be converted.
1.4929 + * @param dst an array of {@code char} in which the
1.4930 + * {@code codePoint}'s UTF-16 value is stored.
1.4931 + * @param dstIndex the start index into the {@code dst}
1.4932 + * array where the converted value is stored.
1.4933 + * @return 1 if the code point is a BMP code point, 2 if the
1.4934 + * code point is a supplementary code point.
1.4935 + * @exception IllegalArgumentException if the specified
1.4936 + * {@code codePoint} is not a valid Unicode code point.
1.4937 + * @exception NullPointerException if the specified {@code dst} is null.
1.4938 + * @exception IndexOutOfBoundsException if {@code dstIndex}
1.4939 + * is negative or not less than {@code dst.length}, or if
1.4940 + * {@code dst} at {@code dstIndex} doesn't have enough
1.4941 + * array element(s) to store the resulting {@code char}
1.4942 + * value(s). (If {@code dstIndex} is equal to
1.4943 + * {@code dst.length-1} and the specified
1.4944 + * {@code codePoint} is a supplementary character, the
1.4945 + * high-surrogate value is not stored in
1.4946 + * {@code dst[dstIndex]}.)
1.4947 + * @since 1.5
1.4948 + */
1.4949 + public static int toChars(int codePoint, char[] dst, int dstIndex) {
1.4950 + if (isBmpCodePoint(codePoint)) {
1.4951 + dst[dstIndex] = (char) codePoint;
1.4952 + return 1;
1.4953 + } else if (isValidCodePoint(codePoint)) {
1.4954 + toSurrogates(codePoint, dst, dstIndex);
1.4955 + return 2;
1.4956 + } else {
1.4957 + throw new IllegalArgumentException();
1.4958 + }
1.4959 + }
1.4960 +
1.4961 + /**
1.4962 + * Converts the specified character (Unicode code point) to its
1.4963 + * UTF-16 representation stored in a {@code char} array. If
1.4964 + * the specified code point is a BMP (Basic Multilingual Plane or
1.4965 + * Plane 0) value, the resulting {@code char} array has
1.4966 + * the same value as {@code codePoint}. If the specified code
1.4967 + * point is a supplementary code point, the resulting
1.4968 + * {@code char} array has the corresponding surrogate pair.
1.4969 + *
1.4970 + * @param codePoint a Unicode code point
1.4971 + * @return a {@code char} array having
1.4972 + * {@code codePoint}'s UTF-16 representation.
1.4973 + * @exception IllegalArgumentException if the specified
1.4974 + * {@code codePoint} is not a valid Unicode code point.
1.4975 + * @since 1.5
1.4976 + */
1.4977 + public static char[] toChars(int codePoint) {
1.4978 + if (isBmpCodePoint(codePoint)) {
1.4979 + return new char[] { (char) codePoint };
1.4980 + } else if (isValidCodePoint(codePoint)) {
1.4981 + char[] result = new char[2];
1.4982 + toSurrogates(codePoint, result, 0);
1.4983 + return result;
1.4984 + } else {
1.4985 + throw new IllegalArgumentException();
1.4986 + }
1.4987 + }
1.4988 +
1.4989 + static void toSurrogates(int codePoint, char[] dst, int index) {
1.4990 + // We write elements "backwards" to guarantee all-or-nothing
1.4991 + dst[index+1] = lowSurrogate(codePoint);
1.4992 + dst[index] = highSurrogate(codePoint);
1.4993 + }
1.4994 +
1.4995 + /**
1.4996 + * Returns the number of Unicode code points in the text range of
1.4997 + * the specified char sequence. The text range begins at the
1.4998 + * specified {@code beginIndex} and extends to the
1.4999 + * {@code char} at index {@code endIndex - 1}. Thus the
1.5000 + * length (in {@code char}s) of the text range is
1.5001 + * {@code endIndex-beginIndex}. Unpaired surrogates within
1.5002 + * the text range count as one code point each.
1.5003 + *
1.5004 + * @param seq the char sequence
1.5005 + * @param beginIndex the index to the first {@code char} of
1.5006 + * the text range.
1.5007 + * @param endIndex the index after the last {@code char} of
1.5008 + * the text range.
1.5009 + * @return the number of Unicode code points in the specified text
1.5010 + * range
1.5011 + * @exception NullPointerException if {@code seq} is null.
1.5012 + * @exception IndexOutOfBoundsException if the
1.5013 + * {@code beginIndex} is negative, or {@code endIndex}
1.5014 + * is larger than the length of the given sequence, or
1.5015 + * {@code beginIndex} is larger than {@code endIndex}.
1.5016 + * @since 1.5
1.5017 + */
1.5018 + public static int codePointCount(CharSequence seq, int beginIndex, int endIndex) {
1.5019 + int length = seq.length();
1.5020 + if (beginIndex < 0 || endIndex > length || beginIndex > endIndex) {
1.5021 + throw new IndexOutOfBoundsException();
1.5022 + }
1.5023 + int n = endIndex - beginIndex;
1.5024 + for (int i = beginIndex; i < endIndex; ) {
1.5025 + if (isHighSurrogate(seq.charAt(i++)) && i < endIndex &&
1.5026 + isLowSurrogate(seq.charAt(i))) {
1.5027 + n--;
1.5028 + i++;
1.5029 + }
1.5030 + }
1.5031 + return n;
1.5032 + }
1.5033 +
1.5034 + /**
1.5035 + * Returns the number of Unicode code points in a subarray of the
1.5036 + * {@code char} array argument. The {@code offset}
1.5037 + * argument is the index of the first {@code char} of the
1.5038 + * subarray and the {@code count} argument specifies the
1.5039 + * length of the subarray in {@code char}s. Unpaired
1.5040 + * surrogates within the subarray count as one code point each.
1.5041 + *
1.5042 + * @param a the {@code char} array
1.5043 + * @param offset the index of the first {@code char} in the
1.5044 + * given {@code char} array
1.5045 + * @param count the length of the subarray in {@code char}s
1.5046 + * @return the number of Unicode code points in the specified subarray
1.5047 + * @exception NullPointerException if {@code a} is null.
1.5048 + * @exception IndexOutOfBoundsException if {@code offset} or
1.5049 + * {@code count} is negative, or if {@code offset +
1.5050 + * count} is larger than the length of the given array.
1.5051 + * @since 1.5
1.5052 + */
1.5053 + public static int codePointCount(char[] a, int offset, int count) {
1.5054 + if (count > a.length - offset || offset < 0 || count < 0) {
1.5055 + throw new IndexOutOfBoundsException();
1.5056 + }
1.5057 + return codePointCountImpl(a, offset, count);
1.5058 + }
1.5059 +
1.5060 + static int codePointCountImpl(char[] a, int offset, int count) {
1.5061 + int endIndex = offset + count;
1.5062 + int n = count;
1.5063 + for (int i = offset; i < endIndex; ) {
1.5064 + if (isHighSurrogate(a[i++]) && i < endIndex &&
1.5065 + isLowSurrogate(a[i])) {
1.5066 + n--;
1.5067 + i++;
1.5068 + }
1.5069 + }
1.5070 + return n;
1.5071 + }
1.5072 +
1.5073 + /**
1.5074 + * Returns the index within the given char sequence that is offset
1.5075 + * from the given {@code index} by {@code codePointOffset}
1.5076 + * code points. Unpaired surrogates within the text range given by
1.5077 + * {@code index} and {@code codePointOffset} count as
1.5078 + * one code point each.
1.5079 + *
1.5080 + * @param seq the char sequence
1.5081 + * @param index the index to be offset
1.5082 + * @param codePointOffset the offset in code points
1.5083 + * @return the index within the char sequence
1.5084 + * @exception NullPointerException if {@code seq} is null.
1.5085 + * @exception IndexOutOfBoundsException if {@code index}
1.5086 + * is negative or larger then the length of the char sequence,
1.5087 + * or if {@code codePointOffset} is positive and the
1.5088 + * subsequence starting with {@code index} has fewer than
1.5089 + * {@code codePointOffset} code points, or if
1.5090 + * {@code codePointOffset} is negative and the subsequence
1.5091 + * before {@code index} has fewer than the absolute value
1.5092 + * of {@code codePointOffset} code points.
1.5093 + * @since 1.5
1.5094 + */
1.5095 + public static int offsetByCodePoints(CharSequence seq, int index,
1.5096 + int codePointOffset) {
1.5097 + int length = seq.length();
1.5098 + if (index < 0 || index > length) {
1.5099 + throw new IndexOutOfBoundsException();
1.5100 + }
1.5101 +
1.5102 + int x = index;
1.5103 + if (codePointOffset >= 0) {
1.5104 + int i;
1.5105 + for (i = 0; x < length && i < codePointOffset; i++) {
1.5106 + if (isHighSurrogate(seq.charAt(x++)) && x < length &&
1.5107 + isLowSurrogate(seq.charAt(x))) {
1.5108 + x++;
1.5109 + }
1.5110 + }
1.5111 + if (i < codePointOffset) {
1.5112 + throw new IndexOutOfBoundsException();
1.5113 + }
1.5114 + } else {
1.5115 + int i;
1.5116 + for (i = codePointOffset; x > 0 && i < 0; i++) {
1.5117 + if (isLowSurrogate(seq.charAt(--x)) && x > 0 &&
1.5118 + isHighSurrogate(seq.charAt(x-1))) {
1.5119 + x--;
1.5120 + }
1.5121 + }
1.5122 + if (i < 0) {
1.5123 + throw new IndexOutOfBoundsException();
1.5124 + }
1.5125 + }
1.5126 + return x;
1.5127 + }
1.5128 +
1.5129 + /**
1.5130 + * Returns the index within the given {@code char} subarray
1.5131 + * that is offset from the given {@code index} by
1.5132 + * {@code codePointOffset} code points. The
1.5133 + * {@code start} and {@code count} arguments specify a
1.5134 + * subarray of the {@code char} array. Unpaired surrogates
1.5135 + * within the text range given by {@code index} and
1.5136 + * {@code codePointOffset} count as one code point each.
1.5137 + *
1.5138 + * @param a the {@code char} array
1.5139 + * @param start the index of the first {@code char} of the
1.5140 + * subarray
1.5141 + * @param count the length of the subarray in {@code char}s
1.5142 + * @param index the index to be offset
1.5143 + * @param codePointOffset the offset in code points
1.5144 + * @return the index within the subarray
1.5145 + * @exception NullPointerException if {@code a} is null.
1.5146 + * @exception IndexOutOfBoundsException
1.5147 + * if {@code start} or {@code count} is negative,
1.5148 + * or if {@code start + count} is larger than the length of
1.5149 + * the given array,
1.5150 + * or if {@code index} is less than {@code start} or
1.5151 + * larger then {@code start + count},
1.5152 + * or if {@code codePointOffset} is positive and the text range
1.5153 + * starting with {@code index} and ending with {@code start + count - 1}
1.5154 + * has fewer than {@code codePointOffset} code
1.5155 + * points,
1.5156 + * or if {@code codePointOffset} is negative and the text range
1.5157 + * starting with {@code start} and ending with {@code index - 1}
1.5158 + * has fewer than the absolute value of
1.5159 + * {@code codePointOffset} code points.
1.5160 + * @since 1.5
1.5161 + */
1.5162 + public static int offsetByCodePoints(char[] a, int start, int count,
1.5163 + int index, int codePointOffset) {
1.5164 + if (count > a.length-start || start < 0 || count < 0
1.5165 + || index < start || index > start+count) {
1.5166 + throw new IndexOutOfBoundsException();
1.5167 + }
1.5168 + return offsetByCodePointsImpl(a, start, count, index, codePointOffset);
1.5169 + }
1.5170 +
1.5171 + static int offsetByCodePointsImpl(char[]a, int start, int count,
1.5172 + int index, int codePointOffset) {
1.5173 + int x = index;
1.5174 + if (codePointOffset >= 0) {
1.5175 + int limit = start + count;
1.5176 + int i;
1.5177 + for (i = 0; x < limit && i < codePointOffset; i++) {
1.5178 + if (isHighSurrogate(a[x++]) && x < limit &&
1.5179 + isLowSurrogate(a[x])) {
1.5180 + x++;
1.5181 + }
1.5182 + }
1.5183 + if (i < codePointOffset) {
1.5184 + throw new IndexOutOfBoundsException();
1.5185 + }
1.5186 + } else {
1.5187 + int i;
1.5188 + for (i = codePointOffset; x > start && i < 0; i++) {
1.5189 + if (isLowSurrogate(a[--x]) && x > start &&
1.5190 + isHighSurrogate(a[x-1])) {
1.5191 + x--;
1.5192 + }
1.5193 + }
1.5194 + if (i < 0) {
1.5195 + throw new IndexOutOfBoundsException();
1.5196 + }
1.5197 + }
1.5198 + return x;
1.5199 + }
1.5200 +
1.5201 + /**
1.5202 + * Determines if the specified character is a lowercase character.
1.5203 + * <p>
1.5204 + * A character is lowercase if its general category type, provided
1.5205 + * by {@code Character.getType(ch)}, is
1.5206 + * {@code LOWERCASE_LETTER}, or it has contributory property
1.5207 + * Other_Lowercase as defined by the Unicode Standard.
1.5208 + * <p>
1.5209 + * The following are examples of lowercase characters:
1.5210 + * <p><blockquote><pre>
1.5211 + * a b c d e f g h i j k l m n o p q r s t u v w x y z
1.5212 + * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
1.5213 + * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
1.5214 + * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
1.5215 + * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
1.5216 + * </pre></blockquote>
1.5217 + * <p> Many other Unicode characters are lowercase too.
1.5218 + *
1.5219 + * <p><b>Note:</b> This method cannot handle <a
1.5220 + * href="#supplementary"> supplementary characters</a>. To support
1.5221 + * all Unicode characters, including supplementary characters, use
1.5222 + * the {@link #isLowerCase(int)} method.
1.5223 + *
1.5224 + * @param ch the character to be tested.
1.5225 + * @return {@code true} if the character is lowercase;
1.5226 + * {@code false} otherwise.
1.5227 + * @see Character#isLowerCase(char)
1.5228 + * @see Character#isTitleCase(char)
1.5229 + * @see Character#toLowerCase(char)
1.5230 + * @see Character#getType(char)
1.5231 + */
1.5232 + public static boolean isLowerCase(char ch) {
1.5233 + return isLowerCase((int)ch);
1.5234 + }
1.5235 +
1.5236 + /**
1.5237 + * Determines if the specified character (Unicode code point) is a
1.5238 + * lowercase character.
1.5239 + * <p>
1.5240 + * A character is lowercase if its general category type, provided
1.5241 + * by {@link Character#getType getType(codePoint)}, is
1.5242 + * {@code LOWERCASE_LETTER}, or it has contributory property
1.5243 + * Other_Lowercase as defined by the Unicode Standard.
1.5244 + * <p>
1.5245 + * The following are examples of lowercase characters:
1.5246 + * <p><blockquote><pre>
1.5247 + * a b c d e f g h i j k l m n o p q r s t u v w x y z
1.5248 + * '\u00DF' '\u00E0' '\u00E1' '\u00E2' '\u00E3' '\u00E4' '\u00E5' '\u00E6'
1.5249 + * '\u00E7' '\u00E8' '\u00E9' '\u00EA' '\u00EB' '\u00EC' '\u00ED' '\u00EE'
1.5250 + * '\u00EF' '\u00F0' '\u00F1' '\u00F2' '\u00F3' '\u00F4' '\u00F5' '\u00F6'
1.5251 + * '\u00F8' '\u00F9' '\u00FA' '\u00FB' '\u00FC' '\u00FD' '\u00FE' '\u00FF'
1.5252 + * </pre></blockquote>
1.5253 + * <p> Many other Unicode characters are lowercase too.
1.5254 + *
1.5255 + * @param codePoint the character (Unicode code point) to be tested.
1.5256 + * @return {@code true} if the character is lowercase;
1.5257 + * {@code false} otherwise.
1.5258 + * @see Character#isLowerCase(int)
1.5259 + * @see Character#isTitleCase(int)
1.5260 + * @see Character#toLowerCase(int)
1.5261 + * @see Character#getType(int)
1.5262 + * @since 1.5
1.5263 + */
1.5264 + public static boolean isLowerCase(int codePoint) {
1.5265 + return getType(codePoint) == Character.LOWERCASE_LETTER ||
1.5266 + CharacterData.of(codePoint).isOtherLowercase(codePoint);
1.5267 + }
1.5268 +
1.5269 + /**
1.5270 + * Determines if the specified character is an uppercase character.
1.5271 + * <p>
1.5272 + * A character is uppercase if its general category type, provided by
1.5273 + * {@code Character.getType(ch)}, is {@code UPPERCASE_LETTER}.
1.5274 + * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
1.5275 + * <p>
1.5276 + * The following are examples of uppercase characters:
1.5277 + * <p><blockquote><pre>
1.5278 + * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1.5279 + * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
1.5280 + * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
1.5281 + * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
1.5282 + * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
1.5283 + * </pre></blockquote>
1.5284 + * <p> Many other Unicode characters are uppercase too.<p>
1.5285 + *
1.5286 + * <p><b>Note:</b> This method cannot handle <a
1.5287 + * href="#supplementary"> supplementary characters</a>. To support
1.5288 + * all Unicode characters, including supplementary characters, use
1.5289 + * the {@link #isUpperCase(int)} method.
1.5290 + *
1.5291 + * @param ch the character to be tested.
1.5292 + * @return {@code true} if the character is uppercase;
1.5293 + * {@code false} otherwise.
1.5294 + * @see Character#isLowerCase(char)
1.5295 + * @see Character#isTitleCase(char)
1.5296 + * @see Character#toUpperCase(char)
1.5297 + * @see Character#getType(char)
1.5298 + * @since 1.0
1.5299 + */
1.5300 + public static boolean isUpperCase(char ch) {
1.5301 + return isUpperCase((int)ch);
1.5302 + }
1.5303 +
1.5304 + /**
1.5305 + * Determines if the specified character (Unicode code point) is an uppercase character.
1.5306 + * <p>
1.5307 + * A character is uppercase if its general category type, provided by
1.5308 + * {@link Character#getType(int) getType(codePoint)}, is {@code UPPERCASE_LETTER},
1.5309 + * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
1.5310 + * <p>
1.5311 + * The following are examples of uppercase characters:
1.5312 + * <p><blockquote><pre>
1.5313 + * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1.5314 + * '\u00C0' '\u00C1' '\u00C2' '\u00C3' '\u00C4' '\u00C5' '\u00C6' '\u00C7'
1.5315 + * '\u00C8' '\u00C9' '\u00CA' '\u00CB' '\u00CC' '\u00CD' '\u00CE' '\u00CF'
1.5316 + * '\u00D0' '\u00D1' '\u00D2' '\u00D3' '\u00D4' '\u00D5' '\u00D6' '\u00D8'
1.5317 + * '\u00D9' '\u00DA' '\u00DB' '\u00DC' '\u00DD' '\u00DE'
1.5318 + * </pre></blockquote>
1.5319 + * <p> Many other Unicode characters are uppercase too.<p>
1.5320 + *
1.5321 + * @param codePoint the character (Unicode code point) to be tested.
1.5322 + * @return {@code true} if the character is uppercase;
1.5323 + * {@code false} otherwise.
1.5324 + * @see Character#isLowerCase(int)
1.5325 + * @see Character#isTitleCase(int)
1.5326 + * @see Character#toUpperCase(int)
1.5327 + * @see Character#getType(int)
1.5328 + * @since 1.5
1.5329 + */
1.5330 + public static boolean isUpperCase(int codePoint) {
1.5331 + return getType(codePoint) == Character.UPPERCASE_LETTER ||
1.5332 + CharacterData.of(codePoint).isOtherUppercase(codePoint);
1.5333 + }
1.5334 +
1.5335 + /**
1.5336 + * Determines if the specified character is a titlecase character.
1.5337 + * <p>
1.5338 + * A character is a titlecase character if its general
1.5339 + * category type, provided by {@code Character.getType(ch)},
1.5340 + * is {@code TITLECASE_LETTER}.
1.5341 + * <p>
1.5342 + * Some characters look like pairs of Latin letters. For example, there
1.5343 + * is an uppercase letter that looks like "LJ" and has a corresponding
1.5344 + * lowercase letter that looks like "lj". A third form, which looks like "Lj",
1.5345 + * is the appropriate form to use when rendering a word in lowercase
1.5346 + * with initial capitals, as for a book title.
1.5347 + * <p>
1.5348 + * These are some of the Unicode characters for which this method returns
1.5349 + * {@code true}:
1.5350 + * <ul>
1.5351 + * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}
1.5352 + * <li>{@code LATIN CAPITAL LETTER L WITH SMALL LETTER J}
1.5353 + * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J}
1.5354 + * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z}
1.5355 + * </ul>
1.5356 + * <p> Many other Unicode characters are titlecase too.<p>
1.5357 + *
1.5358 + * <p><b>Note:</b> This method cannot handle <a
1.5359 + * href="#supplementary"> supplementary characters</a>. To support
1.5360 + * all Unicode characters, including supplementary characters, use
1.5361 + * the {@link #isTitleCase(int)} method.
1.5362 + *
1.5363 + * @param ch the character to be tested.
1.5364 + * @return {@code true} if the character is titlecase;
1.5365 + * {@code false} otherwise.
1.5366 + * @see Character#isLowerCase(char)
1.5367 + * @see Character#isUpperCase(char)
1.5368 + * @see Character#toTitleCase(char)
1.5369 + * @see Character#getType(char)
1.5370 + * @since 1.0.2
1.5371 + */
1.5372 + public static boolean isTitleCase(char ch) {
1.5373 + return isTitleCase((int)ch);
1.5374 + }
1.5375 +
1.5376 + /**
1.5377 + * Determines if the specified character (Unicode code point) is a titlecase character.
1.5378 + * <p>
1.5379 + * A character is a titlecase character if its general
1.5380 + * category type, provided by {@link Character#getType(int) getType(codePoint)},
1.5381 + * is {@code TITLECASE_LETTER}.
1.5382 + * <p>
1.5383 + * Some characters look like pairs of Latin letters. For example, there
1.5384 + * is an uppercase letter that looks like "LJ" and has a corresponding
1.5385 + * lowercase letter that looks like "lj". A third form, which looks like "Lj",
1.5386 + * is the appropriate form to use when rendering a word in lowercase
1.5387 + * with initial capitals, as for a book title.
1.5388 + * <p>
1.5389 + * These are some of the Unicode characters for which this method returns
1.5390 + * {@code true}:
1.5391 + * <ul>
1.5392 + * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON}
1.5393 + * <li>{@code LATIN CAPITAL LETTER L WITH SMALL LETTER J}
1.5394 + * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J}
1.5395 + * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z}
1.5396 + * </ul>
1.5397 + * <p> Many other Unicode characters are titlecase too.<p>
1.5398 + *
1.5399 + * @param codePoint the character (Unicode code point) to be tested.
1.5400 + * @return {@code true} if the character is titlecase;
1.5401 + * {@code false} otherwise.
1.5402 + * @see Character#isLowerCase(int)
1.5403 + * @see Character#isUpperCase(int)
1.5404 + * @see Character#toTitleCase(int)
1.5405 + * @see Character#getType(int)
1.5406 + * @since 1.5
1.5407 + */
1.5408 + public static boolean isTitleCase(int codePoint) {
1.5409 + return getType(codePoint) == Character.TITLECASE_LETTER;
1.5410 + }
1.5411 +
1.5412 + /**
1.5413 + * Determines if the specified character is a digit.
1.5414 + * <p>
1.5415 + * A character is a digit if its general category type, provided
1.5416 + * by {@code Character.getType(ch)}, is
1.5417 + * {@code DECIMAL_DIGIT_NUMBER}.
1.5418 + * <p>
1.5419 + * Some Unicode character ranges that contain digits:
1.5420 + * <ul>
1.5421 + * <li>{@code '\u005Cu0030'} through {@code '\u005Cu0039'},
1.5422 + * ISO-LATIN-1 digits ({@code '0'} through {@code '9'})
1.5423 + * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
1.5424 + * Arabic-Indic digits
1.5425 + * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
1.5426 + * Extended Arabic-Indic digits
1.5427 + * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
1.5428 + * Devanagari digits
1.5429 + * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
1.5430 + * Fullwidth digits
1.5431 + * </ul>
1.5432 + *
1.5433 + * Many other character ranges contain digits as well.
1.5434 + *
1.5435 + * <p><b>Note:</b> This method cannot handle <a
1.5436 + * href="#supplementary"> supplementary characters</a>. To support
1.5437 + * all Unicode characters, including supplementary characters, use
1.5438 + * the {@link #isDigit(int)} method.
1.5439 + *
1.5440 + * @param ch the character to be tested.
1.5441 + * @return {@code true} if the character is a digit;
1.5442 + * {@code false} otherwise.
1.5443 + * @see Character#digit(char, int)
1.5444 + * @see Character#forDigit(int, int)
1.5445 + * @see Character#getType(char)
1.5446 + */
1.5447 + public static boolean isDigit(char ch) {
1.5448 + return isDigit((int)ch);
1.5449 + }
1.5450 +
1.5451 + /**
1.5452 + * Determines if the specified character (Unicode code point) is a digit.
1.5453 + * <p>
1.5454 + * A character is a digit if its general category type, provided
1.5455 + * by {@link Character#getType(int) getType(codePoint)}, is
1.5456 + * {@code DECIMAL_DIGIT_NUMBER}.
1.5457 + * <p>
1.5458 + * Some Unicode character ranges that contain digits:
1.5459 + * <ul>
1.5460 + * <li>{@code '\u005Cu0030'} through {@code '\u005Cu0039'},
1.5461 + * ISO-LATIN-1 digits ({@code '0'} through {@code '9'})
1.5462 + * <li>{@code '\u005Cu0660'} through {@code '\u005Cu0669'},
1.5463 + * Arabic-Indic digits
1.5464 + * <li>{@code '\u005Cu06F0'} through {@code '\u005Cu06F9'},
1.5465 + * Extended Arabic-Indic digits
1.5466 + * <li>{@code '\u005Cu0966'} through {@code '\u005Cu096F'},
1.5467 + * Devanagari digits
1.5468 + * <li>{@code '\u005CuFF10'} through {@code '\u005CuFF19'},
1.5469 + * Fullwidth digits
1.5470 + * </ul>
1.5471 + *
1.5472 + * Many other character ranges contain digits as well.
1.5473 + *
1.5474 + * @param codePoint the character (Unicode code point) to be tested.
1.5475 + * @return {@code true} if the character is a digit;
1.5476 + * {@code false} otherwise.
1.5477 + * @see Character#forDigit(int, int)
1.5478 + * @see Character#getType(int)
1.5479 + * @since 1.5
1.5480 + */
1.5481 + public static boolean isDigit(int codePoint) {
1.5482 + return getType(codePoint) == Character.DECIMAL_DIGIT_NUMBER;
1.5483 + }
1.5484 +
1.5485 + /**
1.5486 + * Determines if a character is defined in Unicode.
1.5487 + * <p>
1.5488 + * A character is defined if at least one of the following is true:
1.5489 + * <ul>
1.5490 + * <li>It has an entry in the UnicodeData file.
1.5491 + * <li>It has a value in a range defined by the UnicodeData file.
1.5492 + * </ul>
1.5493 + *
1.5494 + * <p><b>Note:</b> This method cannot handle <a
1.5495 + * href="#supplementary"> supplementary characters</a>. To support
1.5496 + * all Unicode characters, including supplementary characters, use
1.5497 + * the {@link #isDefined(int)} method.
1.5498 + *
1.5499 + * @param ch the character to be tested
1.5500 + * @return {@code true} if the character has a defined meaning
1.5501 + * in Unicode; {@code false} otherwise.
1.5502 + * @see Character#isDigit(char)
1.5503 + * @see Character#isLetter(char)
1.5504 + * @see Character#isLetterOrDigit(char)
1.5505 + * @see Character#isLowerCase(char)
1.5506 + * @see Character#isTitleCase(char)
1.5507 + * @see Character#isUpperCase(char)
1.5508 + * @since 1.0.2
1.5509 + */
1.5510 + public static boolean isDefined(char ch) {
1.5511 + return isDefined((int)ch);
1.5512 + }
1.5513 +
1.5514 + /**
1.5515 + * Determines if a character (Unicode code point) is defined in Unicode.
1.5516 + * <p>
1.5517 + * A character is defined if at least one of the following is true:
1.5518 + * <ul>
1.5519 + * <li>It has an entry in the UnicodeData file.
1.5520 + * <li>It has a value in a range defined by the UnicodeData file.
1.5521 + * </ul>
1.5522 + *
1.5523 + * @param codePoint the character (Unicode code point) to be tested.
1.5524 + * @return {@code true} if the character has a defined meaning
1.5525 + * in Unicode; {@code false} otherwise.
1.5526 + * @see Character#isDigit(int)
1.5527 + * @see Character#isLetter(int)
1.5528 + * @see Character#isLetterOrDigit(int)
1.5529 + * @see Character#isLowerCase(int)
1.5530 + * @see Character#isTitleCase(int)
1.5531 + * @see Character#isUpperCase(int)
1.5532 + * @since 1.5
1.5533 + */
1.5534 + public static boolean isDefined(int codePoint) {
1.5535 + return getType(codePoint) != Character.UNASSIGNED;
1.5536 + }
1.5537 +
1.5538 + /**
1.5539 + * Determines if the specified character is a letter.
1.5540 + * <p>
1.5541 + * A character is considered to be a letter if its general
1.5542 + * category type, provided by {@code Character.getType(ch)},
1.5543 + * is any of the following:
1.5544 + * <ul>
1.5545 + * <li> {@code UPPERCASE_LETTER}
1.5546 + * <li> {@code LOWERCASE_LETTER}
1.5547 + * <li> {@code TITLECASE_LETTER}
1.5548 + * <li> {@code MODIFIER_LETTER}
1.5549 + * <li> {@code OTHER_LETTER}
1.5550 + * </ul>
1.5551 + *
1.5552 + * Not all letters have case. Many characters are
1.5553 + * letters but are neither uppercase nor lowercase nor titlecase.
1.5554 + *
1.5555 + * <p><b>Note:</b> This method cannot handle <a
1.5556 + * href="#supplementary"> supplementary characters</a>. To support
1.5557 + * all Unicode characters, including supplementary characters, use
1.5558 + * the {@link #isLetter(int)} method.
1.5559 + *
1.5560 + * @param ch the character to be tested.
1.5561 + * @return {@code true} if the character is a letter;
1.5562 + * {@code false} otherwise.
1.5563 + * @see Character#isDigit(char)
1.5564 + * @see Character#isJavaIdentifierStart(char)
1.5565 + * @see Character#isJavaLetter(char)
1.5566 + * @see Character#isJavaLetterOrDigit(char)
1.5567 + * @see Character#isLetterOrDigit(char)
1.5568 + * @see Character#isLowerCase(char)
1.5569 + * @see Character#isTitleCase(char)
1.5570 + * @see Character#isUnicodeIdentifierStart(char)
1.5571 + * @see Character#isUpperCase(char)
1.5572 + */
1.5573 + public static boolean isLetter(char ch) {
1.5574 + return isLetter((int)ch);
1.5575 + }
1.5576 +
1.5577 + /**
1.5578 + * Determines if the specified character (Unicode code point) is a letter.
1.5579 + * <p>
1.5580 + * A character is considered to be a letter if its general
1.5581 + * category type, provided by {@link Character#getType(int) getType(codePoint)},
1.5582 + * is any of the following:
1.5583 + * <ul>
1.5584 + * <li> {@code UPPERCASE_LETTER}
1.5585 + * <li> {@code LOWERCASE_LETTER}
1.5586 + * <li> {@code TITLECASE_LETTER}
1.5587 + * <li> {@code MODIFIER_LETTER}
1.5588 + * <li> {@code OTHER_LETTER}
1.5589 + * </ul>
1.5590 + *
1.5591 + * Not all letters have case. Many characters are
1.5592 + * letters but are neither uppercase nor lowercase nor titlecase.
1.5593 + *
1.5594 + * @param codePoint the character (Unicode code point) to be tested.
1.5595 + * @return {@code true} if the character is a letter;
1.5596 + * {@code false} otherwise.
1.5597 + * @see Character#isDigit(int)
1.5598 + * @see Character#isJavaIdentifierStart(int)
1.5599 + * @see Character#isLetterOrDigit(int)
1.5600 + * @see Character#isLowerCase(int)
1.5601 + * @see Character#isTitleCase(int)
1.5602 + * @see Character#isUnicodeIdentifierStart(int)
1.5603 + * @see Character#isUpperCase(int)
1.5604 + * @since 1.5
1.5605 + */
1.5606 + public static boolean isLetter(int codePoint) {
1.5607 + return ((((1 << Character.UPPERCASE_LETTER) |
1.5608 + (1 << Character.LOWERCASE_LETTER) |
1.5609 + (1 << Character.TITLECASE_LETTER) |
1.5610 + (1 << Character.MODIFIER_LETTER) |
1.5611 + (1 << Character.OTHER_LETTER)) >> getType(codePoint)) & 1)
1.5612 + != 0;
1.5613 + }
1.5614 +
1.5615 + /**
1.5616 + * Determines if the specified character is a letter or digit.
1.5617 + * <p>
1.5618 + * A character is considered to be a letter or digit if either
1.5619 + * {@code Character.isLetter(char ch)} or
1.5620 + * {@code Character.isDigit(char ch)} returns
1.5621 + * {@code true} for the character.
1.5622 + *
1.5623 + * <p><b>Note:</b> This method cannot handle <a
1.5624 + * href="#supplementary"> supplementary characters</a>. To support
1.5625 + * all Unicode characters, including supplementary characters, use
1.5626 + * the {@link #isLetterOrDigit(int)} method.
1.5627 + *
1.5628 + * @param ch the character to be tested.
1.5629 + * @return {@code true} if the character is a letter or digit;
1.5630 + * {@code false} otherwise.
1.5631 + * @see Character#isDigit(char)
1.5632 + * @see Character#isJavaIdentifierPart(char)
1.5633 + * @see Character#isJavaLetter(char)
1.5634 + * @see Character#isJavaLetterOrDigit(char)
1.5635 + * @see Character#isLetter(char)
1.5636 + * @see Character#isUnicodeIdentifierPart(char)
1.5637 + * @since 1.0.2
1.5638 + */
1.5639 + public static boolean isLetterOrDigit(char ch) {
1.5640 + return isLetterOrDigit((int)ch);
1.5641 + }
1.5642 +
1.5643 + /**
1.5644 + * Determines if the specified character (Unicode code point) is a letter or digit.
1.5645 + * <p>
1.5646 + * A character is considered to be a letter or digit if either
1.5647 + * {@link #isLetter(int) isLetter(codePoint)} or
1.5648 + * {@link #isDigit(int) isDigit(codePoint)} returns
1.5649 + * {@code true} for the character.
1.5650 + *
1.5651 + * @param codePoint the character (Unicode code point) to be tested.
1.5652 + * @return {@code true} if the character is a letter or digit;
1.5653 + * {@code false} otherwise.
1.5654 + * @see Character#isDigit(int)
1.5655 + * @see Character#isJavaIdentifierPart(int)
1.5656 + * @see Character#isLetter(int)
1.5657 + * @see Character#isUnicodeIdentifierPart(int)
1.5658 + * @since 1.5
1.5659 + */
1.5660 + public static boolean isLetterOrDigit(int codePoint) {
1.5661 + return ((((1 << Character.UPPERCASE_LETTER) |
1.5662 + (1 << Character.LOWERCASE_LETTER) |
1.5663 + (1 << Character.TITLECASE_LETTER) |
1.5664 + (1 << Character.MODIFIER_LETTER) |
1.5665 + (1 << Character.OTHER_LETTER) |
1.5666 + (1 << Character.DECIMAL_DIGIT_NUMBER)) >> getType(codePoint)) & 1)
1.5667 + != 0;
1.5668 + }
1.5669 +
1.5670 + /**
1.5671 + * Determines if the specified character is permissible as the first
1.5672 + * character in a Java identifier.
1.5673 + * <p>
1.5674 + * A character may start a Java identifier if and only if
1.5675 + * one of the following is true:
1.5676 + * <ul>
1.5677 + * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true}
1.5678 + * <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER}
1.5679 + * <li> {@code ch} is a currency symbol (such as {@code '$'})
1.5680 + * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}).
1.5681 + * </ul>
1.5682 + *
1.5683 + * @param ch the character to be tested.
1.5684 + * @return {@code true} if the character may start a Java
1.5685 + * identifier; {@code false} otherwise.
1.5686 + * @see Character#isJavaLetterOrDigit(char)
1.5687 + * @see Character#isJavaIdentifierStart(char)
1.5688 + * @see Character#isJavaIdentifierPart(char)
1.5689 + * @see Character#isLetter(char)
1.5690 + * @see Character#isLetterOrDigit(char)
1.5691 + * @see Character#isUnicodeIdentifierStart(char)
1.5692 + * @since 1.02
1.5693 + * @deprecated Replaced by isJavaIdentifierStart(char).
1.5694 + */
1.5695 + @Deprecated
1.5696 + public static boolean isJavaLetter(char ch) {
1.5697 + return isJavaIdentifierStart(ch);
1.5698 + }
1.5699 +
1.5700 + /**
1.5701 + * Determines if the specified character may be part of a Java
1.5702 + * identifier as other than the first character.
1.5703 + * <p>
1.5704 + * A character may be part of a Java identifier if and only if any
1.5705 + * of the following are true:
1.5706 + * <ul>
1.5707 + * <li> it is a letter
1.5708 + * <li> it is a currency symbol (such as {@code '$'})
1.5709 + * <li> it is a connecting punctuation character (such as {@code '_'})
1.5710 + * <li> it is a digit
1.5711 + * <li> it is a numeric letter (such as a Roman numeral character)
1.5712 + * <li> it is a combining mark
1.5713 + * <li> it is a non-spacing mark
1.5714 + * <li> {@code isIdentifierIgnorable} returns
1.5715 + * {@code true} for the character.
1.5716 + * </ul>
1.5717 + *
1.5718 + * @param ch the character to be tested.
1.5719 + * @return {@code true} if the character may be part of a
1.5720 + * Java identifier; {@code false} otherwise.
1.5721 + * @see Character#isJavaLetter(char)
1.5722 + * @see Character#isJavaIdentifierStart(char)
1.5723 + * @see Character#isJavaIdentifierPart(char)
1.5724 + * @see Character#isLetter(char)
1.5725 + * @see Character#isLetterOrDigit(char)
1.5726 + * @see Character#isUnicodeIdentifierPart(char)
1.5727 + * @see Character#isIdentifierIgnorable(char)
1.5728 + * @since 1.02
1.5729 + * @deprecated Replaced by isJavaIdentifierPart(char).
1.5730 + */
1.5731 + @Deprecated
1.5732 + public static boolean isJavaLetterOrDigit(char ch) {
1.5733 + return isJavaIdentifierPart(ch);
1.5734 + }
1.5735 +
1.5736 + /**
1.5737 + * Determines if the specified character (Unicode code point) is an alphabet.
1.5738 + * <p>
1.5739 + * A character is considered to be alphabetic if its general category type,
1.5740 + * provided by {@link Character#getType(int) getType(codePoint)}, is any of
1.5741 + * the following:
1.5742 + * <ul>
1.5743 + * <li> <code>UPPERCASE_LETTER</code>
1.5744 + * <li> <code>LOWERCASE_LETTER</code>
1.5745 + * <li> <code>TITLECASE_LETTER</code>
1.5746 + * <li> <code>MODIFIER_LETTER</code>
1.5747 + * <li> <code>OTHER_LETTER</code>
1.5748 + * <li> <code>LETTER_NUMBER</code>
1.5749 + * </ul>
1.5750 + * or it has contributory property Other_Alphabetic as defined by the
1.5751 + * Unicode Standard.
1.5752 + *
1.5753 + * @param codePoint the character (Unicode code point) to be tested.
1.5754 + * @return <code>true</code> if the character is a Unicode alphabet
1.5755 + * character, <code>false</code> otherwise.
1.5756 + * @since 1.7
1.5757 + */
1.5758 + public static boolean isAlphabetic(int codePoint) {
1.5759 + return (((((1 << Character.UPPERCASE_LETTER) |
1.5760 + (1 << Character.LOWERCASE_LETTER) |
1.5761 + (1 << Character.TITLECASE_LETTER) |
1.5762 + (1 << Character.MODIFIER_LETTER) |
1.5763 + (1 << Character.OTHER_LETTER) |
1.5764 + (1 << Character.LETTER_NUMBER)) >> getType(codePoint)) & 1) != 0) ||
1.5765 + CharacterData.of(codePoint).isOtherAlphabetic(codePoint);
1.5766 + }
1.5767 +
1.5768 + /**
1.5769 + * Determines if the specified character (Unicode code point) is a CJKV
1.5770 + * (Chinese, Japanese, Korean and Vietnamese) ideograph, as defined by
1.5771 + * the Unicode Standard.
1.5772 + *
1.5773 + * @param codePoint the character (Unicode code point) to be tested.
1.5774 + * @return <code>true</code> if the character is a Unicode ideograph
1.5775 + * character, <code>false</code> otherwise.
1.5776 + * @since 1.7
1.5777 + */
1.5778 + public static boolean isIdeographic(int codePoint) {
1.5779 + return CharacterData.of(codePoint).isIdeographic(codePoint);
1.5780 + }
1.5781 +
1.5782 + /**
1.5783 + * Determines if the specified character is
1.5784 + * permissible as the first character in a Java identifier.
1.5785 + * <p>
1.5786 + * A character may start a Java identifier if and only if
1.5787 + * one of the following conditions is true:
1.5788 + * <ul>
1.5789 + * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true}
1.5790 + * <li> {@link #getType(char) getType(ch)} returns {@code LETTER_NUMBER}
1.5791 + * <li> {@code ch} is a currency symbol (such as {@code '$'})
1.5792 + * <li> {@code ch} is a connecting punctuation character (such as {@code '_'}).
1.5793 + * </ul>
1.5794 + *
1.5795 + * <p><b>Note:</b> This method cannot handle <a
1.5796 + * href="#supplementary"> supplementary characters</a>. To support
1.5797 + * all Unicode characters, including supplementary characters, use
1.5798 + * the {@link #isJavaIdentifierStart(int)} method.
1.5799 + *
1.5800 + * @param ch the character to be tested.
1.5801 + * @return {@code true} if the character may start a Java identifier;
1.5802 + * {@code false} otherwise.
1.5803 + * @see Character#isJavaIdentifierPart(char)
1.5804 + * @see Character#isLetter(char)
1.5805 + * @see Character#isUnicodeIdentifierStart(char)
1.5806 + * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence)
1.5807 + * @since 1.1
1.5808 + */
1.5809 + public static boolean isJavaIdentifierStart(char ch) {
1.5810 + return isJavaIdentifierStart((int)ch);
1.5811 + }
1.5812 +
1.5813 + /**
1.5814 + * Determines if the character (Unicode code point) is
1.5815 + * permissible as the first character in a Java identifier.
1.5816 + * <p>
1.5817 + * A character may start a Java identifier if and only if
1.5818 + * one of the following conditions is true:
1.5819 + * <ul>
1.5820 + * <li> {@link #isLetter(int) isLetter(codePoint)}
1.5821 + * returns {@code true}
1.5822 + * <li> {@link #getType(int) getType(codePoint)}
1.5823 + * returns {@code LETTER_NUMBER}
1.5824 + * <li> the referenced character is a currency symbol (such as {@code '$'})
1.5825 + * <li> the referenced character is a connecting punctuation character
1.5826 + * (such as {@code '_'}).
1.5827 + * </ul>
1.5828 + *
1.5829 + * @param codePoint the character (Unicode code point) to be tested.
1.5830 + * @return {@code true} if the character may start a Java identifier;
1.5831 + * {@code false} otherwise.
1.5832 + * @see Character#isJavaIdentifierPart(int)
1.5833 + * @see Character#isLetter(int)
1.5834 + * @see Character#isUnicodeIdentifierStart(int)
1.5835 + * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence)
1.5836 + * @since 1.5
1.5837 + */
1.5838 + public static boolean isJavaIdentifierStart(int codePoint) {
1.5839 + return CharacterData.of(codePoint).isJavaIdentifierStart(codePoint);
1.5840 + }
1.5841 +
1.5842 + /**
1.5843 + * Determines if the specified character may be part of a Java
1.5844 + * identifier as other than the first character.
1.5845 + * <p>
1.5846 + * A character may be part of a Java identifier if any of the following
1.5847 + * are true:
1.5848 + * <ul>
1.5849 + * <li> it is a letter
1.5850 + * <li> it is a currency symbol (such as {@code '$'})
1.5851 + * <li> it is a connecting punctuation character (such as {@code '_'})
1.5852 + * <li> it is a digit
1.5853 + * <li> it is a numeric letter (such as a Roman numeral character)
1.5854 + * <li> it is a combining mark
1.5855 + * <li> it is a non-spacing mark
1.5856 + * <li> {@code isIdentifierIgnorable} returns
1.5857 + * {@code true} for the character
1.5858 + * </ul>
1.5859 + *
1.5860 + * <p><b>Note:</b> This method cannot handle <a
1.5861 + * href="#supplementary"> supplementary characters</a>. To support
1.5862 + * all Unicode characters, including supplementary characters, use
1.5863 + * the {@link #isJavaIdentifierPart(int)} method.
1.5864 + *
1.5865 + * @param ch the character to be tested.
1.5866 + * @return {@code true} if the character may be part of a
1.5867 + * Java identifier; {@code false} otherwise.
1.5868 + * @see Character#isIdentifierIgnorable(char)
1.5869 + * @see Character#isJavaIdentifierStart(char)
1.5870 + * @see Character#isLetterOrDigit(char)
1.5871 + * @see Character#isUnicodeIdentifierPart(char)
1.5872 + * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence)
1.5873 + * @since 1.1
1.5874 + */
1.5875 + public static boolean isJavaIdentifierPart(char ch) {
1.5876 + return isJavaIdentifierPart((int)ch);
1.5877 + }
1.5878 +
1.5879 + /**
1.5880 + * Determines if the character (Unicode code point) may be part of a Java
1.5881 + * identifier as other than the first character.
1.5882 + * <p>
1.5883 + * A character may be part of a Java identifier if any of the following
1.5884 + * are true:
1.5885 + * <ul>
1.5886 + * <li> it is a letter
1.5887 + * <li> it is a currency symbol (such as {@code '$'})
1.5888 + * <li> it is a connecting punctuation character (such as {@code '_'})
1.5889 + * <li> it is a digit
1.5890 + * <li> it is a numeric letter (such as a Roman numeral character)
1.5891 + * <li> it is a combining mark
1.5892 + * <li> it is a non-spacing mark
1.5893 + * <li> {@link #isIdentifierIgnorable(int)
1.5894 + * isIdentifierIgnorable(codePoint)} returns {@code true} for
1.5895 + * the character
1.5896 + * </ul>
1.5897 + *
1.5898 + * @param codePoint the character (Unicode code point) to be tested.
1.5899 + * @return {@code true} if the character may be part of a
1.5900 + * Java identifier; {@code false} otherwise.
1.5901 + * @see Character#isIdentifierIgnorable(int)
1.5902 + * @see Character#isJavaIdentifierStart(int)
1.5903 + * @see Character#isLetterOrDigit(int)
1.5904 + * @see Character#isUnicodeIdentifierPart(int)
1.5905 + * @see javax.lang.model.SourceVersion#isIdentifier(CharSequence)
1.5906 + * @since 1.5
1.5907 + */
1.5908 + public static boolean isJavaIdentifierPart(int codePoint) {
1.5909 + return CharacterData.of(codePoint).isJavaIdentifierPart(codePoint);
1.5910 + }
1.5911 +
1.5912 + /**
1.5913 + * Determines if the specified character is permissible as the
1.5914 + * first character in a Unicode identifier.
1.5915 + * <p>
1.5916 + * A character may start a Unicode identifier if and only if
1.5917 + * one of the following conditions is true:
1.5918 + * <ul>
1.5919 + * <li> {@link #isLetter(char) isLetter(ch)} returns {@code true}
1.5920 + * <li> {@link #getType(char) getType(ch)} returns
1.5921 + * {@code LETTER_NUMBER}.
1.5922 + * </ul>
1.5923 + *
1.5924 + * <p><b>Note:</b> This method cannot handle <a
1.5925 + * href="#supplementary"> supplementary characters</a>. To support
1.5926 + * all Unicode characters, including supplementary characters, use
1.5927 + * the {@link #isUnicodeIdentifierStart(int)} method.
1.5928 + *
1.5929 + * @param ch the character to be tested.
1.5930 + * @return {@code true} if the character may start a Unicode
1.5931 + * identifier; {@code false} otherwise.
1.5932 + * @see Character#isJavaIdentifierStart(char)
1.5933 + * @see Character#isLetter(char)
1.5934 + * @see Character#isUnicodeIdentifierPart(char)
1.5935 + * @since 1.1
1.5936 + */
1.5937 + public static boolean isUnicodeIdentifierStart(char ch) {
1.5938 + return isUnicodeIdentifierStart((int)ch);
1.5939 + }
1.5940 +
1.5941 + /**
1.5942 + * Determines if the specified character (Unicode code point) is permissible as the
1.5943 + * first character in a Unicode identifier.
1.5944 + * <p>
1.5945 + * A character may start a Unicode identifier if and only if
1.5946 + * one of the following conditions is true:
1.5947 + * <ul>
1.5948 + * <li> {@link #isLetter(int) isLetter(codePoint)}
1.5949 + * returns {@code true}
1.5950 + * <li> {@link #getType(int) getType(codePoint)}
1.5951 + * returns {@code LETTER_NUMBER}.
1.5952 + * </ul>
1.5953 + * @param codePoint the character (Unicode code point) to be tested.
1.5954 + * @return {@code true} if the character may start a Unicode
1.5955 + * identifier; {@code false} otherwise.
1.5956 + * @see Character#isJavaIdentifierStart(int)
1.5957 + * @see Character#isLetter(int)
1.5958 + * @see Character#isUnicodeIdentifierPart(int)
1.5959 + * @since 1.5
1.5960 + */
1.5961 + public static boolean isUnicodeIdentifierStart(int codePoint) {
1.5962 + return CharacterData.of(codePoint).isUnicodeIdentifierStart(codePoint);
1.5963 + }
1.5964 +
1.5965 + /**
1.5966 + * Determines if the specified character may be part of a Unicode
1.5967 + * identifier as other than the first character.
1.5968 + * <p>
1.5969 + * A character may be part of a Unicode identifier if and only if
1.5970 + * one of the following statements is true:
1.5971 + * <ul>
1.5972 + * <li> it is a letter
1.5973 + * <li> it is a connecting punctuation character (such as {@code '_'})
1.5974 + * <li> it is a digit
1.5975 + * <li> it is a numeric letter (such as a Roman numeral character)
1.5976 + * <li> it is a combining mark
1.5977 + * <li> it is a non-spacing mark
1.5978 + * <li> {@code isIdentifierIgnorable} returns
1.5979 + * {@code true} for this character.
1.5980 + * </ul>
1.5981 + *
1.5982 + * <p><b>Note:</b> This method cannot handle <a
1.5983 + * href="#supplementary"> supplementary characters</a>. To support
1.5984 + * all Unicode characters, including supplementary characters, use
1.5985 + * the {@link #isUnicodeIdentifierPart(int)} method.
1.5986 + *
1.5987 + * @param ch the character to be tested.
1.5988 + * @return {@code true} if the character may be part of a
1.5989 + * Unicode identifier; {@code false} otherwise.
1.5990 + * @see Character#isIdentifierIgnorable(char)
1.5991 + * @see Character#isJavaIdentifierPart(char)
1.5992 + * @see Character#isLetterOrDigit(char)
1.5993 + * @see Character#isUnicodeIdentifierStart(char)
1.5994 + * @since 1.1
1.5995 + */
1.5996 + public static boolean isUnicodeIdentifierPart(char ch) {
1.5997 + return isUnicodeIdentifierPart((int)ch);
1.5998 + }
1.5999 +
1.6000 + /**
1.6001 + * Determines if the specified character (Unicode code point) may be part of a Unicode
1.6002 + * identifier as other than the first character.
1.6003 + * <p>
1.6004 + * A character may be part of a Unicode identifier if and only if
1.6005 + * one of the following statements is true:
1.6006 + * <ul>
1.6007 + * <li> it is a letter
1.6008 + * <li> it is a connecting punctuation character (such as {@code '_'})
1.6009 + * <li> it is a digit
1.6010 + * <li> it is a numeric letter (such as a Roman numeral character)
1.6011 + * <li> it is a combining mark
1.6012 + * <li> it is a non-spacing mark
1.6013 + * <li> {@code isIdentifierIgnorable} returns
1.6014 + * {@code true} for this character.
1.6015 + * </ul>
1.6016 + * @param codePoint the character (Unicode code point) to be tested.
1.6017 + * @return {@code true} if the character may be part of a
1.6018 + * Unicode identifier; {@code false} otherwise.
1.6019 + * @see Character#isIdentifierIgnorable(int)
1.6020 + * @see Character#isJavaIdentifierPart(int)
1.6021 + * @see Character#isLetterOrDigit(int)
1.6022 + * @see Character#isUnicodeIdentifierStart(int)
1.6023 + * @since 1.5
1.6024 + */
1.6025 + public static boolean isUnicodeIdentifierPart(int codePoint) {
1.6026 + return CharacterData.of(codePoint).isUnicodeIdentifierPart(codePoint);
1.6027 + }
1.6028 +
1.6029 + /**
1.6030 + * Determines if the specified character should be regarded as
1.6031 + * an ignorable character in a Java identifier or a Unicode identifier.
1.6032 + * <p>
1.6033 + * The following Unicode characters are ignorable in a Java identifier
1.6034 + * or a Unicode identifier:
1.6035 + * <ul>
1.6036 + * <li>ISO control characters that are not whitespace
1.6037 + * <ul>
1.6038 + * <li>{@code '\u005Cu0000'} through {@code '\u005Cu0008'}
1.6039 + * <li>{@code '\u005Cu000E'} through {@code '\u005Cu001B'}
1.6040 + * <li>{@code '\u005Cu007F'} through {@code '\u005Cu009F'}
1.6041 + * </ul>
1.6042 + *
1.6043 + * <li>all characters that have the {@code FORMAT} general
1.6044 + * category value
1.6045 + * </ul>
1.6046 + *
1.6047 + * <p><b>Note:</b> This method cannot handle <a
1.6048 + * href="#supplementary"> supplementary characters</a>. To support
1.6049 + * all Unicode characters, including supplementary characters, use
1.6050 + * the {@link #isIdentifierIgnorable(int)} method.
1.6051 + *
1.6052 + * @param ch the character to be tested.
1.6053 + * @return {@code true} if the character is an ignorable control
1.6054 + * character that may be part of a Java or Unicode identifier;
1.6055 + * {@code false} otherwise.
1.6056 + * @see Character#isJavaIdentifierPart(char)
1.6057 + * @see Character#isUnicodeIdentifierPart(char)
1.6058 + * @since 1.1
1.6059 + */
1.6060 + public static boolean isIdentifierIgnorable(char ch) {
1.6061 + return isIdentifierIgnorable((int)ch);
1.6062 + }
1.6063 +
1.6064 + /**
1.6065 + * Determines if the specified character (Unicode code point) should be regarded as
1.6066 + * an ignorable character in a Java identifier or a Unicode identifier.
1.6067 + * <p>
1.6068 + * The following Unicode characters are ignorable in a Java identifier
1.6069 + * or a Unicode identifier:
1.6070 + * <ul>
1.6071 + * <li>ISO control characters that are not whitespace
1.6072 + * <ul>
1.6073 + * <li>{@code '\u005Cu0000'} through {@code '\u005Cu0008'}
1.6074 + * <li>{@code '\u005Cu000E'} through {@code '\u005Cu001B'}
1.6075 + * <li>{@code '\u005Cu007F'} through {@code '\u005Cu009F'}
1.6076 + * </ul>
1.6077 + *
1.6078 + * <li>all characters that have the {@code FORMAT} general
1.6079 + * category value
1.6080 + * </ul>
1.6081 + *
1.6082 + * @param codePoint the character (Unicode code point) to be tested.
1.6083 + * @return {@code true} if the character is an ignorable control
1.6084 + * character that may be part of a Java or Unicode identifier;
1.6085 + * {@code false} otherwise.
1.6086 + * @see Character#isJavaIdentifierPart(int)
1.6087 + * @see Character#isUnicodeIdentifierPart(int)
1.6088 + * @since 1.5
1.6089 + */
1.6090 + public static boolean isIdentifierIgnorable(int codePoint) {
1.6091 + return CharacterData.of(codePoint).isIdentifierIgnorable(codePoint);
1.6092 + }
1.6093 +
1.6094 + /**
1.6095 + * Converts the character argument to lowercase using case
1.6096 + * mapping information from the UnicodeData file.
1.6097 + * <p>
1.6098 + * Note that
1.6099 + * {@code Character.isLowerCase(Character.toLowerCase(ch))}
1.6100 + * does not always return {@code true} for some ranges of
1.6101 + * characters, particularly those that are symbols or ideographs.
1.6102 + *
1.6103 + * <p>In general, {@link String#toLowerCase()} should be used to map
1.6104 + * characters to lowercase. {@code String} case mapping methods
1.6105 + * have several benefits over {@code Character} case mapping methods.
1.6106 + * {@code String} case mapping methods can perform locale-sensitive
1.6107 + * mappings, context-sensitive mappings, and 1:M character mappings, whereas
1.6108 + * the {@code Character} case mapping methods cannot.
1.6109 + *
1.6110 + * <p><b>Note:</b> This method cannot handle <a
1.6111 + * href="#supplementary"> supplementary characters</a>. To support
1.6112 + * all Unicode characters, including supplementary characters, use
1.6113 + * the {@link #toLowerCase(int)} method.
1.6114 + *
1.6115 + * @param ch the character to be converted.
1.6116 + * @return the lowercase equivalent of the character, if any;
1.6117 + * otherwise, the character itself.
1.6118 + * @see Character#isLowerCase(char)
1.6119 + * @see String#toLowerCase()
1.6120 + */
1.6121 + public static char toLowerCase(char ch) {
1.6122 + return (char)toLowerCase((int)ch);
1.6123 + }
1.6124 +
1.6125 + /**
1.6126 + * Converts the character (Unicode code point) argument to
1.6127 + * lowercase using case mapping information from the UnicodeData
1.6128 + * file.
1.6129 + *
1.6130 + * <p> Note that
1.6131 + * {@code Character.isLowerCase(Character.toLowerCase(codePoint))}
1.6132 + * does not always return {@code true} for some ranges of
1.6133 + * characters, particularly those that are symbols or ideographs.
1.6134 + *
1.6135 + * <p>In general, {@link String#toLowerCase()} should be used to map
1.6136 + * characters to lowercase. {@code String} case mapping methods
1.6137 + * have several benefits over {@code Character} case mapping methods.
1.6138 + * {@code String} case mapping methods can perform locale-sensitive
1.6139 + * mappings, context-sensitive mappings, and 1:M character mappings, whereas
1.6140 + * the {@code Character} case mapping methods cannot.
1.6141 + *
1.6142 + * @param codePoint the character (Unicode code point) to be converted.
1.6143 + * @return the lowercase equivalent of the character (Unicode code
1.6144 + * point), if any; otherwise, the character itself.
1.6145 + * @see Character#isLowerCase(int)
1.6146 + * @see String#toLowerCase()
1.6147 + *
1.6148 + * @since 1.5
1.6149 + */
1.6150 + public static int toLowerCase(int codePoint) {
1.6151 + return CharacterData.of(codePoint).toLowerCase(codePoint);
1.6152 + }
1.6153 +
1.6154 + /**
1.6155 + * Converts the character argument to uppercase using case mapping
1.6156 + * information from the UnicodeData file.
1.6157 + * <p>
1.6158 + * Note that
1.6159 + * {@code Character.isUpperCase(Character.toUpperCase(ch))}
1.6160 + * does not always return {@code true} for some ranges of
1.6161 + * characters, particularly those that are symbols or ideographs.
1.6162 + *
1.6163 + * <p>In general, {@link String#toUpperCase()} should be used to map
1.6164 + * characters to uppercase. {@code String} case mapping methods
1.6165 + * have several benefits over {@code Character} case mapping methods.
1.6166 + * {@code String} case mapping methods can perform locale-sensitive
1.6167 + * mappings, context-sensitive mappings, and 1:M character mappings, whereas
1.6168 + * the {@code Character} case mapping methods cannot.
1.6169 + *
1.6170 + * <p><b>Note:</b> This method cannot handle <a
1.6171 + * href="#supplementary"> supplementary characters</a>. To support
1.6172 + * all Unicode characters, including supplementary characters, use
1.6173 + * the {@link #toUpperCase(int)} method.
1.6174 + *
1.6175 + * @param ch the character to be converted.
1.6176 + * @return the uppercase equivalent of the character, if any;
1.6177 + * otherwise, the character itself.
1.6178 + * @see Character#isUpperCase(char)
1.6179 + * @see String#toUpperCase()
1.6180 + */
1.6181 + public static char toUpperCase(char ch) {
1.6182 + return (char)toUpperCase((int)ch);
1.6183 + }
1.6184 +
1.6185 + /**
1.6186 + * Converts the character (Unicode code point) argument to
1.6187 + * uppercase using case mapping information from the UnicodeData
1.6188 + * file.
1.6189 + *
1.6190 + * <p>Note that
1.6191 + * {@code Character.isUpperCase(Character.toUpperCase(codePoint))}
1.6192 + * does not always return {@code true} for some ranges of
1.6193 + * characters, particularly those that are symbols or ideographs.
1.6194 + *
1.6195 + * <p>In general, {@link String#toUpperCase()} should be used to map
1.6196 + * characters to uppercase. {@code String} case mapping methods
1.6197 + * have several benefits over {@code Character} case mapping methods.
1.6198 + * {@code String} case mapping methods can perform locale-sensitive
1.6199 + * mappings, context-sensitive mappings, and 1:M character mappings, whereas
1.6200 + * the {@code Character} case mapping methods cannot.
1.6201 + *
1.6202 + * @param codePoint the character (Unicode code point) to be converted.
1.6203 + * @return the uppercase equivalent of the character, if any;
1.6204 + * otherwise, the character itself.
1.6205 + * @see Character#isUpperCase(int)
1.6206 + * @see String#toUpperCase()
1.6207 + *
1.6208 + * @since 1.5
1.6209 + */
1.6210 + public static int toUpperCase(int codePoint) {
1.6211 + return CharacterData.of(codePoint).toUpperCase(codePoint);
1.6212 + }
1.6213 +
1.6214 + /**
1.6215 + * Converts the character argument to titlecase using case mapping
1.6216 + * information from the UnicodeData file. If a character has no
1.6217 + * explicit titlecase mapping and is not itself a titlecase char
1.6218 + * according to UnicodeData, then the uppercase mapping is
1.6219 + * returned as an equivalent titlecase mapping. If the
1.6220 + * {@code char} argument is already a titlecase
1.6221 + * {@code char}, the same {@code char} value will be
1.6222 + * returned.
1.6223 + * <p>
1.6224 + * Note that
1.6225 + * {@code Character.isTitleCase(Character.toTitleCase(ch))}
1.6226 + * does not always return {@code true} for some ranges of
1.6227 + * characters.
1.6228 + *
1.6229 + * <p><b>Note:</b> This method cannot handle <a
1.6230 + * href="#supplementary"> supplementary characters</a>. To support
1.6231 + * all Unicode characters, including supplementary characters, use
1.6232 + * the {@link #toTitleCase(int)} method.
1.6233 + *
1.6234 + * @param ch the character to be converted.
1.6235 + * @return the titlecase equivalent of the character, if any;
1.6236 + * otherwise, the character itself.
1.6237 + * @see Character#isTitleCase(char)
1.6238 + * @see Character#toLowerCase(char)
1.6239 + * @see Character#toUpperCase(char)
1.6240 + * @since 1.0.2
1.6241 + */
1.6242 + public static char toTitleCase(char ch) {
1.6243 + return (char)toTitleCase((int)ch);
1.6244 + }
1.6245 +
1.6246 + /**
1.6247 + * Converts the character (Unicode code point) argument to titlecase using case mapping
1.6248 + * information from the UnicodeData file. If a character has no
1.6249 + * explicit titlecase mapping and is not itself a titlecase char
1.6250 + * according to UnicodeData, then the uppercase mapping is
1.6251 + * returned as an equivalent titlecase mapping. If the
1.6252 + * character argument is already a titlecase
1.6253 + * character, the same character value will be
1.6254 + * returned.
1.6255 + *
1.6256 + * <p>Note that
1.6257 + * {@code Character.isTitleCase(Character.toTitleCase(codePoint))}
1.6258 + * does not always return {@code true} for some ranges of
1.6259 + * characters.
1.6260 + *
1.6261 + * @param codePoint the character (Unicode code point) to be converted.
1.6262 + * @return the titlecase equivalent of the character, if any;
1.6263 + * otherwise, the character itself.
1.6264 + * @see Character#isTitleCase(int)
1.6265 + * @see Character#toLowerCase(int)
1.6266 + * @see Character#toUpperCase(int)
1.6267 + * @since 1.5
1.6268 + */
1.6269 + public static int toTitleCase(int codePoint) {
1.6270 + return CharacterData.of(codePoint).toTitleCase(codePoint);
1.6271 + }
1.6272 +
1.6273 + /**
1.6274 + * Returns the numeric value of the character {@code ch} in the
1.6275 + * specified radix.
1.6276 + * <p>
1.6277 + * If the radix is not in the range {@code MIN_RADIX} ≤
1.6278 + * {@code radix} ≤ {@code MAX_RADIX} or if the
1.6279 + * value of {@code ch} is not a valid digit in the specified
1.6280 + * radix, {@code -1} is returned. A character is a valid digit
1.6281 + * if at least one of the following is true:
1.6282 + * <ul>
1.6283 + * <li>The method {@code isDigit} is {@code true} of the character
1.6284 + * and the Unicode decimal digit value of the character (or its
1.6285 + * single-character decomposition) is less than the specified radix.
1.6286 + * In this case the decimal digit value is returned.
1.6287 + * <li>The character is one of the uppercase Latin letters
1.6288 + * {@code 'A'} through {@code 'Z'} and its code is less than
1.6289 + * {@code radix + 'A' - 10}.
1.6290 + * In this case, {@code ch - 'A' + 10}
1.6291 + * is returned.
1.6292 + * <li>The character is one of the lowercase Latin letters
1.6293 + * {@code 'a'} through {@code 'z'} and its code is less than
1.6294 + * {@code radix + 'a' - 10}.
1.6295 + * In this case, {@code ch - 'a' + 10}
1.6296 + * is returned.
1.6297 + * <li>The character is one of the fullwidth uppercase Latin letters A
1.6298 + * ({@code '\u005CuFF21'}) through Z ({@code '\u005CuFF3A'})
1.6299 + * and its code is less than
1.6300 + * {@code radix + '\u005CuFF21' - 10}.
1.6301 + * In this case, {@code ch - '\u005CuFF21' + 10}
1.6302 + * is returned.
1.6303 + * <li>The character is one of the fullwidth lowercase Latin letters a
1.6304 + * ({@code '\u005CuFF41'}) through z ({@code '\u005CuFF5A'})
1.6305 + * and its code is less than
1.6306 + * {@code radix + '\u005CuFF41' - 10}.
1.6307 + * In this case, {@code ch - '\u005CuFF41' + 10}
1.6308 + * is returned.
1.6309 + * </ul>
1.6310 + *
1.6311 + * <p><b>Note:</b> This method cannot handle <a
1.6312 + * href="#supplementary"> supplementary characters</a>. To support
1.6313 + * all Unicode characters, including supplementary characters, use
1.6314 + * the {@link #digit(int, int)} method.
1.6315 + *
1.6316 + * @param ch the character to be converted.
1.6317 + * @param radix the radix.
1.6318 + * @return the numeric value represented by the character in the
1.6319 + * specified radix.
1.6320 + * @see Character#forDigit(int, int)
1.6321 + * @see Character#isDigit(char)
1.6322 + */
1.6323 + public static int digit(char ch, int radix) {
1.6324 + return digit((int)ch, radix);
1.6325 + }
1.6326 +
1.6327 + /**
1.6328 + * Returns the numeric value of the specified character (Unicode
1.6329 + * code point) in the specified radix.
1.6330 + *
1.6331 + * <p>If the radix is not in the range {@code MIN_RADIX} ≤
1.6332 + * {@code radix} ≤ {@code MAX_RADIX} or if the
1.6333 + * character is not a valid digit in the specified
1.6334 + * radix, {@code -1} is returned. A character is a valid digit
1.6335 + * if at least one of the following is true:
1.6336 + * <ul>
1.6337 + * <li>The method {@link #isDigit(int) isDigit(codePoint)} is {@code true} of the character
1.6338 + * and the Unicode decimal digit value of the character (or its
1.6339 + * single-character decomposition) is less than the specified radix.
1.6340 + * In this case the decimal digit value is returned.
1.6341 + * <li>The character is one of the uppercase Latin letters
1.6342 + * {@code 'A'} through {@code 'Z'} and its code is less than
1.6343 + * {@code radix + 'A' - 10}.
1.6344 + * In this case, {@code codePoint - 'A' + 10}
1.6345 + * is returned.
1.6346 + * <li>The character is one of the lowercase Latin letters
1.6347 + * {@code 'a'} through {@code 'z'} and its code is less than
1.6348 + * {@code radix + 'a' - 10}.
1.6349 + * In this case, {@code codePoint - 'a' + 10}
1.6350 + * is returned.
1.6351 + * <li>The character is one of the fullwidth uppercase Latin letters A
1.6352 + * ({@code '\u005CuFF21'}) through Z ({@code '\u005CuFF3A'})
1.6353 + * and its code is less than
1.6354 + * {@code radix + '\u005CuFF21' - 10}.
1.6355 + * In this case,
1.6356 + * {@code codePoint - '\u005CuFF21' + 10}
1.6357 + * is returned.
1.6358 + * <li>The character is one of the fullwidth lowercase Latin letters a
1.6359 + * ({@code '\u005CuFF41'}) through z ({@code '\u005CuFF5A'})
1.6360 + * and its code is less than
1.6361 + * {@code radix + '\u005CuFF41'- 10}.
1.6362 + * In this case,
1.6363 + * {@code codePoint - '\u005CuFF41' + 10}
1.6364 + * is returned.
1.6365 + * </ul>
1.6366 + *
1.6367 + * @param codePoint the character (Unicode code point) to be converted.
1.6368 + * @param radix the radix.
1.6369 + * @return the numeric value represented by the character in the
1.6370 + * specified radix.
1.6371 + * @see Character#forDigit(int, int)
1.6372 + * @see Character#isDigit(int)
1.6373 + * @since 1.5
1.6374 + */
1.6375 + public static int digit(int codePoint, int radix) {
1.6376 + return CharacterData.of(codePoint).digit(codePoint, radix);
1.6377 + }
1.6378 +
1.6379 + /**
1.6380 + * Returns the {@code int} value that the specified Unicode
1.6381 + * character represents. For example, the character
1.6382 + * {@code '\u005Cu216C'} (the roman numeral fifty) will return
1.6383 + * an int with a value of 50.
1.6384 + * <p>
1.6385 + * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
1.6386 + * {@code '\u005Cu005A'}), lowercase
1.6387 + * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
1.6388 + * full width variant ({@code '\u005CuFF21'} through
1.6389 + * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
1.6390 + * {@code '\u005CuFF5A'}) forms have numeric values from 10
1.6391 + * through 35. This is independent of the Unicode specification,
1.6392 + * which does not assign numeric values to these {@code char}
1.6393 + * values.
1.6394 + * <p>
1.6395 + * If the character does not have a numeric value, then -1 is returned.
1.6396 + * If the character has a numeric value that cannot be represented as a
1.6397 + * nonnegative integer (for example, a fractional value), then -2
1.6398 + * is returned.
1.6399 + *
1.6400 + * <p><b>Note:</b> This method cannot handle <a
1.6401 + * href="#supplementary"> supplementary characters</a>. To support
1.6402 + * all Unicode characters, including supplementary characters, use
1.6403 + * the {@link #getNumericValue(int)} method.
1.6404 + *
1.6405 + * @param ch the character to be converted.
1.6406 + * @return the numeric value of the character, as a nonnegative {@code int}
1.6407 + * value; -2 if the character has a numeric value that is not a
1.6408 + * nonnegative integer; -1 if the character has no numeric value.
1.6409 + * @see Character#forDigit(int, int)
1.6410 + * @see Character#isDigit(char)
1.6411 + * @since 1.1
1.6412 + */
1.6413 + public static int getNumericValue(char ch) {
1.6414 + return getNumericValue((int)ch);
1.6415 + }
1.6416 +
1.6417 + /**
1.6418 + * Returns the {@code int} value that the specified
1.6419 + * character (Unicode code point) represents. For example, the character
1.6420 + * {@code '\u005Cu216C'} (the Roman numeral fifty) will return
1.6421 + * an {@code int} with a value of 50.
1.6422 + * <p>
1.6423 + * The letters A-Z in their uppercase ({@code '\u005Cu0041'} through
1.6424 + * {@code '\u005Cu005A'}), lowercase
1.6425 + * ({@code '\u005Cu0061'} through {@code '\u005Cu007A'}), and
1.6426 + * full width variant ({@code '\u005CuFF21'} through
1.6427 + * {@code '\u005CuFF3A'} and {@code '\u005CuFF41'} through
1.6428 + * {@code '\u005CuFF5A'}) forms have numeric values from 10
1.6429 + * through 35. This is independent of the Unicode specification,
1.6430 + * which does not assign numeric values to these {@code char}
1.6431 + * values.
1.6432 + * <p>
1.6433 + * If the character does not have a numeric value, then -1 is returned.
1.6434 + * If the character has a numeric value that cannot be represented as a
1.6435 + * nonnegative integer (for example, a fractional value), then -2
1.6436 + * is returned.
1.6437 + *
1.6438 + * @param codePoint the character (Unicode code point) to be converted.
1.6439 + * @return the numeric value of the character, as a nonnegative {@code int}
1.6440 + * value; -2 if the character has a numeric value that is not a
1.6441 + * nonnegative integer; -1 if the character has no numeric value.
1.6442 + * @see Character#forDigit(int, int)
1.6443 + * @see Character#isDigit(int)
1.6444 + * @since 1.5
1.6445 + */
1.6446 + public static int getNumericValue(int codePoint) {
1.6447 + return CharacterData.of(codePoint).getNumericValue(codePoint);
1.6448 + }
1.6449 +
1.6450 + /**
1.6451 + * Determines if the specified character is ISO-LATIN-1 white space.
1.6452 + * This method returns {@code true} for the following five
1.6453 + * characters only:
1.6454 + * <table>
1.6455 + * <tr><td>{@code '\t'}</td> <td>{@code U+0009}</td>
1.6456 + * <td>{@code HORIZONTAL TABULATION}</td></tr>
1.6457 + * <tr><td>{@code '\n'}</td> <td>{@code U+000A}</td>
1.6458 + * <td>{@code NEW LINE}</td></tr>
1.6459 + * <tr><td>{@code '\f'}</td> <td>{@code U+000C}</td>
1.6460 + * <td>{@code FORM FEED}</td></tr>
1.6461 + * <tr><td>{@code '\r'}</td> <td>{@code U+000D}</td>
1.6462 + * <td>{@code CARRIAGE RETURN}</td></tr>
1.6463 + * <tr><td>{@code ' '}</td> <td>{@code U+0020}</td>
1.6464 + * <td>{@code SPACE}</td></tr>
1.6465 + * </table>
1.6466 + *
1.6467 + * @param ch the character to be tested.
1.6468 + * @return {@code true} if the character is ISO-LATIN-1 white
1.6469 + * space; {@code false} otherwise.
1.6470 + * @see Character#isSpaceChar(char)
1.6471 + * @see Character#isWhitespace(char)
1.6472 + * @deprecated Replaced by isWhitespace(char).
1.6473 + */
1.6474 + @Deprecated
1.6475 + public static boolean isSpace(char ch) {
1.6476 + return (ch <= 0x0020) &&
1.6477 + (((((1L << 0x0009) |
1.6478 + (1L << 0x000A) |
1.6479 + (1L << 0x000C) |
1.6480 + (1L << 0x000D) |
1.6481 + (1L << 0x0020)) >> ch) & 1L) != 0);
1.6482 + }
1.6483 +
1.6484 +
1.6485 + /**
1.6486 + * Determines if the specified character is a Unicode space character.
1.6487 + * A character is considered to be a space character if and only if
1.6488 + * it is specified to be a space character by the Unicode Standard. This
1.6489 + * method returns true if the character's general category type is any of
1.6490 + * the following:
1.6491 + * <ul>
1.6492 + * <li> {@code SPACE_SEPARATOR}
1.6493 + * <li> {@code LINE_SEPARATOR}
1.6494 + * <li> {@code PARAGRAPH_SEPARATOR}
1.6495 + * </ul>
1.6496 + *
1.6497 + * <p><b>Note:</b> This method cannot handle <a
1.6498 + * href="#supplementary"> supplementary characters</a>. To support
1.6499 + * all Unicode characters, including supplementary characters, use
1.6500 + * the {@link #isSpaceChar(int)} method.
1.6501 + *
1.6502 + * @param ch the character to be tested.
1.6503 + * @return {@code true} if the character is a space character;
1.6504 + * {@code false} otherwise.
1.6505 + * @see Character#isWhitespace(char)
1.6506 + * @since 1.1
1.6507 + */
1.6508 + public static boolean isSpaceChar(char ch) {
1.6509 + return isSpaceChar((int)ch);
1.6510 + }
1.6511 +
1.6512 + /**
1.6513 + * Determines if the specified character (Unicode code point) is a
1.6514 + * Unicode space character. A character is considered to be a
1.6515 + * space character if and only if it is specified to be a space
1.6516 + * character by the Unicode Standard. This method returns true if
1.6517 + * the character's general category type is any of the following:
1.6518 + *
1.6519 + * <ul>
1.6520 + * <li> {@link #SPACE_SEPARATOR}
1.6521 + * <li> {@link #LINE_SEPARATOR}
1.6522 + * <li> {@link #PARAGRAPH_SEPARATOR}
1.6523 + * </ul>
1.6524 + *
1.6525 + * @param codePoint the character (Unicode code point) to be tested.
1.6526 + * @return {@code true} if the character is a space character;
1.6527 + * {@code false} otherwise.
1.6528 + * @see Character#isWhitespace(int)
1.6529 + * @since 1.5
1.6530 + */
1.6531 + public static boolean isSpaceChar(int codePoint) {
1.6532 + return ((((1 << Character.SPACE_SEPARATOR) |
1.6533 + (1 << Character.LINE_SEPARATOR) |
1.6534 + (1 << Character.PARAGRAPH_SEPARATOR)) >> getType(codePoint)) & 1)
1.6535 + != 0;
1.6536 + }
1.6537 +
1.6538 + /**
1.6539 + * Determines if the specified character is white space according to Java.
1.6540 + * A character is a Java whitespace character if and only if it satisfies
1.6541 + * one of the following criteria:
1.6542 + * <ul>
1.6543 + * <li> It is a Unicode space character ({@code SPACE_SEPARATOR},
1.6544 + * {@code LINE_SEPARATOR}, or {@code PARAGRAPH_SEPARATOR})
1.6545 + * but is not also a non-breaking space ({@code '\u005Cu00A0'},
1.6546 + * {@code '\u005Cu2007'}, {@code '\u005Cu202F'}).
1.6547 + * <li> It is {@code '\u005Ct'}, U+0009 HORIZONTAL TABULATION.
1.6548 + * <li> It is {@code '\u005Cn'}, U+000A LINE FEED.
1.6549 + * <li> It is {@code '\u005Cu000B'}, U+000B VERTICAL TABULATION.
1.6550 + * <li> It is {@code '\u005Cf'}, U+000C FORM FEED.
1.6551 + * <li> It is {@code '\u005Cr'}, U+000D CARRIAGE RETURN.
1.6552 + * <li> It is {@code '\u005Cu001C'}, U+001C FILE SEPARATOR.
1.6553 + * <li> It is {@code '\u005Cu001D'}, U+001D GROUP SEPARATOR.
1.6554 + * <li> It is {@code '\u005Cu001E'}, U+001E RECORD SEPARATOR.
1.6555 + * <li> It is {@code '\u005Cu001F'}, U+001F UNIT SEPARATOR.
1.6556 + * </ul>
1.6557 + *
1.6558 + * <p><b>Note:</b> This method cannot handle <a
1.6559 + * href="#supplementary"> supplementary characters</a>. To support
1.6560 + * all Unicode characters, including supplementary characters, use
1.6561 + * the {@link #isWhitespace(int)} method.
1.6562 + *
1.6563 + * @param ch the character to be tested.
1.6564 + * @return {@code true} if the character is a Java whitespace
1.6565 + * character; {@code false} otherwise.
1.6566 + * @see Character#isSpaceChar(char)
1.6567 + * @since 1.1
1.6568 + */
1.6569 + public static boolean isWhitespace(char ch) {
1.6570 + return isWhitespace((int)ch);
1.6571 + }
1.6572 +
1.6573 + /**
1.6574 + * Determines if the specified character (Unicode code point) is
1.6575 + * white space according to Java. A character is a Java
1.6576 + * whitespace character if and only if it satisfies one of the
1.6577 + * following criteria:
1.6578 + * <ul>
1.6579 + * <li> It is a Unicode space character ({@link #SPACE_SEPARATOR},
1.6580 + * {@link #LINE_SEPARATOR}, or {@link #PARAGRAPH_SEPARATOR})
1.6581 + * but is not also a non-breaking space ({@code '\u005Cu00A0'},
1.6582 + * {@code '\u005Cu2007'}, {@code '\u005Cu202F'}).
1.6583 + * <li> It is {@code '\u005Ct'}, U+0009 HORIZONTAL TABULATION.
1.6584 + * <li> It is {@code '\u005Cn'}, U+000A LINE FEED.
1.6585 + * <li> It is {@code '\u005Cu000B'}, U+000B VERTICAL TABULATION.
1.6586 + * <li> It is {@code '\u005Cf'}, U+000C FORM FEED.
1.6587 + * <li> It is {@code '\u005Cr'}, U+000D CARRIAGE RETURN.
1.6588 + * <li> It is {@code '\u005Cu001C'}, U+001C FILE SEPARATOR.
1.6589 + * <li> It is {@code '\u005Cu001D'}, U+001D GROUP SEPARATOR.
1.6590 + * <li> It is {@code '\u005Cu001E'}, U+001E RECORD SEPARATOR.
1.6591 + * <li> It is {@code '\u005Cu001F'}, U+001F UNIT SEPARATOR.
1.6592 + * </ul>
1.6593 + * <p>
1.6594 + *
1.6595 + * @param codePoint the character (Unicode code point) to be tested.
1.6596 + * @return {@code true} if the character is a Java whitespace
1.6597 + * character; {@code false} otherwise.
1.6598 + * @see Character#isSpaceChar(int)
1.6599 + * @since 1.5
1.6600 + */
1.6601 + public static boolean isWhitespace(int codePoint) {
1.6602 + return CharacterData.of(codePoint).isWhitespace(codePoint);
1.6603 + }
1.6604 +
1.6605 + /**
1.6606 + * Determines if the specified character is an ISO control
1.6607 + * character. A character is considered to be an ISO control
1.6608 + * character if its code is in the range {@code '\u005Cu0000'}
1.6609 + * through {@code '\u005Cu001F'} or in the range
1.6610 + * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
1.6611 + *
1.6612 + * <p><b>Note:</b> This method cannot handle <a
1.6613 + * href="#supplementary"> supplementary characters</a>. To support
1.6614 + * all Unicode characters, including supplementary characters, use
1.6615 + * the {@link #isISOControl(int)} method.
1.6616 + *
1.6617 + * @param ch the character to be tested.
1.6618 + * @return {@code true} if the character is an ISO control character;
1.6619 + * {@code false} otherwise.
1.6620 + *
1.6621 + * @see Character#isSpaceChar(char)
1.6622 + * @see Character#isWhitespace(char)
1.6623 + * @since 1.1
1.6624 + */
1.6625 + public static boolean isISOControl(char ch) {
1.6626 + return isISOControl((int)ch);
1.6627 + }
1.6628 +
1.6629 + /**
1.6630 + * Determines if the referenced character (Unicode code point) is an ISO control
1.6631 + * character. A character is considered to be an ISO control
1.6632 + * character if its code is in the range {@code '\u005Cu0000'}
1.6633 + * through {@code '\u005Cu001F'} or in the range
1.6634 + * {@code '\u005Cu007F'} through {@code '\u005Cu009F'}.
1.6635 + *
1.6636 + * @param codePoint the character (Unicode code point) to be tested.
1.6637 + * @return {@code true} if the character is an ISO control character;
1.6638 + * {@code false} otherwise.
1.6639 + * @see Character#isSpaceChar(int)
1.6640 + * @see Character#isWhitespace(int)
1.6641 + * @since 1.5
1.6642 + */
1.6643 + public static boolean isISOControl(int codePoint) {
1.6644 + // Optimized form of:
1.6645 + // (codePoint >= 0x00 && codePoint <= 0x1F) ||
1.6646 + // (codePoint >= 0x7F && codePoint <= 0x9F);
1.6647 + return codePoint <= 0x9F &&
1.6648 + (codePoint >= 0x7F || (codePoint >>> 5 == 0));
1.6649 + }
1.6650 +
1.6651 + /**
1.6652 + * Returns a value indicating a character's general category.
1.6653 + *
1.6654 + * <p><b>Note:</b> This method cannot handle <a
1.6655 + * href="#supplementary"> supplementary characters</a>. To support
1.6656 + * all Unicode characters, including supplementary characters, use
1.6657 + * the {@link #getType(int)} method.
1.6658 + *
1.6659 + * @param ch the character to be tested.
1.6660 + * @return a value of type {@code int} representing the
1.6661 + * character's general category.
1.6662 + * @see Character#COMBINING_SPACING_MARK
1.6663 + * @see Character#CONNECTOR_PUNCTUATION
1.6664 + * @see Character#CONTROL
1.6665 + * @see Character#CURRENCY_SYMBOL
1.6666 + * @see Character#DASH_PUNCTUATION
1.6667 + * @see Character#DECIMAL_DIGIT_NUMBER
1.6668 + * @see Character#ENCLOSING_MARK
1.6669 + * @see Character#END_PUNCTUATION
1.6670 + * @see Character#FINAL_QUOTE_PUNCTUATION
1.6671 + * @see Character#FORMAT
1.6672 + * @see Character#INITIAL_QUOTE_PUNCTUATION
1.6673 + * @see Character#LETTER_NUMBER
1.6674 + * @see Character#LINE_SEPARATOR
1.6675 + * @see Character#LOWERCASE_LETTER
1.6676 + * @see Character#MATH_SYMBOL
1.6677 + * @see Character#MODIFIER_LETTER
1.6678 + * @see Character#MODIFIER_SYMBOL
1.6679 + * @see Character#NON_SPACING_MARK
1.6680 + * @see Character#OTHER_LETTER
1.6681 + * @see Character#OTHER_NUMBER
1.6682 + * @see Character#OTHER_PUNCTUATION
1.6683 + * @see Character#OTHER_SYMBOL
1.6684 + * @see Character#PARAGRAPH_SEPARATOR
1.6685 + * @see Character#PRIVATE_USE
1.6686 + * @see Character#SPACE_SEPARATOR
1.6687 + * @see Character#START_PUNCTUATION
1.6688 + * @see Character#SURROGATE
1.6689 + * @see Character#TITLECASE_LETTER
1.6690 + * @see Character#UNASSIGNED
1.6691 + * @see Character#UPPERCASE_LETTER
1.6692 + * @since 1.1
1.6693 + */
1.6694 + public static int getType(char ch) {
1.6695 + return getType((int)ch);
1.6696 + }
1.6697 +
1.6698 + /**
1.6699 + * Returns a value indicating a character's general category.
1.6700 + *
1.6701 + * @param codePoint the character (Unicode code point) to be tested.
1.6702 + * @return a value of type {@code int} representing the
1.6703 + * character's general category.
1.6704 + * @see Character#COMBINING_SPACING_MARK COMBINING_SPACING_MARK
1.6705 + * @see Character#CONNECTOR_PUNCTUATION CONNECTOR_PUNCTUATION
1.6706 + * @see Character#CONTROL CONTROL
1.6707 + * @see Character#CURRENCY_SYMBOL CURRENCY_SYMBOL
1.6708 + * @see Character#DASH_PUNCTUATION DASH_PUNCTUATION
1.6709 + * @see Character#DECIMAL_DIGIT_NUMBER DECIMAL_DIGIT_NUMBER
1.6710 + * @see Character#ENCLOSING_MARK ENCLOSING_MARK
1.6711 + * @see Character#END_PUNCTUATION END_PUNCTUATION
1.6712 + * @see Character#FINAL_QUOTE_PUNCTUATION FINAL_QUOTE_PUNCTUATION
1.6713 + * @see Character#FORMAT FORMAT
1.6714 + * @see Character#INITIAL_QUOTE_PUNCTUATION INITIAL_QUOTE_PUNCTUATION
1.6715 + * @see Character#LETTER_NUMBER LETTER_NUMBER
1.6716 + * @see Character#LINE_SEPARATOR LINE_SEPARATOR
1.6717 + * @see Character#LOWERCASE_LETTER LOWERCASE_LETTER
1.6718 + * @see Character#MATH_SYMBOL MATH_SYMBOL
1.6719 + * @see Character#MODIFIER_LETTER MODIFIER_LETTER
1.6720 + * @see Character#MODIFIER_SYMBOL MODIFIER_SYMBOL
1.6721 + * @see Character#NON_SPACING_MARK NON_SPACING_MARK
1.6722 + * @see Character#OTHER_LETTER OTHER_LETTER
1.6723 + * @see Character#OTHER_NUMBER OTHER_NUMBER
1.6724 + * @see Character#OTHER_PUNCTUATION OTHER_PUNCTUATION
1.6725 + * @see Character#OTHER_SYMBOL OTHER_SYMBOL
1.6726 + * @see Character#PARAGRAPH_SEPARATOR PARAGRAPH_SEPARATOR
1.6727 + * @see Character#PRIVATE_USE PRIVATE_USE
1.6728 + * @see Character#SPACE_SEPARATOR SPACE_SEPARATOR
1.6729 + * @see Character#START_PUNCTUATION START_PUNCTUATION
1.6730 + * @see Character#SURROGATE SURROGATE
1.6731 + * @see Character#TITLECASE_LETTER TITLECASE_LETTER
1.6732 + * @see Character#UNASSIGNED UNASSIGNED
1.6733 + * @see Character#UPPERCASE_LETTER UPPERCASE_LETTER
1.6734 + * @since 1.5
1.6735 + */
1.6736 + public static int getType(int codePoint) {
1.6737 + return CharacterData.of(codePoint).getType(codePoint);
1.6738 + }
1.6739 +
1.6740 + /**
1.6741 + * Determines the character representation for a specific digit in
1.6742 + * the specified radix. If the value of {@code radix} is not a
1.6743 + * valid radix, or the value of {@code digit} is not a valid
1.6744 + * digit in the specified radix, the null character
1.6745 + * ({@code '\u005Cu0000'}) is returned.
1.6746 + * <p>
1.6747 + * The {@code radix} argument is valid if it is greater than or
1.6748 + * equal to {@code MIN_RADIX} and less than or equal to
1.6749 + * {@code MAX_RADIX}. The {@code digit} argument is valid if
1.6750 + * {@code 0 <= digit < radix}.
1.6751 + * <p>
1.6752 + * If the digit is less than 10, then
1.6753 + * {@code '0' + digit} is returned. Otherwise, the value
1.6754 + * {@code 'a' + digit - 10} is returned.
1.6755 + *
1.6756 + * @param digit the number to convert to a character.
1.6757 + * @param radix the radix.
1.6758 + * @return the {@code char} representation of the specified digit
1.6759 + * in the specified radix.
1.6760 + * @see Character#MIN_RADIX
1.6761 + * @see Character#MAX_RADIX
1.6762 + * @see Character#digit(char, int)
1.6763 + */
1.6764 + public static char forDigit(int digit, int radix) {
1.6765 + if ((digit >= radix) || (digit < 0)) {
1.6766 + return '\0';
1.6767 + }
1.6768 + if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX)) {
1.6769 + return '\0';
1.6770 + }
1.6771 + if (digit < 10) {
1.6772 + return (char)('0' + digit);
1.6773 + }
1.6774 + return (char)('a' - 10 + digit);
1.6775 + }
1.6776 +
1.6777 + /**
1.6778 + * Returns the Unicode directionality property for the given
1.6779 + * character. Character directionality is used to calculate the
1.6780 + * visual ordering of text. The directionality value of undefined
1.6781 + * {@code char} values is {@code DIRECTIONALITY_UNDEFINED}.
1.6782 + *
1.6783 + * <p><b>Note:</b> This method cannot handle <a
1.6784 + * href="#supplementary"> supplementary characters</a>. To support
1.6785 + * all Unicode characters, including supplementary characters, use
1.6786 + * the {@link #getDirectionality(int)} method.
1.6787 + *
1.6788 + * @param ch {@code char} for which the directionality property
1.6789 + * is requested.
1.6790 + * @return the directionality property of the {@code char} value.
1.6791 + *
1.6792 + * @see Character#DIRECTIONALITY_UNDEFINED
1.6793 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT
1.6794 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT
1.6795 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
1.6796 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER
1.6797 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
1.6798 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
1.6799 + * @see Character#DIRECTIONALITY_ARABIC_NUMBER
1.6800 + * @see Character#DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
1.6801 + * @see Character#DIRECTIONALITY_NONSPACING_MARK
1.6802 + * @see Character#DIRECTIONALITY_BOUNDARY_NEUTRAL
1.6803 + * @see Character#DIRECTIONALITY_PARAGRAPH_SEPARATOR
1.6804 + * @see Character#DIRECTIONALITY_SEGMENT_SEPARATOR
1.6805 + * @see Character#DIRECTIONALITY_WHITESPACE
1.6806 + * @see Character#DIRECTIONALITY_OTHER_NEUTRALS
1.6807 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
1.6808 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
1.6809 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
1.6810 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
1.6811 + * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
1.6812 + * @since 1.4
1.6813 + */
1.6814 + public static byte getDirectionality(char ch) {
1.6815 + return getDirectionality((int)ch);
1.6816 + }
1.6817 +
1.6818 + /**
1.6819 + * Returns the Unicode directionality property for the given
1.6820 + * character (Unicode code point). Character directionality is
1.6821 + * used to calculate the visual ordering of text. The
1.6822 + * directionality value of undefined character is {@link
1.6823 + * #DIRECTIONALITY_UNDEFINED}.
1.6824 + *
1.6825 + * @param codePoint the character (Unicode code point) for which
1.6826 + * the directionality property is requested.
1.6827 + * @return the directionality property of the character.
1.6828 + *
1.6829 + * @see Character#DIRECTIONALITY_UNDEFINED DIRECTIONALITY_UNDEFINED
1.6830 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT DIRECTIONALITY_LEFT_TO_RIGHT
1.6831 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT DIRECTIONALITY_RIGHT_TO_LEFT
1.6832 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC
1.6833 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER DIRECTIONALITY_EUROPEAN_NUMBER
1.6834 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
1.6835 + * @see Character#DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
1.6836 + * @see Character#DIRECTIONALITY_ARABIC_NUMBER DIRECTIONALITY_ARABIC_NUMBER
1.6837 + * @see Character#DIRECTIONALITY_COMMON_NUMBER_SEPARATOR DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
1.6838 + * @see Character#DIRECTIONALITY_NONSPACING_MARK DIRECTIONALITY_NONSPACING_MARK
1.6839 + * @see Character#DIRECTIONALITY_BOUNDARY_NEUTRAL DIRECTIONALITY_BOUNDARY_NEUTRAL
1.6840 + * @see Character#DIRECTIONALITY_PARAGRAPH_SEPARATOR DIRECTIONALITY_PARAGRAPH_SEPARATOR
1.6841 + * @see Character#DIRECTIONALITY_SEGMENT_SEPARATOR DIRECTIONALITY_SEGMENT_SEPARATOR
1.6842 + * @see Character#DIRECTIONALITY_WHITESPACE DIRECTIONALITY_WHITESPACE
1.6843 + * @see Character#DIRECTIONALITY_OTHER_NEUTRALS DIRECTIONALITY_OTHER_NEUTRALS
1.6844 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING
1.6845 + * @see Character#DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE
1.6846 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING
1.6847 + * @see Character#DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE
1.6848 + * @see Character#DIRECTIONALITY_POP_DIRECTIONAL_FORMAT DIRECTIONALITY_POP_DIRECTIONAL_FORMAT
1.6849 + * @since 1.5
1.6850 + */
1.6851 + public static byte getDirectionality(int codePoint) {
1.6852 + return CharacterData.of(codePoint).getDirectionality(codePoint);
1.6853 + }
1.6854 +
1.6855 + /**
1.6856 + * Determines whether the character is mirrored according to the
1.6857 + * Unicode specification. Mirrored characters should have their
1.6858 + * glyphs horizontally mirrored when displayed in text that is
1.6859 + * right-to-left. For example, {@code '\u005Cu0028'} LEFT
1.6860 + * PARENTHESIS is semantically defined to be an <i>opening
1.6861 + * parenthesis</i>. This will appear as a "(" in text that is
1.6862 + * left-to-right but as a ")" in text that is right-to-left.
1.6863 + *
1.6864 + * <p><b>Note:</b> This method cannot handle <a
1.6865 + * href="#supplementary"> supplementary characters</a>. To support
1.6866 + * all Unicode characters, including supplementary characters, use
1.6867 + * the {@link #isMirrored(int)} method.
1.6868 + *
1.6869 + * @param ch {@code char} for which the mirrored property is requested
1.6870 + * @return {@code true} if the char is mirrored, {@code false}
1.6871 + * if the {@code char} is not mirrored or is not defined.
1.6872 + * @since 1.4
1.6873 + */
1.6874 + public static boolean isMirrored(char ch) {
1.6875 + return isMirrored((int)ch);
1.6876 + }
1.6877 +
1.6878 + /**
1.6879 + * Determines whether the specified character (Unicode code point)
1.6880 + * is mirrored according to the Unicode specification. Mirrored
1.6881 + * characters should have their glyphs horizontally mirrored when
1.6882 + * displayed in text that is right-to-left. For example,
1.6883 + * {@code '\u005Cu0028'} LEFT PARENTHESIS is semantically
1.6884 + * defined to be an <i>opening parenthesis</i>. This will appear
1.6885 + * as a "(" in text that is left-to-right but as a ")" in text
1.6886 + * that is right-to-left.
1.6887 + *
1.6888 + * @param codePoint the character (Unicode code point) to be tested.
1.6889 + * @return {@code true} if the character is mirrored, {@code false}
1.6890 + * if the character is not mirrored or is not defined.
1.6891 + * @since 1.5
1.6892 + */
1.6893 + public static boolean isMirrored(int codePoint) {
1.6894 + return CharacterData.of(codePoint).isMirrored(codePoint);
1.6895 + }
1.6896 +
1.6897 + /**
1.6898 + * Compares two {@code Character} objects numerically.
1.6899 + *
1.6900 + * @param anotherCharacter the {@code Character} to be compared.
1.6901 +
1.6902 + * @return the value {@code 0} if the argument {@code Character}
1.6903 + * is equal to this {@code Character}; a value less than
1.6904 + * {@code 0} if this {@code Character} is numerically less
1.6905 + * than the {@code Character} argument; and a value greater than
1.6906 + * {@code 0} if this {@code Character} is numerically greater
1.6907 + * than the {@code Character} argument (unsigned comparison).
1.6908 + * Note that this is strictly a numerical comparison; it is not
1.6909 + * locale-dependent.
1.6910 + * @since 1.2
1.6911 + */
1.6912 + public int compareTo(Character anotherCharacter) {
1.6913 + return compare(this.value, anotherCharacter.value);
1.6914 + }
1.6915 +
1.6916 + /**
1.6917 + * Compares two {@code char} values numerically.
1.6918 + * The value returned is identical to what would be returned by:
1.6919 + * <pre>
1.6920 + * Character.valueOf(x).compareTo(Character.valueOf(y))
1.6921 + * </pre>
1.6922 + *
1.6923 + * @param x the first {@code char} to compare
1.6924 + * @param y the second {@code char} to compare
1.6925 + * @return the value {@code 0} if {@code x == y};
1.6926 + * a value less than {@code 0} if {@code x < y}; and
1.6927 + * a value greater than {@code 0} if {@code x > y}
1.6928 + * @since 1.7
1.6929 + */
1.6930 + public static int compare(char x, char y) {
1.6931 + return x - y;
1.6932 + }
1.6933 +
1.6934 + /**
1.6935 + * Converts the character (Unicode code point) argument to uppercase using
1.6936 + * information from the UnicodeData file.
1.6937 + * <p>
1.6938 + *
1.6939 + * @param codePoint the character (Unicode code point) to be converted.
1.6940 + * @return either the uppercase equivalent of the character, if
1.6941 + * any, or an error flag ({@code Character.ERROR})
1.6942 + * that indicates that a 1:M {@code char} mapping exists.
1.6943 + * @see Character#isLowerCase(char)
1.6944 + * @see Character#isUpperCase(char)
1.6945 + * @see Character#toLowerCase(char)
1.6946 + * @see Character#toTitleCase(char)
1.6947 + * @since 1.4
1.6948 + */
1.6949 + static int toUpperCaseEx(int codePoint) {
1.6950 + assert isValidCodePoint(codePoint);
1.6951 + return CharacterData.of(codePoint).toUpperCaseEx(codePoint);
1.6952 + }
1.6953 +
1.6954 + /**
1.6955 + * Converts the character (Unicode code point) argument to uppercase using case
1.6956 + * mapping information from the SpecialCasing file in the Unicode
1.6957 + * specification. If a character has no explicit uppercase
1.6958 + * mapping, then the {@code char} itself is returned in the
1.6959 + * {@code char[]}.
1.6960 + *
1.6961 + * @param codePoint the character (Unicode code point) to be converted.
1.6962 + * @return a {@code char[]} with the uppercased character.
1.6963 + * @since 1.4
1.6964 + */
1.6965 + static char[] toUpperCaseCharArray(int codePoint) {
1.6966 + // As of Unicode 6.0, 1:M uppercasings only happen in the BMP.
1.6967 + assert isBmpCodePoint(codePoint);
1.6968 + return CharacterData.of(codePoint).toUpperCaseCharArray(codePoint);
1.6969 + }
1.6970 +
1.6971 + /**
1.6972 + * The number of bits used to represent a <tt>char</tt> value in unsigned
1.6973 + * binary form, constant {@code 16}.
1.6974 + *
1.6975 + * @since 1.5
1.6976 + */
1.6977 + public static final int SIZE = 16;
1.6978 +
1.6979 + /**
1.6980 + * Returns the value obtained by reversing the order of the bytes in the
1.6981 + * specified <tt>char</tt> value.
1.6982 + *
1.6983 + * @return the value obtained by reversing (or, equivalently, swapping)
1.6984 + * the bytes in the specified <tt>char</tt> value.
1.6985 + * @since 1.5
1.6986 + */
1.6987 + public static char reverseBytes(char ch) {
1.6988 + return (char) (((ch & 0xFF00) >> 8) | (ch << 8));
1.6989 + }
1.6990 +
1.6991 + /**
1.6992 + * Returns the Unicode name of the specified character
1.6993 + * {@code codePoint}, or null if the code point is
1.6994 + * {@link #UNASSIGNED unassigned}.
1.6995 + * <p>
1.6996 + * Note: if the specified character is not assigned a name by
1.6997 + * the <i>UnicodeData</i> file (part of the Unicode Character
1.6998 + * Database maintained by the Unicode Consortium), the returned
1.6999 + * name is the same as the result of expression.
1.7000 + *
1.7001 + * <blockquote>{@code
1.7002 + * Character.UnicodeBlock.of(codePoint).toString().replace('_', ' ')
1.7003 + * + " "
1.7004 + * + Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH);
1.7005 + *
1.7006 + * }</blockquote>
1.7007 + *
1.7008 + * @param codePoint the character (Unicode code point)
1.7009 + *
1.7010 + * @return the Unicode name of the specified character, or null if
1.7011 + * the code point is unassigned.
1.7012 + *
1.7013 + * @exception IllegalArgumentException if the specified
1.7014 + * {@code codePoint} is not a valid Unicode
1.7015 + * code point.
1.7016 + *
1.7017 + * @since 1.7
1.7018 + */
1.7019 + public static String getName(int codePoint) {
1.7020 + if (!isValidCodePoint(codePoint)) {
1.7021 + throw new IllegalArgumentException();
1.7022 + }
1.7023 + String name = CharacterName.get(codePoint);
1.7024 + if (name != null)
1.7025 + return name;
1.7026 + if (getType(codePoint) == UNASSIGNED)
1.7027 + return null;
1.7028 + UnicodeBlock block = UnicodeBlock.of(codePoint);
1.7029 + if (block != null)
1.7030 + return block.toString().replace('_', ' ') + " "
1.7031 + + Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH);
1.7032 + // should never come here
1.7033 + return Integer.toHexString(codePoint).toUpperCase(Locale.ENGLISH);
1.7034 + }
1.7035 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/emul/src/main/java/java/lang/ClassCastException.java Sat Sep 29 11:01:22 2012 +0200
2.3 @@ -0,0 +1,60 @@
2.4 +/*
2.5 + * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2.7 + *
2.8 + * This code is free software; you can redistribute it and/or modify it
2.9 + * under the terms of the GNU General Public License version 2 only, as
2.10 + * published by the Free Software Foundation. Oracle designates this
2.11 + * particular file as subject to the "Classpath" exception as provided
2.12 + * by Oracle in the LICENSE file that accompanied this code.
2.13 + *
2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2.17 + * version 2 for more details (a copy is included in the LICENSE file that
2.18 + * accompanied this code).
2.19 + *
2.20 + * You should have received a copy of the GNU General Public License version
2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2.23 + *
2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2.25 + * or visit www.oracle.com if you need additional information or have any
2.26 + * questions.
2.27 + */
2.28 +
2.29 +package java.lang;
2.30 +
2.31 +/**
2.32 + * Thrown to indicate that the code has attempted to cast an object
2.33 + * to a subclass of which it is not an instance. For example, the
2.34 + * following code generates a <code>ClassCastException</code>:
2.35 + * <p><blockquote><pre>
2.36 + * Object x = new Integer(0);
2.37 + * System.out.println((String)x);
2.38 + * </pre></blockquote>
2.39 + *
2.40 + * @author unascribed
2.41 + * @since JDK1.0
2.42 + */
2.43 +public
2.44 +class ClassCastException extends RuntimeException {
2.45 + private static final long serialVersionUID = -9223365651070458532L;
2.46 +
2.47 + /**
2.48 + * Constructs a <code>ClassCastException</code> with no detail message.
2.49 + */
2.50 + public ClassCastException() {
2.51 + super();
2.52 + }
2.53 +
2.54 + /**
2.55 + * Constructs a <code>ClassCastException</code> with the specified
2.56 + * detail message.
2.57 + *
2.58 + * @param s the detail message.
2.59 + */
2.60 + public ClassCastException(String s) {
2.61 + super(s);
2.62 + }
2.63 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/emul/src/main/java/java/lang/Enum.java Sat Sep 29 11:01:22 2012 +0200
3.3 @@ -0,0 +1,256 @@
3.4 +/*
3.5 + * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3.7 + *
3.8 + * This code is free software; you can redistribute it and/or modify it
3.9 + * under the terms of the GNU General Public License version 2 only, as
3.10 + * published by the Free Software Foundation. Oracle designates this
3.11 + * particular file as subject to the "Classpath" exception as provided
3.12 + * by Oracle in the LICENSE file that accompanied this code.
3.13 + *
3.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
3.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3.17 + * version 2 for more details (a copy is included in the LICENSE file that
3.18 + * accompanied this code).
3.19 + *
3.20 + * You should have received a copy of the GNU General Public License version
3.21 + * 2 along with this work; if not, write to the Free Software Foundation,
3.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3.23 + *
3.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3.25 + * or visit www.oracle.com if you need additional information or have any
3.26 + * questions.
3.27 + */
3.28 +
3.29 +package java.lang;
3.30 +
3.31 +import java.io.Serializable;
3.32 +import java.io.IOException;
3.33 +import java.io.InvalidObjectException;
3.34 +import java.io.ObjectInputStream;
3.35 +import java.io.ObjectStreamException;
3.36 +
3.37 +/**
3.38 + * This is the common base class of all Java language enumeration types.
3.39 + *
3.40 + * More information about enums, including descriptions of the
3.41 + * implicitly declared methods synthesized by the compiler, can be
3.42 + * found in section 8.9 of
3.43 + * <cite>The Java™ Language Specification</cite>.
3.44 + *
3.45 + * <p> Note that when using an enumeration type as the type of a set
3.46 + * or as the type of the keys in a map, specialized and efficient
3.47 + * {@linkplain java.util.EnumSet set} and {@linkplain
3.48 + * java.util.EnumMap map} implementations are available.
3.49 + *
3.50 + * @param <E> The enum type subclass
3.51 + * @author Josh Bloch
3.52 + * @author Neal Gafter
3.53 + * @see Class#getEnumConstants()
3.54 + * @see java.util.EnumSet
3.55 + * @see java.util.EnumMap
3.56 + * @since 1.5
3.57 + */
3.58 +public abstract class Enum<E extends Enum<E>>
3.59 + implements Comparable<E>, Serializable {
3.60 + /**
3.61 + * The name of this enum constant, as declared in the enum declaration.
3.62 + * Most programmers should use the {@link #toString} method rather than
3.63 + * accessing this field.
3.64 + */
3.65 + private final String name;
3.66 +
3.67 + /**
3.68 + * Returns the name of this enum constant, exactly as declared in its
3.69 + * enum declaration.
3.70 + *
3.71 + * <b>Most programmers should use the {@link #toString} method in
3.72 + * preference to this one, as the toString method may return
3.73 + * a more user-friendly name.</b> This method is designed primarily for
3.74 + * use in specialized situations where correctness depends on getting the
3.75 + * exact name, which will not vary from release to release.
3.76 + *
3.77 + * @return the name of this enum constant
3.78 + */
3.79 + public final String name() {
3.80 + return name;
3.81 + }
3.82 +
3.83 + /**
3.84 + * The ordinal of this enumeration constant (its position
3.85 + * in the enum declaration, where the initial constant is assigned
3.86 + * an ordinal of zero).
3.87 + *
3.88 + * Most programmers will have no use for this field. It is designed
3.89 + * for use by sophisticated enum-based data structures, such as
3.90 + * {@link java.util.EnumSet} and {@link java.util.EnumMap}.
3.91 + */
3.92 + private final int ordinal;
3.93 +
3.94 + /**
3.95 + * Returns the ordinal of this enumeration constant (its position
3.96 + * in its enum declaration, where the initial constant is assigned
3.97 + * an ordinal of zero).
3.98 + *
3.99 + * Most programmers will have no use for this method. It is
3.100 + * designed for use by sophisticated enum-based data structures, such
3.101 + * as {@link java.util.EnumSet} and {@link java.util.EnumMap}.
3.102 + *
3.103 + * @return the ordinal of this enumeration constant
3.104 + */
3.105 + public final int ordinal() {
3.106 + return ordinal;
3.107 + }
3.108 +
3.109 + /**
3.110 + * Sole constructor. Programmers cannot invoke this constructor.
3.111 + * It is for use by code emitted by the compiler in response to
3.112 + * enum type declarations.
3.113 + *
3.114 + * @param name - The name of this enum constant, which is the identifier
3.115 + * used to declare it.
3.116 + * @param ordinal - The ordinal of this enumeration constant (its position
3.117 + * in the enum declaration, where the initial constant is assigned
3.118 + * an ordinal of zero).
3.119 + */
3.120 + protected Enum(String name, int ordinal) {
3.121 + this.name = name;
3.122 + this.ordinal = ordinal;
3.123 + }
3.124 +
3.125 + /**
3.126 + * Returns the name of this enum constant, as contained in the
3.127 + * declaration. This method may be overridden, though it typically
3.128 + * isn't necessary or desirable. An enum type should override this
3.129 + * method when a more "programmer-friendly" string form exists.
3.130 + *
3.131 + * @return the name of this enum constant
3.132 + */
3.133 + public String toString() {
3.134 + return name;
3.135 + }
3.136 +
3.137 + /**
3.138 + * Returns true if the specified object is equal to this
3.139 + * enum constant.
3.140 + *
3.141 + * @param other the object to be compared for equality with this object.
3.142 + * @return true if the specified object is equal to this
3.143 + * enum constant.
3.144 + */
3.145 + public final boolean equals(Object other) {
3.146 + return this==other;
3.147 + }
3.148 +
3.149 + /**
3.150 + * Returns a hash code for this enum constant.
3.151 + *
3.152 + * @return a hash code for this enum constant.
3.153 + */
3.154 + public final int hashCode() {
3.155 + return super.hashCode();
3.156 + }
3.157 +
3.158 + /**
3.159 + * Throws CloneNotSupportedException. This guarantees that enums
3.160 + * are never cloned, which is necessary to preserve their "singleton"
3.161 + * status.
3.162 + *
3.163 + * @return (never returns)
3.164 + */
3.165 + protected final Object clone() throws CloneNotSupportedException {
3.166 + throw new CloneNotSupportedException();
3.167 + }
3.168 +
3.169 + /**
3.170 + * Compares this enum with the specified object for order. Returns a
3.171 + * negative integer, zero, or a positive integer as this object is less
3.172 + * than, equal to, or greater than the specified object.
3.173 + *
3.174 + * Enum constants are only comparable to other enum constants of the
3.175 + * same enum type. The natural order implemented by this
3.176 + * method is the order in which the constants are declared.
3.177 + */
3.178 + public final int compareTo(E o) {
3.179 + Enum other = (Enum)o;
3.180 + Enum self = this;
3.181 + if (self.getClass() != other.getClass() && // optimization
3.182 + self.getDeclaringClass() != other.getDeclaringClass())
3.183 + throw new ClassCastException();
3.184 + return self.ordinal - other.ordinal;
3.185 + }
3.186 +
3.187 + /**
3.188 + * Returns the Class object corresponding to this enum constant's
3.189 + * enum type. Two enum constants e1 and e2 are of the
3.190 + * same enum type if and only if
3.191 + * e1.getDeclaringClass() == e2.getDeclaringClass().
3.192 + * (The value returned by this method may differ from the one returned
3.193 + * by the {@link Object#getClass} method for enum constants with
3.194 + * constant-specific class bodies.)
3.195 + *
3.196 + * @return the Class object corresponding to this enum constant's
3.197 + * enum type
3.198 + */
3.199 + public final Class<E> getDeclaringClass() {
3.200 + Class clazz = getClass();
3.201 + Class zuper = clazz.getSuperclass();
3.202 + return (zuper == Enum.class) ? clazz : zuper;
3.203 + }
3.204 +
3.205 + /**
3.206 + * Returns the enum constant of the specified enum type with the
3.207 + * specified name. The name must match exactly an identifier used
3.208 + * to declare an enum constant in this type. (Extraneous whitespace
3.209 + * characters are not permitted.)
3.210 + *
3.211 + * <p>Note that for a particular enum type {@code T}, the
3.212 + * implicitly declared {@code public static T valueOf(String)}
3.213 + * method on that enum may be used instead of this method to map
3.214 + * from a name to the corresponding enum constant. All the
3.215 + * constants of an enum type can be obtained by calling the
3.216 + * implicit {@code public static T[] values()} method of that
3.217 + * type.
3.218 + *
3.219 + * @param <T> The enum type whose constant is to be returned
3.220 + * @param enumType the {@code Class} object of the enum type from which
3.221 + * to return a constant
3.222 + * @param name the name of the constant to return
3.223 + * @return the enum constant of the specified enum type with the
3.224 + * specified name
3.225 + * @throws IllegalArgumentException if the specified enum type has
3.226 + * no constant with the specified name, or the specified
3.227 + * class object does not represent an enum type
3.228 + * @throws NullPointerException if {@code enumType} or {@code name}
3.229 + * is null
3.230 + * @since 1.5
3.231 + */
3.232 + public static <T extends Enum<T>> T valueOf(Class<T> enumType,
3.233 + String name) {
3.234 + T result = enumType.enumConstantDirectory().get(name);
3.235 + if (result != null)
3.236 + return result;
3.237 + if (name == null)
3.238 + throw new NullPointerException("Name is null");
3.239 + throw new IllegalArgumentException(
3.240 + "No enum constant " + enumType.getCanonicalName() + "." + name);
3.241 + }
3.242 +
3.243 + /**
3.244 + * enum classes cannot have finalize methods.
3.245 + */
3.246 + protected final void finalize() { }
3.247 +
3.248 + /**
3.249 + * prevent default deserialization
3.250 + */
3.251 + private void readObject(ObjectInputStream in) throws IOException,
3.252 + ClassNotFoundException {
3.253 + throw new InvalidObjectException("can't deserialize enum");
3.254 + }
3.255 +
3.256 + private void readObjectNoData() throws ObjectStreamException {
3.257 + throw new InvalidObjectException("can't deserialize enum");
3.258 + }
3.259 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/emul/src/main/java/java/lang/IllegalAccessException.java Sat Sep 29 11:01:22 2012 +0200
4.3 @@ -0,0 +1,78 @@
4.4 +/*
4.5 + * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4.7 + *
4.8 + * This code is free software; you can redistribute it and/or modify it
4.9 + * under the terms of the GNU General Public License version 2 only, as
4.10 + * published by the Free Software Foundation. Oracle designates this
4.11 + * particular file as subject to the "Classpath" exception as provided
4.12 + * by Oracle in the LICENSE file that accompanied this code.
4.13 + *
4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4.17 + * version 2 for more details (a copy is included in the LICENSE file that
4.18 + * accompanied this code).
4.19 + *
4.20 + * You should have received a copy of the GNU General Public License version
4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4.23 + *
4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4.25 + * or visit www.oracle.com if you need additional information or have any
4.26 + * questions.
4.27 + */
4.28 +
4.29 +package java.lang;
4.30 +
4.31 +/**
4.32 + * An IllegalAccessException is thrown when an application tries
4.33 + * to reflectively create an instance (other than an array),
4.34 + * set or get a field, or invoke a method, but the currently
4.35 + * executing method does not have access to the definition of
4.36 + * the specified class, field, method or constructor.
4.37 + *
4.38 + * @author unascribed
4.39 + * @see Class#newInstance()
4.40 + * @see java.lang.reflect.Field#set(Object, Object)
4.41 + * @see java.lang.reflect.Field#setBoolean(Object, boolean)
4.42 + * @see java.lang.reflect.Field#setByte(Object, byte)
4.43 + * @see java.lang.reflect.Field#setShort(Object, short)
4.44 + * @see java.lang.reflect.Field#setChar(Object, char)
4.45 + * @see java.lang.reflect.Field#setInt(Object, int)
4.46 + * @see java.lang.reflect.Field#setLong(Object, long)
4.47 + * @see java.lang.reflect.Field#setFloat(Object, float)
4.48 + * @see java.lang.reflect.Field#setDouble(Object, double)
4.49 + * @see java.lang.reflect.Field#get(Object)
4.50 + * @see java.lang.reflect.Field#getBoolean(Object)
4.51 + * @see java.lang.reflect.Field#getByte(Object)
4.52 + * @see java.lang.reflect.Field#getShort(Object)
4.53 + * @see java.lang.reflect.Field#getChar(Object)
4.54 + * @see java.lang.reflect.Field#getInt(Object)
4.55 + * @see java.lang.reflect.Field#getLong(Object)
4.56 + * @see java.lang.reflect.Field#getFloat(Object)
4.57 + * @see java.lang.reflect.Field#getDouble(Object)
4.58 + * @see java.lang.reflect.Method#invoke(Object, Object[])
4.59 + * @see java.lang.reflect.Constructor#newInstance(Object[])
4.60 + * @since JDK1.0
4.61 + */
4.62 +public class IllegalAccessException extends ReflectiveOperationException {
4.63 + private static final long serialVersionUID = 6616958222490762034L;
4.64 +
4.65 + /**
4.66 + * Constructs an <code>IllegalAccessException</code> without a
4.67 + * detail message.
4.68 + */
4.69 + public IllegalAccessException() {
4.70 + super();
4.71 + }
4.72 +
4.73 + /**
4.74 + * Constructs an <code>IllegalAccessException</code> with a detail message.
4.75 + *
4.76 + * @param s the detail message.
4.77 + */
4.78 + public IllegalAccessException(String s) {
4.79 + super(s);
4.80 + }
4.81 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/emul/src/main/java/java/lang/NumberFormatException.java Sat Sep 29 11:01:22 2012 +0200
5.3 @@ -0,0 +1,67 @@
5.4 +/*
5.5 + * Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5.7 + *
5.8 + * This code is free software; you can redistribute it and/or modify it
5.9 + * under the terms of the GNU General Public License version 2 only, as
5.10 + * published by the Free Software Foundation. Oracle designates this
5.11 + * particular file as subject to the "Classpath" exception as provided
5.12 + * by Oracle in the LICENSE file that accompanied this code.
5.13 + *
5.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
5.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5.17 + * version 2 for more details (a copy is included in the LICENSE file that
5.18 + * accompanied this code).
5.19 + *
5.20 + * You should have received a copy of the GNU General Public License version
5.21 + * 2 along with this work; if not, write to the Free Software Foundation,
5.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5.23 + *
5.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5.25 + * or visit www.oracle.com if you need additional information or have any
5.26 + * questions.
5.27 + */
5.28 +
5.29 +package java.lang;
5.30 +
5.31 +/**
5.32 + * Thrown to indicate that the application has attempted to convert
5.33 + * a string to one of the numeric types, but that the string does not
5.34 + * have the appropriate format.
5.35 + *
5.36 + * @author unascribed
5.37 + * @see java.lang.Integer#toString()
5.38 + * @since JDK1.0
5.39 + */
5.40 +public
5.41 +class NumberFormatException extends IllegalArgumentException {
5.42 + static final long serialVersionUID = -2848938806368998894L;
5.43 +
5.44 + /**
5.45 + * Constructs a <code>NumberFormatException</code> with no detail message.
5.46 + */
5.47 + public NumberFormatException () {
5.48 + super();
5.49 + }
5.50 +
5.51 + /**
5.52 + * Constructs a <code>NumberFormatException</code> with the
5.53 + * specified detail message.
5.54 + *
5.55 + * @param s the detail message.
5.56 + */
5.57 + public NumberFormatException (String s) {
5.58 + super (s);
5.59 + }
5.60 +
5.61 + /**
5.62 + * Factory method for making a <code>NumberFormatException</code>
5.63 + * given the specified input which caused the error.
5.64 + *
5.65 + * @param s the input causing the error
5.66 + */
5.67 + static NumberFormatException forInputString(String s) {
5.68 + return new NumberFormatException("For input string: \"" + s + "\"");
5.69 + }
5.70 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/emul/src/main/java/java/lang/ReflectiveOperationException.java Sat Sep 29 11:01:22 2012 +0200
6.3 @@ -0,0 +1,91 @@
6.4 +/*
6.5 + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6.7 + *
6.8 + * This code is free software; you can redistribute it and/or modify it
6.9 + * under the terms of the GNU General Public License version 2 only, as
6.10 + * published by the Free Software Foundation. Oracle designates this
6.11 + * particular file as subject to the "Classpath" exception as provided
6.12 + * by Oracle in the LICENSE file that accompanied this code.
6.13 + *
6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6.17 + * version 2 for more details (a copy is included in the LICENSE file that
6.18 + * accompanied this code).
6.19 + *
6.20 + * You should have received a copy of the GNU General Public License version
6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6.23 + *
6.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6.25 + * or visit www.oracle.com if you need additional information or have any
6.26 + * questions.
6.27 + */
6.28 +
6.29 +package java.lang;
6.30 +
6.31 +/**
6.32 + * Common superclass of exceptions thrown by reflective operations in
6.33 + * core reflection.
6.34 + *
6.35 + * @see LinkageError
6.36 + * @since 1.7
6.37 + */
6.38 +public class ReflectiveOperationException extends Exception {
6.39 + static final long serialVersionUID = 123456789L;
6.40 +
6.41 + /**
6.42 + * Constructs a new exception with {@code null} as its detail
6.43 + * message. The cause is not initialized, and may subsequently be
6.44 + * initialized by a call to {@link #initCause}.
6.45 + */
6.46 + public ReflectiveOperationException() {
6.47 + super();
6.48 + }
6.49 +
6.50 + /**
6.51 + * Constructs a new exception with the specified detail message.
6.52 + * The cause is not initialized, and may subsequently be
6.53 + * initialized by a call to {@link #initCause}.
6.54 + *
6.55 + * @param message the detail message. The detail message is saved for
6.56 + * later retrieval by the {@link #getMessage()} method.
6.57 + */
6.58 + public ReflectiveOperationException(String message) {
6.59 + super(message);
6.60 + }
6.61 +
6.62 + /**
6.63 + * Constructs a new exception with the specified detail message
6.64 + * and cause.
6.65 + *
6.66 + * <p>Note that the detail message associated with
6.67 + * {@code cause} is <em>not</em> automatically incorporated in
6.68 + * this exception's detail message.
6.69 + *
6.70 + * @param message the detail message (which is saved for later retrieval
6.71 + * by the {@link #getMessage()} method).
6.72 + * @param cause the cause (which is saved for later retrieval by the
6.73 + * {@link #getCause()} method). (A {@code null} value is
6.74 + * permitted, and indicates that the cause is nonexistent or
6.75 + * unknown.)
6.76 + */
6.77 + public ReflectiveOperationException(String message, Throwable cause) {
6.78 + super(message, cause);
6.79 + }
6.80 +
6.81 + /**
6.82 + * Constructs a new exception with the specified cause and a detail
6.83 + * message of {@code (cause==null ? null : cause.toString())} (which
6.84 + * typically contains the class and detail message of {@code cause}).
6.85 + *
6.86 + * @param cause the cause (which is saved for later retrieval by the
6.87 + * {@link #getCause()} method). (A {@code null} value is
6.88 + * permitted, and indicates that the cause is nonexistent or
6.89 + * unknown.)
6.90 + */
6.91 + public ReflectiveOperationException(Throwable cause) {
6.92 + super(cause);
6.93 + }
6.94 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/emul/src/main/java/java/lang/annotation/ElementType.java Sat Sep 29 11:01:22 2012 +0200
7.3 @@ -0,0 +1,63 @@
7.4 +/*
7.5 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7.7 + *
7.8 + * This code is free software; you can redistribute it and/or modify it
7.9 + * under the terms of the GNU General Public License version 2 only, as
7.10 + * published by the Free Software Foundation. Oracle designates this
7.11 + * particular file as subject to the "Classpath" exception as provided
7.12 + * by Oracle in the LICENSE file that accompanied this code.
7.13 + *
7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7.17 + * version 2 for more details (a copy is included in the LICENSE file that
7.18 + * accompanied this code).
7.19 + *
7.20 + * You should have received a copy of the GNU General Public License version
7.21 + * 2 along with this work; if not, write to the Free Software Foundation,
7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7.23 + *
7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7.25 + * or visit www.oracle.com if you need additional information or have any
7.26 + * questions.
7.27 + */
7.28 +
7.29 +package java.lang.annotation;
7.30 +
7.31 +/**
7.32 + * A program element type. The constants of this enumerated type
7.33 + * provide a simple classification of the declared elements in a
7.34 + * Java program.
7.35 + *
7.36 + * <p>These constants are used with the {@link Target} meta-annotation type
7.37 + * to specify where it is legal to use an annotation type.
7.38 + *
7.39 + * @author Joshua Bloch
7.40 + * @since 1.5
7.41 + */
7.42 +public enum ElementType {
7.43 + /** Class, interface (including annotation type), or enum declaration */
7.44 + TYPE,
7.45 +
7.46 + /** Field declaration (includes enum constants) */
7.47 + FIELD,
7.48 +
7.49 + /** Method declaration */
7.50 + METHOD,
7.51 +
7.52 + /** Parameter declaration */
7.53 + PARAMETER,
7.54 +
7.55 + /** Constructor declaration */
7.56 + CONSTRUCTOR,
7.57 +
7.58 + /** Local variable declaration */
7.59 + LOCAL_VARIABLE,
7.60 +
7.61 + /** Annotation type declaration */
7.62 + ANNOTATION_TYPE,
7.63 +
7.64 + /** Package declaration */
7.65 + PACKAGE
7.66 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/emul/src/main/java/java/lang/annotation/Target.java Sat Sep 29 11:01:22 2012 +0200
8.3 @@ -0,0 +1,68 @@
8.4 +/*
8.5 + * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8.7 + *
8.8 + * This code is free software; you can redistribute it and/or modify it
8.9 + * under the terms of the GNU General Public License version 2 only, as
8.10 + * published by the Free Software Foundation. Oracle designates this
8.11 + * particular file as subject to the "Classpath" exception as provided
8.12 + * by Oracle in the LICENSE file that accompanied this code.
8.13 + *
8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8.17 + * version 2 for more details (a copy is included in the LICENSE file that
8.18 + * accompanied this code).
8.19 + *
8.20 + * You should have received a copy of the GNU General Public License version
8.21 + * 2 along with this work; if not, write to the Free Software Foundation,
8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8.23 + *
8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8.25 + * or visit www.oracle.com if you need additional information or have any
8.26 + * questions.
8.27 + */
8.28 +
8.29 +package java.lang.annotation;
8.30 +
8.31 +/**
8.32 + * Indicates the kinds of program element to which an annotation type
8.33 + * is applicable. If a Target meta-annotation is not present on an
8.34 + * annotation type declaration, the declared type may be used on any
8.35 + * program element. If such a meta-annotation is present, the compiler
8.36 + * will enforce the specified usage restriction.
8.37 + *
8.38 + * For example, this meta-annotation indicates that the declared type is
8.39 + * itself a meta-annotation type. It can only be used on annotation type
8.40 + * declarations:
8.41 + * <pre>
8.42 + * @Target(ElementType.ANNOTATION_TYPE)
8.43 + * public @interface MetaAnnotationType {
8.44 + * ...
8.45 + * }
8.46 + * </pre>
8.47 + * This meta-annotation indicates that the declared type is intended solely
8.48 + * for use as a member type in complex annotation type declarations. It
8.49 + * cannot be used to annotate anything directly:
8.50 + * <pre>
8.51 + * @Target({})
8.52 + * public @interface MemberType {
8.53 + * ...
8.54 + * }
8.55 + * </pre>
8.56 + * It is a compile-time error for a single ElementType constant to
8.57 + * appear more than once in a Target annotation. For example, the
8.58 + * following meta-annotation is illegal:
8.59 + * <pre>
8.60 + * @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
8.61 + * public @interface Bogus {
8.62 + * ...
8.63 + * }
8.64 + * </pre>
8.65 + */
8.66 +@Documented
8.67 +@Retention(RetentionPolicy.RUNTIME)
8.68 +@Target(ElementType.ANNOTATION_TYPE)
8.69 +public @interface Target {
8.70 + ElementType[] value();
8.71 +}