author | ihse |
Mon, 25 Sep 2017 10:32:00 +0200 | |
changeset 47253 | 92fd0e04e0e1 |
parent 47216 | 71c04702a3d5 |
child 50045 | d9d55f64d136 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
31680 | 2 |
* Copyright (c) 2003, 2015, 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 |
||
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 | 82 |
int getType(int ch) { |
83 |
int props = getProperties(ch); |
|
84 |
return (props & $$maskType); |
|
85 |
} |
|
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 | 107 |
boolean isJavaIdentifierStart(int ch) { |
108 |
int props = getProperties(ch); |
|
109 |
return ((props & $$maskIdentifierInfo) >= $$lowJavaStart); |
|
110 |
} |
|
111 |
||
112 |
boolean isJavaIdentifierPart(int ch) { |
|
113 |
int props = getProperties(ch); |
|
114 |
return ((props & $$nonzeroJavaPart) != 0); |
|
115 |
} |
|
116 |
||
117 |
boolean isUnicodeIdentifierStart(int ch) { |
|
118 |
int props = getProperties(ch); |
|
119 |
return ((props & $$maskIdentifierInfo) == $$valueUnicodeStart); |
|
120 |
} |
|
121 |
||
122 |
boolean isUnicodeIdentifierPart(int ch) { |
|
123 |
int props = getProperties(ch); |
|
124 |
return ((props & $$maskUnicodePart) != 0); |
|
125 |
} |
|
126 |
||
127 |
boolean isIdentifierIgnorable(int ch) { |
|
128 |
int props = getProperties(ch); |
|
129 |
return ((props & $$maskIdentifierInfo) == $$valueIgnorable); |
|
130 |
} |
|
131 |
||
132 |
int toLowerCase(int ch) { |
|
133 |
int mapChar = ch; |
|
134 |
int val = getProperties(ch); |
|
135 |
||
136 |
if ((val & $$maskLowerCase) != 0) { |
|
137 |
if ((val & $$maskCaseOffset) == $$maskCaseOffset) { |
|
138 |
switch(ch) { |
|
33242 | 139 |
case 0x0130: mapChar = 0x0069; break; |
140 |
case 0x023A: mapChar = 0x2C65; break; |
|
141 |
case 0x023E: mapChar = 0x2C66; break; |
|
142 |
case 0x10A0: mapChar = 0x2D00; break; |
|
143 |
case 0x10A1: mapChar = 0x2D01; break; |
|
144 |
case 0x10A2: mapChar = 0x2D02; break; |
|
145 |
case 0x10A3: mapChar = 0x2D03; break; |
|
146 |
case 0x10A4: mapChar = 0x2D04; break; |
|
147 |
case 0x10A5: mapChar = 0x2D05; break; |
|
148 |
case 0x10A6: mapChar = 0x2D06; break; |
|
149 |
case 0x10A7: mapChar = 0x2D07; break; |
|
150 |
case 0x10A8: mapChar = 0x2D08; break; |
|
151 |
case 0x10A9: mapChar = 0x2D09; break; |
|
152 |
case 0x10AA: mapChar = 0x2D0A; break; |
|
153 |
case 0x10AB: mapChar = 0x2D0B; break; |
|
154 |
case 0x10AC: mapChar = 0x2D0C; break; |
|
155 |
case 0x10AD: mapChar = 0x2D0D; break; |
|
156 |
case 0x10AE: mapChar = 0x2D0E; break; |
|
157 |
case 0x10AF: mapChar = 0x2D0F; break; |
|
158 |
case 0x10B0: mapChar = 0x2D10; break; |
|
159 |
case 0x10B1: mapChar = 0x2D11; break; |
|
160 |
case 0x10B2: mapChar = 0x2D12; break; |
|
161 |
case 0x10B3: mapChar = 0x2D13; break; |
|
162 |
case 0x10B4: mapChar = 0x2D14; break; |
|
163 |
case 0x10B5: mapChar = 0x2D15; break; |
|
164 |
case 0x10B6: mapChar = 0x2D16; break; |
|
165 |
case 0x10B7: mapChar = 0x2D17; break; |
|
166 |
case 0x10B8: mapChar = 0x2D18; break; |
|
167 |
case 0x10B9: mapChar = 0x2D19; break; |
|
168 |
case 0x10BA: mapChar = 0x2D1A; break; |
|
169 |
case 0x10BB: mapChar = 0x2D1B; break; |
|
170 |
case 0x10BC: mapChar = 0x2D1C; break; |
|
171 |
case 0x10BD: mapChar = 0x2D1D; break; |
|
172 |
case 0x10BE: mapChar = 0x2D1E; break; |
|
173 |
case 0x10BF: mapChar = 0x2D1F; break; |
|
174 |
case 0x10C0: mapChar = 0x2D20; break; |
|
175 |
case 0x10C1: mapChar = 0x2D21; break; |
|
176 |
case 0x10C2: mapChar = 0x2D22; break; |
|
177 |
case 0x10C3: mapChar = 0x2D23; break; |
|
178 |
case 0x10C4: mapChar = 0x2D24; break; |
|
179 |
case 0x10C5: mapChar = 0x2D25; break; |
|
180 |
case 0x10C7: mapChar = 0x2D27; break; |
|
181 |
case 0x10CD: mapChar = 0x2D2D; break; |
|
182 |
case 0x13A0: mapChar = 0xAB70; break; |
|
183 |
case 0x13A1: mapChar = 0xAB71; break; |
|
184 |
case 0x13A2: mapChar = 0xAB72; break; |
|
185 |
case 0x13A3: mapChar = 0xAB73; break; |
|
186 |
case 0x13A4: mapChar = 0xAB74; break; |
|
187 |
case 0x13A5: mapChar = 0xAB75; break; |
|
188 |
case 0x13A6: mapChar = 0xAB76; break; |
|
189 |
case 0x13A7: mapChar = 0xAB77; break; |
|
190 |
case 0x13A8: mapChar = 0xAB78; break; |
|
191 |
case 0x13A9: mapChar = 0xAB79; break; |
|
192 |
case 0x13AA: mapChar = 0xAB7A; break; |
|
193 |
case 0x13AB: mapChar = 0xAB7B; break; |
|
194 |
case 0x13AC: mapChar = 0xAB7C; break; |
|
195 |
case 0x13AD: mapChar = 0xAB7D; break; |
|
196 |
case 0x13AE: mapChar = 0xAB7E; break; |
|
197 |
case 0x13AF: mapChar = 0xAB7F; break; |
|
198 |
case 0x13B0: mapChar = 0xAB80; break; |
|
199 |
case 0x13B1: mapChar = 0xAB81; break; |
|
200 |
case 0x13B2: mapChar = 0xAB82; break; |
|
201 |
case 0x13B3: mapChar = 0xAB83; break; |
|
202 |
case 0x13B4: mapChar = 0xAB84; break; |
|
203 |
case 0x13B5: mapChar = 0xAB85; break; |
|
204 |
case 0x13B6: mapChar = 0xAB86; break; |
|
205 |
case 0x13B7: mapChar = 0xAB87; break; |
|
206 |
case 0x13B8: mapChar = 0xAB88; break; |
|
207 |
case 0x13B9: mapChar = 0xAB89; break; |
|
208 |
case 0x13BA: mapChar = 0xAB8A; break; |
|
209 |
case 0x13BB: mapChar = 0xAB8B; break; |
|
210 |
case 0x13BC: mapChar = 0xAB8C; break; |
|
211 |
case 0x13BD: mapChar = 0xAB8D; break; |
|
212 |
case 0x13BE: mapChar = 0xAB8E; break; |
|
213 |
case 0x13BF: mapChar = 0xAB8F; break; |
|
214 |
case 0x13C0: mapChar = 0xAB90; break; |
|
215 |
case 0x13C1: mapChar = 0xAB91; break; |
|
216 |
case 0x13C2: mapChar = 0xAB92; break; |
|
217 |
case 0x13C3: mapChar = 0xAB93; break; |
|
218 |
case 0x13C4: mapChar = 0xAB94; break; |
|
219 |
case 0x13C5: mapChar = 0xAB95; break; |
|
220 |
case 0x13C6: mapChar = 0xAB96; break; |
|
221 |
case 0x13C7: mapChar = 0xAB97; break; |
|
222 |
case 0x13C8: mapChar = 0xAB98; break; |
|
223 |
case 0x13C9: mapChar = 0xAB99; break; |
|
224 |
case 0x13CA: mapChar = 0xAB9A; break; |
|
225 |
case 0x13CB: mapChar = 0xAB9B; break; |
|
226 |
case 0x13CC: mapChar = 0xAB9C; break; |
|
227 |
case 0x13CD: mapChar = 0xAB9D; break; |
|
228 |
case 0x13CE: mapChar = 0xAB9E; break; |
|
229 |
case 0x13CF: mapChar = 0xAB9F; break; |
|
230 |
case 0x13D0: mapChar = 0xABA0; break; |
|
231 |
case 0x13D1: mapChar = 0xABA1; break; |
|
232 |
case 0x13D2: mapChar = 0xABA2; break; |
|
233 |
case 0x13D3: mapChar = 0xABA3; break; |
|
234 |
case 0x13D4: mapChar = 0xABA4; break; |
|
235 |
case 0x13D5: mapChar = 0xABA5; break; |
|
236 |
case 0x13D6: mapChar = 0xABA6; break; |
|
237 |
case 0x13D7: mapChar = 0xABA7; break; |
|
238 |
case 0x13D8: mapChar = 0xABA8; break; |
|
239 |
case 0x13D9: mapChar = 0xABA9; break; |
|
240 |
case 0x13DA: mapChar = 0xABAA; break; |
|
241 |
case 0x13DB: mapChar = 0xABAB; break; |
|
242 |
case 0x13DC: mapChar = 0xABAC; break; |
|
243 |
case 0x13DD: mapChar = 0xABAD; break; |
|
244 |
case 0x13DE: mapChar = 0xABAE; break; |
|
245 |
case 0x13DF: mapChar = 0xABAF; break; |
|
246 |
case 0x13E0: mapChar = 0xABB0; break; |
|
247 |
case 0x13E1: mapChar = 0xABB1; break; |
|
248 |
case 0x13E2: mapChar = 0xABB2; break; |
|
249 |
case 0x13E3: mapChar = 0xABB3; break; |
|
250 |
case 0x13E4: mapChar = 0xABB4; break; |
|
251 |
case 0x13E5: mapChar = 0xABB5; break; |
|
252 |
case 0x13E6: mapChar = 0xABB6; break; |
|
253 |
case 0x13E7: mapChar = 0xABB7; break; |
|
254 |
case 0x13E8: mapChar = 0xABB8; break; |
|
255 |
case 0x13E9: mapChar = 0xABB9; break; |
|
256 |
case 0x13EA: mapChar = 0xABBA; break; |
|
257 |
case 0x13EB: mapChar = 0xABBB; break; |
|
258 |
case 0x13EC: mapChar = 0xABBC; break; |
|
259 |
case 0x13ED: mapChar = 0xABBD; break; |
|
260 |
case 0x13EE: mapChar = 0xABBE; break; |
|
261 |
case 0x13EF: mapChar = 0xABBF; break; |
|
262 |
case 0x1E9E: mapChar = 0x00DF; break; |
|
263 |
case 0x1F88: mapChar = 0x1F80; break; |
|
264 |
case 0x1F89: mapChar = 0x1F81; break; |
|
265 |
case 0x1F8A: mapChar = 0x1F82; break; |
|
266 |
case 0x1F8B: mapChar = 0x1F83; break; |
|
267 |
case 0x1F8C: mapChar = 0x1F84; break; |
|
268 |
case 0x1F8D: mapChar = 0x1F85; break; |
|
269 |
case 0x1F8E: mapChar = 0x1F86; break; |
|
270 |
case 0x1F8F: mapChar = 0x1F87; break; |
|
271 |
case 0x1F98: mapChar = 0x1F90; break; |
|
272 |
case 0x1F99: mapChar = 0x1F91; break; |
|
273 |
case 0x1F9A: mapChar = 0x1F92; break; |
|
274 |
case 0x1F9B: mapChar = 0x1F93; break; |
|
275 |
case 0x1F9C: mapChar = 0x1F94; break; |
|
276 |
case 0x1F9D: mapChar = 0x1F95; break; |
|
277 |
case 0x1F9E: mapChar = 0x1F96; break; |
|
278 |
case 0x1F9F: mapChar = 0x1F97; break; |
|
279 |
case 0x1FA8: mapChar = 0x1FA0; break; |
|
280 |
case 0x1FA9: mapChar = 0x1FA1; break; |
|
281 |
case 0x1FAA: mapChar = 0x1FA2; break; |
|
282 |
case 0x1FAB: mapChar = 0x1FA3; break; |
|
283 |
case 0x1FAC: mapChar = 0x1FA4; break; |
|
284 |
case 0x1FAD: mapChar = 0x1FA5; break; |
|
285 |
case 0x1FAE: mapChar = 0x1FA6; break; |
|
286 |
case 0x1FAF: mapChar = 0x1FA7; break; |
|
287 |
case 0x1FBC: mapChar = 0x1FB3; break; |
|
288 |
case 0x1FCC: mapChar = 0x1FC3; break; |
|
289 |
case 0x1FFC: mapChar = 0x1FF3; break; |
|
290 |
case 0x2126: mapChar = 0x03C9; break; |
|
291 |
case 0x212A: mapChar = 0x006B; break; |
|
292 |
case 0x212B: mapChar = 0x00E5; break; |
|
293 |
case 0x2C62: mapChar = 0x026B; break; |
|
294 |
case 0x2C63: mapChar = 0x1D7D; break; |
|
295 |
case 0x2C64: mapChar = 0x027D; break; |
|
296 |
case 0x2C6D: mapChar = 0x0251; break; |
|
297 |
case 0x2C6E: mapChar = 0x0271; break; |
|
298 |
case 0x2C6F: mapChar = 0x0250; break; |
|
299 |
case 0x2C70: mapChar = 0x0252; break; |
|
300 |
case 0x2C7E: mapChar = 0x023F; break; |
|
301 |
case 0x2C7F: mapChar = 0x0240; break; |
|
302 |
case 0xA77D: mapChar = 0x1D79; break; |
|
303 |
case 0xA78D: mapChar = 0x0265; break; |
|
304 |
case 0xA7AA: mapChar = 0x0266; break; |
|
305 |
case 0xA7AB: mapChar = 0x025C; break; |
|
306 |
case 0xA7AC: mapChar = 0x0261; break; |
|
307 |
case 0xA7AD: mapChar = 0x026C; break; |
|
308 |
case 0xA7B0: mapChar = 0x029E; break; |
|
309 |
case 0xA7B1: mapChar = 0x0287; break; |
|
310 |
case 0xA7B2: mapChar = 0x029D; break; |
|
311 |
case 0xA7B3: mapChar = 0xAB53; break; |
|
2 | 312 |
// default mapChar is already set, so no |
313 |
// need to redo it here. |
|
314 |
// default : mapChar = ch; |
|
315 |
} |
|
316 |
} |
|
317 |
else { |
|
318 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
319 |
mapChar = ch + offset; |
|
320 |
} |
|
321 |
} |
|
322 |
return mapChar; |
|
323 |
} |
|
324 |
||
325 |
int toUpperCase(int ch) { |
|
326 |
int mapChar = ch; |
|
327 |
int val = getProperties(ch); |
|
328 |
||
329 |
if ((val & $$maskUpperCase) != 0) { |
|
330 |
if ((val & $$maskCaseOffset) == $$maskCaseOffset) { |
|
331 |
switch(ch) { |
|
33242 | 332 |
case 0x017F: mapChar = 0x0053; break; |
333 |
case 0x023F: mapChar = 0x2C7E; break; |
|
334 |
case 0x0240: mapChar = 0x2C7F; break; |
|
335 |
case 0x0250: mapChar = 0x2C6F; break; |
|
336 |
case 0x0251: mapChar = 0x2C6D; break; |
|
337 |
case 0x0252: mapChar = 0x2C70; break; |
|
338 |
case 0x025C: mapChar = 0xA7AB; break; |
|
339 |
case 0x0261: mapChar = 0xA7AC; break; |
|
340 |
case 0x0265: mapChar = 0xA78D; break; |
|
341 |
case 0x0266: mapChar = 0xA7AA; break; |
|
342 |
case 0x026B: mapChar = 0x2C62; break; |
|
343 |
case 0x026C: mapChar = 0xA7AD; break; |
|
344 |
case 0x0271: mapChar = 0x2C6E; break; |
|
345 |
case 0x027D: mapChar = 0x2C64; break; |
|
346 |
case 0x0287: mapChar = 0xA7B1; break; |
|
347 |
case 0x029D: mapChar = 0xA7B2; break; |
|
348 |
case 0x029E: mapChar = 0xA7B0; break; |
|
349 |
case 0x1D79: mapChar = 0xA77D; break; |
|
350 |
case 0x1D7D: mapChar = 0x2C63; break; |
|
351 |
case 0x1F80: mapChar = 0x1F88; break; |
|
352 |
case 0x1F81: mapChar = 0x1F89; break; |
|
353 |
case 0x1F82: mapChar = 0x1F8A; break; |
|
354 |
case 0x1F83: mapChar = 0x1F8B; break; |
|
355 |
case 0x1F84: mapChar = 0x1F8C; break; |
|
356 |
case 0x1F85: mapChar = 0x1F8D; break; |
|
357 |
case 0x1F86: mapChar = 0x1F8E; break; |
|
358 |
case 0x1F87: mapChar = 0x1F8F; break; |
|
359 |
case 0x1F90: mapChar = 0x1F98; break; |
|
360 |
case 0x1F91: mapChar = 0x1F99; break; |
|
361 |
case 0x1F92: mapChar = 0x1F9A; break; |
|
362 |
case 0x1F93: mapChar = 0x1F9B; break; |
|
363 |
case 0x1F94: mapChar = 0x1F9C; break; |
|
364 |
case 0x1F95: mapChar = 0x1F9D; break; |
|
365 |
case 0x1F96: mapChar = 0x1F9E; break; |
|
366 |
case 0x1F97: mapChar = 0x1F9F; break; |
|
367 |
case 0x1FA0: mapChar = 0x1FA8; break; |
|
368 |
case 0x1FA1: mapChar = 0x1FA9; break; |
|
369 |
case 0x1FA2: mapChar = 0x1FAA; break; |
|
370 |
case 0x1FA3: mapChar = 0x1FAB; break; |
|
371 |
case 0x1FA4: mapChar = 0x1FAC; break; |
|
372 |
case 0x1FA5: mapChar = 0x1FAD; break; |
|
373 |
case 0x1FA6: mapChar = 0x1FAE; break; |
|
374 |
case 0x1FA7: mapChar = 0x1FAF; break; |
|
375 |
case 0x1FB3: mapChar = 0x1FBC; break; |
|
376 |
case 0x1FBE: mapChar = 0x0399; break; |
|
377 |
case 0x1FC3: mapChar = 0x1FCC; break; |
|
378 |
case 0x1FF3: mapChar = 0x1FFC; break; |
|
379 |
case 0x2C65: mapChar = 0x023A; break; |
|
380 |
case 0x2C66: mapChar = 0x023E; break; |
|
381 |
case 0x2D00: mapChar = 0x10A0; break; |
|
382 |
case 0x2D01: mapChar = 0x10A1; break; |
|
383 |
case 0x2D02: mapChar = 0x10A2; break; |
|
384 |
case 0x2D03: mapChar = 0x10A3; break; |
|
385 |
case 0x2D04: mapChar = 0x10A4; break; |
|
386 |
case 0x2D05: mapChar = 0x10A5; break; |
|
387 |
case 0x2D06: mapChar = 0x10A6; break; |
|
388 |
case 0x2D07: mapChar = 0x10A7; break; |
|
389 |
case 0x2D08: mapChar = 0x10A8; break; |
|
390 |
case 0x2D09: mapChar = 0x10A9; break; |
|
391 |
case 0x2D0A: mapChar = 0x10AA; break; |
|
392 |
case 0x2D0B: mapChar = 0x10AB; break; |
|
393 |
case 0x2D0C: mapChar = 0x10AC; break; |
|
394 |
case 0x2D0D: mapChar = 0x10AD; break; |
|
395 |
case 0x2D0E: mapChar = 0x10AE; break; |
|
396 |
case 0x2D0F: mapChar = 0x10AF; break; |
|
397 |
case 0x2D10: mapChar = 0x10B0; break; |
|
398 |
case 0x2D11: mapChar = 0x10B1; break; |
|
399 |
case 0x2D12: mapChar = 0x10B2; break; |
|
400 |
case 0x2D13: mapChar = 0x10B3; break; |
|
401 |
case 0x2D14: mapChar = 0x10B4; break; |
|
402 |
case 0x2D15: mapChar = 0x10B5; break; |
|
403 |
case 0x2D16: mapChar = 0x10B6; break; |
|
404 |
case 0x2D17: mapChar = 0x10B7; break; |
|
405 |
case 0x2D18: mapChar = 0x10B8; break; |
|
406 |
case 0x2D19: mapChar = 0x10B9; break; |
|
407 |
case 0x2D1A: mapChar = 0x10BA; break; |
|
408 |
case 0x2D1B: mapChar = 0x10BB; break; |
|
409 |
case 0x2D1C: mapChar = 0x10BC; break; |
|
410 |
case 0x2D1D: mapChar = 0x10BD; break; |
|
411 |
case 0x2D1E: mapChar = 0x10BE; break; |
|
412 |
case 0x2D1F: mapChar = 0x10BF; break; |
|
413 |
case 0x2D20: mapChar = 0x10C0; break; |
|
414 |
case 0x2D21: mapChar = 0x10C1; break; |
|
415 |
case 0x2D22: mapChar = 0x10C2; break; |
|
416 |
case 0x2D23: mapChar = 0x10C3; break; |
|
417 |
case 0x2D24: mapChar = 0x10C4; break; |
|
418 |
case 0x2D25: mapChar = 0x10C5; break; |
|
419 |
case 0x2D27: mapChar = 0x10C7; break; |
|
420 |
case 0x2D2D: mapChar = 0x10CD; break; |
|
421 |
case 0xAB53: mapChar = 0xA7B3; break; |
|
422 |
case 0xAB70: mapChar = 0x13A0; break; |
|
423 |
case 0xAB71: mapChar = 0x13A1; break; |
|
424 |
case 0xAB72: mapChar = 0x13A2; break; |
|
425 |
case 0xAB73: mapChar = 0x13A3; break; |
|
426 |
case 0xAB74: mapChar = 0x13A4; break; |
|
427 |
case 0xAB75: mapChar = 0x13A5; break; |
|
428 |
case 0xAB76: mapChar = 0x13A6; break; |
|
429 |
case 0xAB77: mapChar = 0x13A7; break; |
|
430 |
case 0xAB78: mapChar = 0x13A8; break; |
|
431 |
case 0xAB79: mapChar = 0x13A9; break; |
|
432 |
case 0xAB7A: mapChar = 0x13AA; break; |
|
433 |
case 0xAB7B: mapChar = 0x13AB; break; |
|
434 |
case 0xAB7C: mapChar = 0x13AC; break; |
|
435 |
case 0xAB7D: mapChar = 0x13AD; break; |
|
436 |
case 0xAB7E: mapChar = 0x13AE; break; |
|
437 |
case 0xAB7F: mapChar = 0x13AF; break; |
|
438 |
case 0xAB80: mapChar = 0x13B0; break; |
|
439 |
case 0xAB81: mapChar = 0x13B1; break; |
|
440 |
case 0xAB82: mapChar = 0x13B2; break; |
|
441 |
case 0xAB83: mapChar = 0x13B3; break; |
|
442 |
case 0xAB84: mapChar = 0x13B4; break; |
|
443 |
case 0xAB85: mapChar = 0x13B5; break; |
|
444 |
case 0xAB86: mapChar = 0x13B6; break; |
|
445 |
case 0xAB87: mapChar = 0x13B7; break; |
|
446 |
case 0xAB88: mapChar = 0x13B8; break; |
|
447 |
case 0xAB89: mapChar = 0x13B9; break; |
|
448 |
case 0xAB8A: mapChar = 0x13BA; break; |
|
449 |
case 0xAB8B: mapChar = 0x13BB; break; |
|
450 |
case 0xAB8C: mapChar = 0x13BC; break; |
|
451 |
case 0xAB8D: mapChar = 0x13BD; break; |
|
452 |
case 0xAB8E: mapChar = 0x13BE; break; |
|
453 |
case 0xAB8F: mapChar = 0x13BF; break; |
|
454 |
case 0xAB90: mapChar = 0x13C0; break; |
|
455 |
case 0xAB91: mapChar = 0x13C1; break; |
|
456 |
case 0xAB92: mapChar = 0x13C2; break; |
|
457 |
case 0xAB93: mapChar = 0x13C3; break; |
|
458 |
case 0xAB94: mapChar = 0x13C4; break; |
|
459 |
case 0xAB95: mapChar = 0x13C5; break; |
|
460 |
case 0xAB96: mapChar = 0x13C6; break; |
|
461 |
case 0xAB97: mapChar = 0x13C7; break; |
|
462 |
case 0xAB98: mapChar = 0x13C8; break; |
|
463 |
case 0xAB99: mapChar = 0x13C9; break; |
|
464 |
case 0xAB9A: mapChar = 0x13CA; break; |
|
465 |
case 0xAB9B: mapChar = 0x13CB; break; |
|
466 |
case 0xAB9C: mapChar = 0x13CC; break; |
|
467 |
case 0xAB9D: mapChar = 0x13CD; break; |
|
468 |
case 0xAB9E: mapChar = 0x13CE; break; |
|
469 |
case 0xAB9F: mapChar = 0x13CF; break; |
|
470 |
case 0xABA0: mapChar = 0x13D0; break; |
|
471 |
case 0xABA1: mapChar = 0x13D1; break; |
|
472 |
case 0xABA2: mapChar = 0x13D2; break; |
|
473 |
case 0xABA3: mapChar = 0x13D3; break; |
|
474 |
case 0xABA4: mapChar = 0x13D4; break; |
|
475 |
case 0xABA5: mapChar = 0x13D5; break; |
|
476 |
case 0xABA6: mapChar = 0x13D6; break; |
|
477 |
case 0xABA7: mapChar = 0x13D7; break; |
|
478 |
case 0xABA8: mapChar = 0x13D8; break; |
|
479 |
case 0xABA9: mapChar = 0x13D9; break; |
|
480 |
case 0xABAA: mapChar = 0x13DA; break; |
|
481 |
case 0xABAB: mapChar = 0x13DB; break; |
|
482 |
case 0xABAC: mapChar = 0x13DC; break; |
|
483 |
case 0xABAD: mapChar = 0x13DD; break; |
|
484 |
case 0xABAE: mapChar = 0x13DE; break; |
|
485 |
case 0xABAF: mapChar = 0x13DF; break; |
|
486 |
case 0xABB0: mapChar = 0x13E0; break; |
|
487 |
case 0xABB1: mapChar = 0x13E1; break; |
|
488 |
case 0xABB2: mapChar = 0x13E2; break; |
|
489 |
case 0xABB3: mapChar = 0x13E3; break; |
|
490 |
case 0xABB4: mapChar = 0x13E4; break; |
|
491 |
case 0xABB5: mapChar = 0x13E5; break; |
|
492 |
case 0xABB6: mapChar = 0x13E6; break; |
|
493 |
case 0xABB7: mapChar = 0x13E7; break; |
|
494 |
case 0xABB8: mapChar = 0x13E8; break; |
|
495 |
case 0xABB9: mapChar = 0x13E9; break; |
|
496 |
case 0xABBA: mapChar = 0x13EA; break; |
|
497 |
case 0xABBB: mapChar = 0x13EB; break; |
|
498 |
case 0xABBC: mapChar = 0x13EC; break; |
|
499 |
case 0xABBD: mapChar = 0x13ED; break; |
|
500 |
case 0xABBE: mapChar = 0x13EE; break; |
|
501 |
case 0xABBF: mapChar = 0x13EF; break; |
|
2 | 502 |
// ch must have a 1:M case mapping, but we |
503 |
// can't handle it here. Return ch. |
|
504 |
// since mapChar is already set, no need |
|
505 |
// to redo it here. |
|
506 |
//default : mapChar = ch; |
|
507 |
} |
|
508 |
} |
|
509 |
else { |
|
510 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
511 |
mapChar = ch - offset; |
|
512 |
} |
|
513 |
} |
|
514 |
return mapChar; |
|
515 |
} |
|
516 |
||
517 |
int toTitleCase(int ch) { |
|
518 |
int mapChar = ch; |
|
519 |
int val = getProperties(ch); |
|
520 |
||
521 |
if ((val & $$maskTitleCase) != 0) { |
|
522 |
// There is a titlecase equivalent. Perform further checks: |
|
523 |
if ((val & $$maskUpperCase) == 0) { |
|
524 |
// The character does not have an uppercase equivalent, so it must |
|
525 |
// already be uppercase; so add 1 to get the titlecase form. |
|
526 |
mapChar = ch + 1; |
|
527 |
} |
|
528 |
else if ((val & $$maskLowerCase) == 0) { |
|
529 |
// The character does not have a lowercase equivalent, so it must |
|
530 |
// already be lowercase; so subtract 1 to get the titlecase form. |
|
531 |
mapChar = ch - 1; |
|
532 |
} |
|
533 |
// else { |
|
534 |
// The character has both an uppercase equivalent and a lowercase |
|
535 |
// equivalent, so it must itself be a titlecase form; return it. |
|
536 |
// return ch; |
|
537 |
//} |
|
538 |
} |
|
539 |
else if ((val & $$maskUpperCase) != 0) { |
|
540 |
// This character has no titlecase equivalent but it does have an |
|
541 |
// uppercase equivalent, so use that (subtract the signed case offset). |
|
542 |
mapChar = toUpperCase(ch); |
|
543 |
} |
|
544 |
return mapChar; |
|
545 |
} |
|
546 |
||
547 |
int digit(int ch, int radix) { |
|
548 |
int value = -1; |
|
549 |
if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) { |
|
550 |
int val = getProperties(ch); |
|
551 |
int kind = val & $$maskType; |
|
552 |
if (kind == Character.DECIMAL_DIGIT_NUMBER) { |
|
553 |
value = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit; |
|
554 |
} |
|
555 |
else if ((val & $$maskNumericType) == $$valueJavaSupradecimal) { |
|
556 |
// Java supradecimal digit |
|
557 |
value = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10; |
|
558 |
} |
|
559 |
} |
|
560 |
return (value < radix) ? value : -1; |
|
561 |
} |
|
562 |
||
563 |
int getNumericValue(int ch) { |
|
564 |
int val = getProperties(ch); |
|
565 |
int retval = -1; |
|
566 |
||
567 |
switch (val & $$maskNumericType) { |
|
568 |
default: // cannot occur |
|
569 |
case ($$valueNotNumeric): // not numeric |
|
570 |
retval = -1; |
|
571 |
break; |
|
572 |
case ($$valueDigit): // simple numeric |
|
573 |
retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit; |
|
574 |
break; |
|
575 |
case ($$valueStrangeNumeric) : // "strange" numeric |
|
576 |
switch (ch) { |
|
577 |
case 0x0BF1: retval = 100; break; // TAMIL NUMBER ONE HUNDRED |
|
578 |
case 0x0BF2: retval = 1000; break; // TAMIL NUMBER ONE THOUSAND |
|
33242 | 579 |
case 0x0D71: retval = 100; break; // MALAYALAM NUMBER ONE HUNDRED |
580 |
case 0x0D72: retval = 1000; break; // MALAYALAM NUMBER ONE THOUSAND |
|
2 | 581 |
case 0x1375: retval = 40; break; // ETHIOPIC NUMBER FORTY |
582 |
case 0x1376: retval = 50; break; // ETHIOPIC NUMBER FIFTY |
|
583 |
case 0x1377: retval = 60; break; // ETHIOPIC NUMBER SIXTY |
|
584 |
case 0x1378: retval = 70; break; // ETHIOPIC NUMBER SEVENTY |
|
585 |
case 0x1379: retval = 80; break; // ETHIOPIC NUMBER EIGHTY |
|
586 |
case 0x137A: retval = 90; break; // ETHIOPIC NUMBER NINETY |
|
587 |
case 0x137B: retval = 100; break; // ETHIOPIC NUMBER HUNDRED |
|
588 |
case 0x137C: retval = 10000; break; // ETHIOPIC NUMBER TEN THOUSAND |
|
589 |
case 0x215F: retval = 1; break; // FRACTION NUMERATOR ONE |
|
590 |
case 0x216C: retval = 50; break; // ROMAN NUMERAL FIFTY |
|
591 |
case 0x216D: retval = 100; break; // ROMAN NUMERAL ONE HUNDRED |
|
592 |
case 0x216E: retval = 500; break; // ROMAN NUMERAL FIVE HUNDRED |
|
593 |
case 0x216F: retval = 1000; break; // ROMAN NUMERAL ONE THOUSAND |
|
594 |
case 0x217C: retval = 50; break; // SMALL ROMAN NUMERAL FIFTY |
|
595 |
case 0x217D: retval = 100; break; // SMALL ROMAN NUMERAL ONE HUNDRED |
|
596 |
case 0x217E: retval = 500; break; // SMALL ROMAN NUMERAL FIVE HUNDRED |
|
597 |
case 0x217F: retval = 1000; break; // SMALL ROMAN NUMERAL ONE THOUSAND |
|
598 |
case 0x2180: retval = 1000; break; // ROMAN NUMERAL ONE THOUSAND C D |
|
599 |
case 0x2181: retval = 5000; break; // ROMAN NUMERAL FIVE THOUSAND |
|
600 |
case 0x2182: retval = 10000; break; // ROMAN NUMERAL TEN THOUSAND |
|
33242 | 601 |
case 0x2186: retval = 50; break; // ROMAN NUMERAL FIFTY EARLY FORM |
602 |
case 0x2187: retval = 50000; break; // ROMAN NUMERAL FIFTY THOUSAND |
|
603 |
case 0x2188: retval = 100000; break; // ROMAN NUMERAL ONE HUNDRED THOUSAND |
|
604 |
case 0x324B: retval = 40; break; // CIRCLED NUMBER FORTY ON BLACK SQUARE |
|
605 |
case 0x324C: retval = 50; break; // CIRCLED NUMBER FIFTY ON BLACK SQUARE |
|
606 |
case 0x324D: retval = 60; break; // CIRCLED NUMBER SIXTY ON BLACK SQUARE |
|
607 |
case 0x324E: retval = 70; break; // CIRCLED NUMBER SEVENTY ON BLACK SQUARE |
|
608 |
case 0x324F: retval = 80; break; // CIRCLED NUMBER EIGHTY ON BLACK SQUARE |
|
609 |
case 0x325C: retval = 32; break; // CIRCLED NUMBER THIRTY TWO |
|
2 | 610 |
case 0x325D: retval = 33; break; // CIRCLED NUMBER THIRTY THREE |
611 |
case 0x325E: retval = 34; break; // CIRCLED NUMBER THIRTY FOUR |
|
612 |
case 0x325F: retval = 35; break; // CIRCLED NUMBER THIRTY FIVE |
|
613 |
case 0x32B1: retval = 36; break; // CIRCLED NUMBER THIRTY SIX |
|
614 |
case 0x32B2: retval = 37; break; // CIRCLED NUMBER THIRTY SEVEN |
|
615 |
case 0x32B3: retval = 38; break; // CIRCLED NUMBER THIRTY EIGHT |
|
616 |
case 0x32B4: retval = 39; break; // CIRCLED NUMBER THIRTY NINE |
|
617 |
case 0x32B5: retval = 40; break; // CIRCLED NUMBER FORTY |
|
618 |
case 0x32B6: retval = 41; break; // CIRCLED NUMBER FORTY ONE |
|
619 |
case 0x32B7: retval = 42; break; // CIRCLED NUMBER FORTY TWO |
|
620 |
case 0x32B8: retval = 43; break; // CIRCLED NUMBER FORTY THREE |
|
621 |
case 0x32B9: retval = 44; break; // CIRCLED NUMBER FORTY FOUR |
|
622 |
case 0x32BA: retval = 45; break; // CIRCLED NUMBER FORTY FIVE |
|
623 |
case 0x32BB: retval = 46; break; // CIRCLED NUMBER FORTY SIX |
|
624 |
case 0x32BC: retval = 47; break; // CIRCLED NUMBER FORTY SEVEN |
|
625 |
case 0x32BD: retval = 48; break; // CIRCLED NUMBER FORTY EIGHT |
|
626 |
case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE |
|
627 |
case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY |
|
628 |
default: retval = -2; break; |
|
629 |
} |
|
630 |
break; |
|
631 |
case ($$valueJavaSupradecimal): // Java supradecimal |
|
632 |
retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10; |
|
633 |
break; |
|
634 |
} |
|
635 |
return retval; |
|
636 |
} |
|
637 |
||
638 |
boolean isWhitespace(int ch) { |
|
639 |
int props = getProperties(ch); |
|
640 |
return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace); |
|
641 |
} |
|
642 |
||
643 |
byte getDirectionality(int ch) { |
|
644 |
int val = getProperties(ch); |
|
645 |
byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi); |
|
646 |
if (directionality == 0xF ) { |
|
647 |
switch(ch) { |
|
648 |
case 0x202A : |
|
649 |
// This is the only char with LRE |
|
650 |
directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING; |
|
651 |
break; |
|
652 |
case 0x202B : |
|
653 |
// This is the only char with RLE |
|
654 |
directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING; |
|
655 |
break; |
|
656 |
case 0x202C : |
|
657 |
// This is the only char with PDF |
|
658 |
directionality = Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT; |
|
659 |
break; |
|
660 |
case 0x202D : |
|
661 |
// This is the only char with LRO |
|
662 |
directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE; |
|
663 |
break; |
|
664 |
case 0x202E : |
|
665 |
// This is the only char with RLO |
|
666 |
directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE; |
|
667 |
break; |
|
31680 | 668 |
case 0x2066 : |
669 |
// This is the only char with LRI |
|
670 |
directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_ISOLATE; |
|
671 |
break; |
|
672 |
case 0x2067 : |
|
673 |
// This is the only char with RLI |
|
674 |
directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ISOLATE; |
|
675 |
break; |
|
676 |
case 0x2068 : |
|
677 |
// This is the only char with FSI |
|
678 |
directionality = Character.DIRECTIONALITY_FIRST_STRONG_ISOLATE; |
|
679 |
break; |
|
680 |
case 0x2069 : |
|
681 |
// This is the only char with PDI |
|
682 |
directionality = Character.DIRECTIONALITY_POP_DIRECTIONAL_ISOLATE; |
|
683 |
break; |
|
2 | 684 |
default : |
685 |
directionality = Character.DIRECTIONALITY_UNDEFINED; |
|
686 |
break; |
|
687 |
} |
|
688 |
} |
|
689 |
return directionality; |
|
690 |
} |
|
691 |
||
692 |
boolean isMirrored(int ch) { |
|
693 |
int props = getProperties(ch); |
|
694 |
return ((props & $$maskMirrored) != 0); |
|
695 |
} |
|
696 |
||
697 |
int toUpperCaseEx(int ch) { |
|
698 |
int mapChar = ch; |
|
699 |
int val = getProperties(ch); |
|
700 |
||
701 |
if ((val & $$maskUpperCase) != 0) { |
|
702 |
if ((val & $$maskCaseOffset) != $$maskCaseOffset) { |
|
703 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
704 |
mapChar = ch - offset; |
|
705 |
} |
|
706 |
else { |
|
707 |
switch(ch) { |
|
33242 | 708 |
case 0x017F: mapChar = 0x0053; break; |
709 |
case 0x023F: mapChar = 0x2C7E; break; |
|
710 |
case 0x0240: mapChar = 0x2C7F; break; |
|
711 |
case 0x0250: mapChar = 0x2C6F; break; |
|
712 |
case 0x0251: mapChar = 0x2C6D; break; |
|
713 |
case 0x0252: mapChar = 0x2C70; break; |
|
714 |
case 0x025C: mapChar = 0xA7AB; break; |
|
715 |
case 0x0261: mapChar = 0xA7AC; break; |
|
716 |
case 0x0265: mapChar = 0xA78D; break; |
|
717 |
case 0x0266: mapChar = 0xA7AA; break; |
|
718 |
case 0x026B: mapChar = 0x2C62; break; |
|
719 |
case 0x026C: mapChar = 0xA7AD; break; |
|
720 |
case 0x0271: mapChar = 0x2C6E; break; |
|
721 |
case 0x027D: mapChar = 0x2C64; break; |
|
722 |
case 0x0287: mapChar = 0xA7B1; break; |
|
723 |
case 0x029D: mapChar = 0xA7B2; break; |
|
724 |
case 0x029E: mapChar = 0xA7B0; break; |
|
725 |
case 0x1D79: mapChar = 0xA77D; break; |
|
726 |
case 0x1D7D: mapChar = 0x2C63; break; |
|
727 |
case 0x1FBE: mapChar = 0x0399; break; |
|
728 |
case 0x2C65: mapChar = 0x023A; break; |
|
729 |
case 0x2C66: mapChar = 0x023E; break; |
|
730 |
case 0x2D00: mapChar = 0x10A0; break; |
|
731 |
case 0x2D01: mapChar = 0x10A1; break; |
|
732 |
case 0x2D02: mapChar = 0x10A2; break; |
|
733 |
case 0x2D03: mapChar = 0x10A3; break; |
|
734 |
case 0x2D04: mapChar = 0x10A4; break; |
|
735 |
case 0x2D05: mapChar = 0x10A5; break; |
|
736 |
case 0x2D06: mapChar = 0x10A6; break; |
|
737 |
case 0x2D07: mapChar = 0x10A7; break; |
|
738 |
case 0x2D08: mapChar = 0x10A8; break; |
|
739 |
case 0x2D09: mapChar = 0x10A9; break; |
|
740 |
case 0x2D0A: mapChar = 0x10AA; break; |
|
741 |
case 0x2D0B: mapChar = 0x10AB; break; |
|
742 |
case 0x2D0C: mapChar = 0x10AC; break; |
|
743 |
case 0x2D0D: mapChar = 0x10AD; break; |
|
744 |
case 0x2D0E: mapChar = 0x10AE; break; |
|
745 |
case 0x2D0F: mapChar = 0x10AF; break; |
|
746 |
case 0x2D10: mapChar = 0x10B0; break; |
|
747 |
case 0x2D11: mapChar = 0x10B1; break; |
|
748 |
case 0x2D12: mapChar = 0x10B2; break; |
|
749 |
case 0x2D13: mapChar = 0x10B3; break; |
|
750 |
case 0x2D14: mapChar = 0x10B4; break; |
|
751 |
case 0x2D15: mapChar = 0x10B5; break; |
|
752 |
case 0x2D16: mapChar = 0x10B6; break; |
|
753 |
case 0x2D17: mapChar = 0x10B7; break; |
|
754 |
case 0x2D18: mapChar = 0x10B8; break; |
|
755 |
case 0x2D19: mapChar = 0x10B9; break; |
|
756 |
case 0x2D1A: mapChar = 0x10BA; break; |
|
757 |
case 0x2D1B: mapChar = 0x10BB; break; |
|
758 |
case 0x2D1C: mapChar = 0x10BC; break; |
|
759 |
case 0x2D1D: mapChar = 0x10BD; break; |
|
760 |
case 0x2D1E: mapChar = 0x10BE; break; |
|
761 |
case 0x2D1F: mapChar = 0x10BF; break; |
|
762 |
case 0x2D20: mapChar = 0x10C0; break; |
|
763 |
case 0x2D21: mapChar = 0x10C1; break; |
|
764 |
case 0x2D22: mapChar = 0x10C2; break; |
|
765 |
case 0x2D23: mapChar = 0x10C3; break; |
|
766 |
case 0x2D24: mapChar = 0x10C4; break; |
|
767 |
case 0x2D25: mapChar = 0x10C5; break; |
|
768 |
case 0x2D27: mapChar = 0x10C7; break; |
|
769 |
case 0x2D2D: mapChar = 0x10CD; break; |
|
770 |
case 0xAB53: mapChar = 0xA7B3; break; |
|
771 |
case 0xAB70: mapChar = 0x13A0; break; |
|
772 |
case 0xAB71: mapChar = 0x13A1; break; |
|
773 |
case 0xAB72: mapChar = 0x13A2; break; |
|
774 |
case 0xAB73: mapChar = 0x13A3; break; |
|
775 |
case 0xAB74: mapChar = 0x13A4; break; |
|
776 |
case 0xAB75: mapChar = 0x13A5; break; |
|
777 |
case 0xAB76: mapChar = 0x13A6; break; |
|
778 |
case 0xAB77: mapChar = 0x13A7; break; |
|
779 |
case 0xAB78: mapChar = 0x13A8; break; |
|
780 |
case 0xAB79: mapChar = 0x13A9; break; |
|
781 |
case 0xAB7A: mapChar = 0x13AA; break; |
|
782 |
case 0xAB7B: mapChar = 0x13AB; break; |
|
783 |
case 0xAB7C: mapChar = 0x13AC; break; |
|
784 |
case 0xAB7D: mapChar = 0x13AD; break; |
|
785 |
case 0xAB7E: mapChar = 0x13AE; break; |
|
786 |
case 0xAB7F: mapChar = 0x13AF; break; |
|
787 |
case 0xAB80: mapChar = 0x13B0; break; |
|
788 |
case 0xAB81: mapChar = 0x13B1; break; |
|
789 |
case 0xAB82: mapChar = 0x13B2; break; |
|
790 |
case 0xAB83: mapChar = 0x13B3; break; |
|
791 |
case 0xAB84: mapChar = 0x13B4; break; |
|
792 |
case 0xAB85: mapChar = 0x13B5; break; |
|
793 |
case 0xAB86: mapChar = 0x13B6; break; |
|
794 |
case 0xAB87: mapChar = 0x13B7; break; |
|
795 |
case 0xAB88: mapChar = 0x13B8; break; |
|
796 |
case 0xAB89: mapChar = 0x13B9; break; |
|
797 |
case 0xAB8A: mapChar = 0x13BA; break; |
|
798 |
case 0xAB8B: mapChar = 0x13BB; break; |
|
799 |
case 0xAB8C: mapChar = 0x13BC; break; |
|
800 |
case 0xAB8D: mapChar = 0x13BD; break; |
|
801 |
case 0xAB8E: mapChar = 0x13BE; break; |
|
802 |
case 0xAB8F: mapChar = 0x13BF; break; |
|
803 |
case 0xAB90: mapChar = 0x13C0; break; |
|
804 |
case 0xAB91: mapChar = 0x13C1; break; |
|
805 |
case 0xAB92: mapChar = 0x13C2; break; |
|
806 |
case 0xAB93: mapChar = 0x13C3; break; |
|
807 |
case 0xAB94: mapChar = 0x13C4; break; |
|
808 |
case 0xAB95: mapChar = 0x13C5; break; |
|
809 |
case 0xAB96: mapChar = 0x13C6; break; |
|
810 |
case 0xAB97: mapChar = 0x13C7; break; |
|
811 |
case 0xAB98: mapChar = 0x13C8; break; |
|
812 |
case 0xAB99: mapChar = 0x13C9; break; |
|
813 |
case 0xAB9A: mapChar = 0x13CA; break; |
|
814 |
case 0xAB9B: mapChar = 0x13CB; break; |
|
815 |
case 0xAB9C: mapChar = 0x13CC; break; |
|
816 |
case 0xAB9D: mapChar = 0x13CD; break; |
|
817 |
case 0xAB9E: mapChar = 0x13CE; break; |
|
818 |
case 0xAB9F: mapChar = 0x13CF; break; |
|
819 |
case 0xABA0: mapChar = 0x13D0; break; |
|
820 |
case 0xABA1: mapChar = 0x13D1; break; |
|
821 |
case 0xABA2: mapChar = 0x13D2; break; |
|
822 |
case 0xABA3: mapChar = 0x13D3; break; |
|
823 |
case 0xABA4: mapChar = 0x13D4; break; |
|
824 |
case 0xABA5: mapChar = 0x13D5; break; |
|
825 |
case 0xABA6: mapChar = 0x13D6; break; |
|
826 |
case 0xABA7: mapChar = 0x13D7; break; |
|
827 |
case 0xABA8: mapChar = 0x13D8; break; |
|
828 |
case 0xABA9: mapChar = 0x13D9; break; |
|
829 |
case 0xABAA: mapChar = 0x13DA; break; |
|
830 |
case 0xABAB: mapChar = 0x13DB; break; |
|
831 |
case 0xABAC: mapChar = 0x13DC; break; |
|
832 |
case 0xABAD: mapChar = 0x13DD; break; |
|
833 |
case 0xABAE: mapChar = 0x13DE; break; |
|
834 |
case 0xABAF: mapChar = 0x13DF; break; |
|
835 |
case 0xABB0: mapChar = 0x13E0; break; |
|
836 |
case 0xABB1: mapChar = 0x13E1; break; |
|
837 |
case 0xABB2: mapChar = 0x13E2; break; |
|
838 |
case 0xABB3: mapChar = 0x13E3; break; |
|
839 |
case 0xABB4: mapChar = 0x13E4; break; |
|
840 |
case 0xABB5: mapChar = 0x13E5; break; |
|
841 |
case 0xABB6: mapChar = 0x13E6; break; |
|
842 |
case 0xABB7: mapChar = 0x13E7; break; |
|
843 |
case 0xABB8: mapChar = 0x13E8; break; |
|
844 |
case 0xABB9: mapChar = 0x13E9; break; |
|
845 |
case 0xABBA: mapChar = 0x13EA; break; |
|
846 |
case 0xABBB: mapChar = 0x13EB; break; |
|
847 |
case 0xABBC: mapChar = 0x13EC; break; |
|
848 |
case 0xABBD: mapChar = 0x13ED; break; |
|
849 |
case 0xABBE: mapChar = 0x13EE; break; |
|
850 |
case 0xABBF: mapChar = 0x13EF; break; |
|
2 | 851 |
default : mapChar = Character.ERROR; break; |
852 |
} |
|
853 |
} |
|
854 |
} |
|
855 |
return mapChar; |
|
856 |
} |
|
857 |
||
858 |
char[] toUpperCaseCharArray(int ch) { |
|
859 |
char[] upperMap = {(char)ch}; |
|
860 |
int location = findInCharMap(ch); |
|
861 |
if (location != -1) { |
|
862 |
upperMap = charMap[location][1]; |
|
863 |
} |
|
864 |
return upperMap; |
|
865 |
} |
|
866 |
||
867 |
||
868 |
/** |
|
869 |
* Finds the character in the uppercase mapping table. |
|
870 |
* |
|
871 |
* @param ch the <code>char</code> to search |
|
872 |
* @return the index location ch in the table or -1 if not found |
|
873 |
* @since 1.4 |
|
874 |
*/ |
|
875 |
int findInCharMap(int ch) { |
|
876 |
if (charMap == null || charMap.length == 0) { |
|
877 |
return -1; |
|
878 |
} |
|
879 |
int top, bottom, current; |
|
880 |
bottom = 0; |
|
881 |
top = charMap.length; |
|
882 |
current = top/2; |
|
883 |
// invariant: top > current >= bottom && ch >= CharacterData.charMap[bottom][0] |
|
884 |
while (top - bottom > 1) { |
|
885 |
if (ch >= charMap[current][0][0]) { |
|
886 |
bottom = current; |
|
887 |
} else { |
|
888 |
top = current; |
|
889 |
} |
|
890 |
current = (top + bottom) / 2; |
|
891 |
} |
|
892 |
if (ch == charMap[current][0][0]) return current; |
|
893 |
else return -1; |
|
894 |
} |
|
895 |
||
896 |
static final CharacterData00 instance = new CharacterData00(); |
|
897 |
private CharacterData00() {}; |
|
898 |
||
899 |
$$Tables |
|
900 |
||
901 |
static { |
|
902 |
$$Initializers |
|
903 |
} |
|
904 |
} |