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