jdk/make/tools/GenerateCharacter/CharacterData00.java.template
author sherman
Thu, 28 Apr 2011 20:18:57 -0700
changeset 9535 d930011fd275
parent 7247 20bd166a1ad6
child 12300 c795ca195227
permissions -rw-r--r--
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard Summary: updated j.l.c.lsLowerCase/isUpperCase Reviewed-by: okutsu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
     2
 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2497
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2497
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2497
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2497
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2497
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/** 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * The CharacterData00 class encapsulates the large tables once found in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * java.lang.Character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
class CharacterData00 extends CharacterData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
    /* The character properties are currently encoded into 32 bits in the following manner:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
        1 bit   mirrored property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
        4 bits  directionality property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
        9 bits  signed offset used for converting case
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
        1 bit   if 1, adding the signed offset converts the character to lowercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        1 bit   if 1, subtracting the signed offset converts the character to uppercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
        1 bit   if 1, this character has a titlecase equivalent (possibly itself)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        3 bits  0  may not be part of an identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                1  ignorable control; may continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                2  may continue a Java identifier but not a Unicode identifier (unused)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                3  may continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                4  is a Java whitespace character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                5  may start or continue a Java identifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                   may continue but not start a Unicode identifier (underscores)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                6  may start or continue a Java identifier but not a Unicode identifier ($)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                7  may start or continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                Thus:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                   5, 6, 7 may start a Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
                   1, 2, 3, 5, 6, 7 may continue a Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                   7 may start a Unicode identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                   1, 3, 5, 7 may continue a Unicode identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                   1 is ignorable within an identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                   4 is Java whitespace
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
        2 bits  0  this character has no numeric property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                1  adding the digit offset to the character code and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                   masking with 0x1F will produce the desired numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                2  this character has a "strange" numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                3  a Java supradecimal digit: adding the digit offset to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                   character code, then masking with 0x1F, then adding 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                   will produce the desired numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        5 bits  digit offset
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        5 bits  character type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        The encoding of character properties is subject to change at any time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    int getProperties(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        char offset = (char)ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        int props = $$Lookup(offset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        return props;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
9535
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    76
    int getPropertiesEx(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    77
        char offset = (char)ch;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    78
        int props = $$LookupEx(offset);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    79
        return props;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    80
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    81
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    int getType(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return (props & $$maskType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
9535
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    87
    boolean isOtherLowercase(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    88
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    89
        return (props & $$maskOtherLowercase) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    90
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    91
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    92
    boolean isOtherUppercase(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    93
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    94
        return (props & $$maskOtherUppercase) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    95
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    96
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    97
    boolean isOtherAlphabetic(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    98
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
    99
        return (props & $$maskOtherAlphabetic) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   100
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   101
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   102
    boolean isIdeographic(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   103
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   104
        return (props & $$maskIdeographic) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   105
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 7247
diff changeset
   106
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    boolean isJavaIdentifierStart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    boolean isJavaIdentifierPart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        return ((props & $$nonzeroJavaPart) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    boolean isUnicodeIdentifierStart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        return ((props & $$maskIdentifierInfo) == $$valueUnicodeStart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    boolean isUnicodeIdentifierPart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        return ((props & $$maskUnicodePart) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    boolean isIdentifierIgnorable(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    int toLowerCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        if ((val & $$maskLowerCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
          if ((val & $$maskCaseOffset) == $$maskCaseOffset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            switch(ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
              // map the offset overflow chars
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   140
            case 0x0130 : mapChar = 0x0069; break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            case 0x2126 : mapChar = 0x03C9; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            case 0x212A : mapChar = 0x006B; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            case 0x212B : mapChar = 0x00E5; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
              // map the titlecase chars with both a 1:M uppercase map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
              // and a lowercase map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            case 0x1F88 : mapChar = 0x1F80; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            case 0x1F89 : mapChar = 0x1F81; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            case 0x1F8A : mapChar = 0x1F82; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            case 0x1F8B : mapChar = 0x1F83; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            case 0x1F8C : mapChar = 0x1F84; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            case 0x1F8D : mapChar = 0x1F85; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            case 0x1F8E : mapChar = 0x1F86; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            case 0x1F8F : mapChar = 0x1F87; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            case 0x1F98 : mapChar = 0x1F90; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            case 0x1F99 : mapChar = 0x1F91; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            case 0x1F9A : mapChar = 0x1F92; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            case 0x1F9B : mapChar = 0x1F93; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            case 0x1F9C : mapChar = 0x1F94; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            case 0x1F9D : mapChar = 0x1F95; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            case 0x1F9E : mapChar = 0x1F96; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            case 0x1F9F : mapChar = 0x1F97; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            case 0x1FA8 : mapChar = 0x1FA0; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            case 0x1FA9 : mapChar = 0x1FA1; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            case 0x1FAA : mapChar = 0x1FA2; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            case 0x1FAB : mapChar = 0x1FA3; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            case 0x1FAC : mapChar = 0x1FA4; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            case 0x1FAD : mapChar = 0x1FA5; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            case 0x1FAE : mapChar = 0x1FA6; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            case 0x1FAF : mapChar = 0x1FA7; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            case 0x1FBC : mapChar = 0x1FB3; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            case 0x1FCC : mapChar = 0x1FC3; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            case 0x1FFC : mapChar = 0x1FF3; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   173
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   174
            case 0x023A : mapChar = 0x2C65; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   175
            case 0x023E : mapChar = 0x2C66; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   176
            case 0x10A0 : mapChar = 0x2D00; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   177
            case 0x10A1 : mapChar = 0x2D01; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   178
            case 0x10A2 : mapChar = 0x2D02; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   179
            case 0x10A3 : mapChar = 0x2D03; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   180
            case 0x10A4 : mapChar = 0x2D04; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   181
            case 0x10A5 : mapChar = 0x2D05; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   182
            case 0x10A6 : mapChar = 0x2D06; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   183
            case 0x10A7 : mapChar = 0x2D07; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   184
            case 0x10A8 : mapChar = 0x2D08; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   185
            case 0x10A9 : mapChar = 0x2D09; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   186
            case 0x10AA : mapChar = 0x2D0A; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   187
            case 0x10AB : mapChar = 0x2D0B; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   188
            case 0x10AC : mapChar = 0x2D0C; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   189
            case 0x10AD : mapChar = 0x2D0D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   190
            case 0x10AE : mapChar = 0x2D0E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   191
            case 0x10AF : mapChar = 0x2D0F; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   192
            case 0x10B0 : mapChar = 0x2D10; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   193
            case 0x10B1 : mapChar = 0x2D11; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   194
            case 0x10B2 : mapChar = 0x2D12; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   195
            case 0x10B3 : mapChar = 0x2D13; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   196
            case 0x10B4 : mapChar = 0x2D14; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   197
            case 0x10B5 : mapChar = 0x2D15; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   198
            case 0x10B6 : mapChar = 0x2D16; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   199
            case 0x10B7 : mapChar = 0x2D17; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   200
            case 0x10B8 : mapChar = 0x2D18; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   201
            case 0x10B9 : mapChar = 0x2D19; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   202
            case 0x10BA : mapChar = 0x2D1A; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   203
            case 0x10BB : mapChar = 0x2D1B; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   204
            case 0x10BC : mapChar = 0x2D1C; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   205
            case 0x10BD : mapChar = 0x2D1D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   206
            case 0x10BE : mapChar = 0x2D1E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   207
            case 0x10BF : mapChar = 0x2D1F; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   208
            case 0x10C0 : mapChar = 0x2D20; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   209
            case 0x10C1 : mapChar = 0x2D21; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   210
            case 0x10C2 : mapChar = 0x2D22; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   211
            case 0x10C3 : mapChar = 0x2D23; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   212
            case 0x10C4 : mapChar = 0x2D24; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   213
            case 0x10C5 : mapChar = 0x2D25; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   214
            case 0x1E9E : mapChar = 0x00DF; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   215
            case 0x2C62 : mapChar = 0x026B; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   216
            case 0x2C63 : mapChar = 0x1D7D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   217
            case 0x2C64 : mapChar = 0x027D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   218
            case 0x2C6D : mapChar = 0x0251; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   219
            case 0x2C6E : mapChar = 0x0271; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   220
            case 0x2C6F : mapChar = 0x0250; break;
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   221
            case 0x2C70 : mapChar = 0x0252; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   222
            case 0x2C7E : mapChar = 0x023F; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   223
            case 0x2C7F : mapChar = 0x0240; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   224
            case 0xA77D : mapChar = 0x1D79; break;
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   225
            case 0xA78D : mapChar = 0x0265; break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
              // default mapChar is already set, so no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
              // need to redo it here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
              // default       : mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
          else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            mapChar = ch + offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    int toUpperCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        if ((val & $$maskUpperCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
          if ((val & $$maskCaseOffset) == $$maskCaseOffset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            switch(ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
              // map chars with overflow offsets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            case 0x00B5 : mapChar = 0x039C; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            case 0x017F : mapChar = 0x0053; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            case 0x1FBE : mapChar = 0x0399; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
              // map char that have both a 1:1 and 1:M map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            case 0x1F80 : mapChar = 0x1F88; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            case 0x1F81 : mapChar = 0x1F89; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            case 0x1F82 : mapChar = 0x1F8A; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            case 0x1F83 : mapChar = 0x1F8B; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            case 0x1F84 : mapChar = 0x1F8C; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            case 0x1F85 : mapChar = 0x1F8D; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            case 0x1F86 : mapChar = 0x1F8E; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            case 0x1F87 : mapChar = 0x1F8F; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            case 0x1F90 : mapChar = 0x1F98; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            case 0x1F91 : mapChar = 0x1F99; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            case 0x1F92 : mapChar = 0x1F9A; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            case 0x1F93 : mapChar = 0x1F9B; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            case 0x1F94 : mapChar = 0x1F9C; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            case 0x1F95 : mapChar = 0x1F9D; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            case 0x1F96 : mapChar = 0x1F9E; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            case 0x1F97 : mapChar = 0x1F9F; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            case 0x1FA0 : mapChar = 0x1FA8; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            case 0x1FA1 : mapChar = 0x1FA9; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            case 0x1FA2 : mapChar = 0x1FAA; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            case 0x1FA3 : mapChar = 0x1FAB; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            case 0x1FA4 : mapChar = 0x1FAC; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            case 0x1FA5 : mapChar = 0x1FAD; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            case 0x1FA6 : mapChar = 0x1FAE; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            case 0x1FA7 : mapChar = 0x1FAF; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            case 0x1FB3 : mapChar = 0x1FBC; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            case 0x1FC3 : mapChar = 0x1FCC; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            case 0x1FF3 : mapChar = 0x1FFC; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   278
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   279
            case 0x023F : mapChar = 0x2C7E; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   280
            case 0x0240 : mapChar = 0x2C7F; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   281
            case 0x0250 : mapChar = 0x2C6F; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   282
            case 0x0251 : mapChar = 0x2C6D; break;
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   283
            case 0x0252 : mapChar = 0x2C70; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   284
            case 0x0265 : mapChar = 0xA78D; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   285
            case 0x026B : mapChar = 0x2C62; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   286
            case 0x0271 : mapChar = 0x2C6E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   287
            case 0x027D : mapChar = 0x2C64; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   288
            case 0x1D79 : mapChar = 0xA77D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   289
            case 0x1D7D : mapChar = 0x2C63; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   290
            case 0x2C65 : mapChar = 0x023A; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   291
            case 0x2C66 : mapChar = 0x023E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   292
            case 0x2D00 : mapChar = 0x10A0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   293
            case 0x2D01 : mapChar = 0x10A1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   294
            case 0x2D02 : mapChar = 0x10A2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   295
            case 0x2D03 : mapChar = 0x10A3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   296
            case 0x2D04 : mapChar = 0x10A4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   297
            case 0x2D05 : mapChar = 0x10A5; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   298
            case 0x2D06 : mapChar = 0x10A6; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   299
            case 0x2D07 : mapChar = 0x10A7; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   300
            case 0x2D08 : mapChar = 0x10A8; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   301
            case 0x2D09 : mapChar = 0x10A9; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   302
            case 0x2D0A : mapChar = 0x10AA; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   303
            case 0x2D0B : mapChar = 0x10AB; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   304
            case 0x2D0C : mapChar = 0x10AC; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   305
            case 0x2D0D : mapChar = 0x10AD; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   306
            case 0x2D0E : mapChar = 0x10AE; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   307
            case 0x2D0F : mapChar = 0x10AF; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   308
            case 0x2D10 : mapChar = 0x10B0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   309
            case 0x2D11 : mapChar = 0x10B1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   310
            case 0x2D12 : mapChar = 0x10B2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   311
            case 0x2D13 : mapChar = 0x10B3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   312
            case 0x2D14 : mapChar = 0x10B4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   313
            case 0x2D15 : mapChar = 0x10B5; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   314
            case 0x2D16 : mapChar = 0x10B6; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   315
            case 0x2D17 : mapChar = 0x10B7; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   316
            case 0x2D18 : mapChar = 0x10B8; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   317
            case 0x2D19 : mapChar = 0x10B9; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   318
            case 0x2D1A : mapChar = 0x10BA; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   319
            case 0x2D1B : mapChar = 0x10BB; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   320
            case 0x2D1C : mapChar = 0x10BC; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   321
            case 0x2D1D : mapChar = 0x10BD; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   322
            case 0x2D1E : mapChar = 0x10BE; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   323
            case 0x2D1F : mapChar = 0x10BF; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   324
            case 0x2D20 : mapChar = 0x10C0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   325
            case 0x2D21 : mapChar = 0x10C1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   326
            case 0x2D22 : mapChar = 0x10C2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   327
            case 0x2D23 : mapChar = 0x10C3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   328
            case 0x2D24 : mapChar = 0x10C4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   329
            case 0x2D25 : mapChar = 0x10C5; break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
              // ch must have a 1:M case mapping, but we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
              // can't handle it here. Return ch.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
              // since mapChar is already set, no need
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
              // to redo it here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
              //default       : mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
          else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            int offset = val  << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            mapChar =  ch - offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    int toTitleCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        if ((val & $$maskTitleCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            // There is a titlecase equivalent.  Perform further checks:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            if ((val & $$maskUpperCase) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                // The character does not have an uppercase equivalent, so it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                // already be uppercase; so add 1 to get the titlecase form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                mapChar = ch + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            else if ((val & $$maskLowerCase) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                // The character does not have a lowercase equivalent, so it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                // already be lowercase; so subtract 1 to get the titlecase form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                mapChar = ch - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            // else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            // The character has both an uppercase equivalent and a lowercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            // equivalent, so it must itself be a titlecase form; return it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            // return ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            //}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        else if ((val & $$maskUpperCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            // This character has no titlecase equivalent but it does have an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            // uppercase equivalent, so use that (subtract the signed case offset).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            mapChar = toUpperCase(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    int digit(int ch, int radix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        int value = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            int kind = val & $$maskType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            if (kind == Character.DECIMAL_DIGIT_NUMBER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                value = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            else if ((val & $$maskNumericType) == $$valueJavaSupradecimal) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                // Java supradecimal digit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                value = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        return (value < radix) ? value : -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    int getNumericValue(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        int retval = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        switch (val & $$maskNumericType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        default: // cannot occur
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        case ($$valueNotNumeric):         // not numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            retval = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        case ($$valueDigit):              // simple numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        case ($$valueStrangeNumeric)      :       // "strange" numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            switch (ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                case 0x0BF1: retval = 100; break;         // TAMIL NUMBER ONE HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                case 0x0BF2: retval = 1000; break;        // TAMIL NUMBER ONE THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                case 0x1375: retval = 40; break;          // ETHIOPIC NUMBER FORTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                case 0x1376: retval = 50; break;          // ETHIOPIC NUMBER FIFTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                case 0x1377: retval = 60; break;          // ETHIOPIC NUMBER SIXTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                case 0x1378: retval = 70; break;          // ETHIOPIC NUMBER SEVENTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                case 0x1379: retval = 80; break;          // ETHIOPIC NUMBER EIGHTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                case 0x137A: retval = 90; break;          // ETHIOPIC NUMBER NINETY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                case 0x137B: retval = 100; break;         // ETHIOPIC NUMBER HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                case 0x137C: retval = 10000; break;       // ETHIOPIC NUMBER TEN THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                case 0x215F: retval = 1; break;           // FRACTION NUMERATOR ONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                case 0x216C: retval = 50; break;          // ROMAN NUMERAL FIFTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                case 0x216D: retval = 100; break;         // ROMAN NUMERAL ONE HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                case 0x216E: retval = 500; break;         // ROMAN NUMERAL FIVE HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                case 0x216F: retval = 1000; break;        // ROMAN NUMERAL ONE THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                case 0x217C: retval = 50; break;          // SMALL ROMAN NUMERAL FIFTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                case 0x217D: retval = 100; break;         // SMALL ROMAN NUMERAL ONE HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                case 0x217E: retval = 500; break;         // SMALL ROMAN NUMERAL FIVE HUNDRED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                case 0x217F: retval = 1000; break;        // SMALL ROMAN NUMERAL ONE THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                case 0x2180: retval = 1000; break;        // ROMAN NUMERAL ONE THOUSAND C D
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                case 0x2181: retval = 5000; break;        // ROMAN NUMERAL FIVE THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                case 0x2182: retval = 10000; break;       // ROMAN NUMERAL TEN THOUSAND
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                case 0x325C: retval = 32; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                case 0x325D: retval = 33; break;          // CIRCLED NUMBER THIRTY THREE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                case 0x325E: retval = 34; break;          // CIRCLED NUMBER THIRTY FOUR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                case 0x325F: retval = 35; break;          // CIRCLED NUMBER THIRTY FIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                case 0x32B1: retval = 36; break;          // CIRCLED NUMBER THIRTY SIX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                case 0x32B2: retval = 37; break;          // CIRCLED NUMBER THIRTY SEVEN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                case 0x32B3: retval = 38; break;          // CIRCLED NUMBER THIRTY EIGHT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                case 0x32B4: retval = 39; break;          // CIRCLED NUMBER THIRTY NINE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                case 0x32B5: retval = 40; break;          // CIRCLED NUMBER FORTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                case 0x32B6: retval = 41; break;          // CIRCLED NUMBER FORTY ONE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                case 0x32B7: retval = 42; break;          // CIRCLED NUMBER FORTY TWO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                case 0x32B8: retval = 43; break;          // CIRCLED NUMBER FORTY THREE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                case 0x32B9: retval = 44; break;          // CIRCLED NUMBER FORTY FOUR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                case 0x32BA: retval = 45; break;          // CIRCLED NUMBER FORTY FIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                case 0x32BB: retval = 46; break;          // CIRCLED NUMBER FORTY SIX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                case 0x32BC: retval = 47; break;          // CIRCLED NUMBER FORTY SEVEN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                case 0x32BD: retval = 48; break;          // CIRCLED NUMBER FORTY EIGHT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                case 0x32BE: retval = 49; break;          // CIRCLED NUMBER FORTY NINE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                case 0x32BF: retval = 50; break;          // CIRCLED NUMBER FIFTY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   449
                case 0x0D71: retval = 100; break;         // MALAYALAM NUMBER ONE HUNDRED
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   450
                case 0x0D72: retval = 1000; break;        // MALAYALAM NUMBER ONE THOUSAND
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   451
                case 0x2186: retval = 50; break;          // ROMAN NUMERAL FIFTY EARLY FORM
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   452
                case 0x2187: retval = 50000; break;       // ROMAN NUMERAL FIFTY THOUSAND
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   453
                case 0x2188: retval = 100000; break;      // ROMAN NUMERAL ONE HUNDRED THOUSAND
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   454
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                default:       retval = -2; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        case ($$valueJavaSupradecimal):           // Java supradecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        return retval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    boolean isWhitespace(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    byte getDirectionality(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        if (directionality == 0xF ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
            switch(ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                case 0x202A :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
                    // This is the only char with LRE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                    directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                case 0x202B :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
                    // This is the only char with RLE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                    directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                case 0x202C :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
                    // This is the only char with PDF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                    directionality = Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                case 0x202D :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                    // This is the only char with LRO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                    directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                case 0x202E :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                    // This is the only char with RLO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                    directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                default :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                    directionality = Character.DIRECTIONALITY_UNDEFINED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        return directionality;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    boolean isMirrored(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        return ((props & $$maskMirrored) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    int toUpperCaseEx(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        if ((val & $$maskUpperCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            if ((val & $$maskCaseOffset) != $$maskCaseOffset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
                int offset = val  << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                mapChar =  ch - offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                switch(ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                    // map overflow characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                    case 0x00B5 : mapChar = 0x039C; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                    case 0x017F : mapChar = 0x0053; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
                    case 0x1FBE : mapChar = 0x0399; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   523
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   524
                    case 0x023F : mapChar = 0x2C7E; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   525
                    case 0x0240 : mapChar = 0x2C7F; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   526
                    case 0x0250 : mapChar = 0x2C6F; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   527
                    case 0x0251 : mapChar = 0x2C6D; break;
7247
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   528
                    case 0x0252 : mapChar = 0x2C70; break;
20bd166a1ad6 6959267: Support Unicode 6.0.0
peytoia
parents: 5506
diff changeset
   529
                    case 0x0265 : mapChar = 0xA78D; break;
2497
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   530
                    case 0x026B : mapChar = 0x2C62; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   531
                    case 0x0271 : mapChar = 0x2C6E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   532
                    case 0x027D : mapChar = 0x2C64; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   533
                    case 0x1D79 : mapChar = 0xA77D; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   534
                    case 0x1D7D : mapChar = 0x2C63; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   535
                    case 0x2C65 : mapChar = 0x023A; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   536
                    case 0x2C66 : mapChar = 0x023E; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   537
                    case 0x2D00 : mapChar = 0x10A0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   538
                    case 0x2D01 : mapChar = 0x10A1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   539
                    case 0x2D02 : mapChar = 0x10A2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   540
                    case 0x2D03 : mapChar = 0x10A3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   541
                    case 0x2D04 : mapChar = 0x10A4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   542
                    case 0x2D05 : mapChar = 0x10A5; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   543
                    case 0x2D06 : mapChar = 0x10A6; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   544
                    case 0x2D07 : mapChar = 0x10A7; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   545
                    case 0x2D08 : mapChar = 0x10A8; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   546
                    case 0x2D09 : mapChar = 0x10A9; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   547
                    case 0x2D0A : mapChar = 0x10AA; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   548
                    case 0x2D0B : mapChar = 0x10AB; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   549
                    case 0x2D0C : mapChar = 0x10AC; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   550
                    case 0x2D0D : mapChar = 0x10AD; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   551
                    case 0x2D0E : mapChar = 0x10AE; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   552
                    case 0x2D0F : mapChar = 0x10AF; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   553
                    case 0x2D10 : mapChar = 0x10B0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   554
                    case 0x2D11 : mapChar = 0x10B1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   555
                    case 0x2D12 : mapChar = 0x10B2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   556
                    case 0x2D13 : mapChar = 0x10B3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   557
                    case 0x2D14 : mapChar = 0x10B4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   558
                    case 0x2D15 : mapChar = 0x10B5; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   559
                    case 0x2D16 : mapChar = 0x10B6; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   560
                    case 0x2D17 : mapChar = 0x10B7; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   561
                    case 0x2D18 : mapChar = 0x10B8; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   562
                    case 0x2D19 : mapChar = 0x10B9; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   563
                    case 0x2D1A : mapChar = 0x10BA; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   564
                    case 0x2D1B : mapChar = 0x10BB; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   565
                    case 0x2D1C : mapChar = 0x10BC; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   566
                    case 0x2D1D : mapChar = 0x10BD; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   567
                    case 0x2D1E : mapChar = 0x10BE; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   568
                    case 0x2D1F : mapChar = 0x10BF; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   569
                    case 0x2D20 : mapChar = 0x10C0; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   570
                    case 0x2D21 : mapChar = 0x10C1; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   571
                    case 0x2D22 : mapChar = 0x10C2; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   572
                    case 0x2D23 : mapChar = 0x10C3; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   573
                    case 0x2D24 : mapChar = 0x10C4; break;
903fd9d785ef 6404304: RFE: Unicode 5.1 support
peytoia
parents: 2
diff changeset
   574
                    case 0x2D25 : mapChar = 0x10C5; break;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                    default       : mapChar = Character.ERROR; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    char[] toUpperCaseCharArray(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        char[] upperMap = {(char)ch};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        int location = findInCharMap(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        if (location != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
            upperMap = charMap[location][1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        return upperMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * Finds the character in the uppercase mapping table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * @param ch the <code>char</code> to search
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * @return the index location ch in the table or -1 if not found
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     int findInCharMap(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        if (charMap == null || charMap.length == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
        int top, bottom, current;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
        bottom = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        top = charMap.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        current = top/2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
        // invariant: top > current >= bottom && ch >= CharacterData.charMap[bottom][0]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
        while (top - bottom > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            if (ch >= charMap[current][0][0]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
                bottom = current;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                top = current;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
            current = (top + bottom) / 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        if (ch == charMap[current][0][0]) return current;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        else return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    static final CharacterData00 instance = new CharacterData00();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
    private CharacterData00() {};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
    $$Tables
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        $$Initializers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    }        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
}