author | dholmes |
Wed, 23 Jan 2019 21:17:51 -0500 | |
changeset 53461 | 08d6edeb3145 |
parent 52979 | 7384e00d5860 |
child 58028 | 7ac4273bb49b |
permissions | -rw-r--r-- |
2 | 1 |
/* |
48740
7d5826282e8d
8196740: Character.digit(int,int) returns wrong value for out of range radix
igerasim
parents:
48684
diff
changeset
|
2 |
* Copyright (c) 2002, 2018, 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 |
||
52979
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
28 |
import jdk.internal.HotSpotIntrinsicCandidate; |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
29 |
|
2 | 30 |
/** The CharacterData class encapsulates the large tables found in |
31 |
Java.lang.Character. */ |
|
32 |
||
33 |
class CharacterDataLatin1 extends CharacterData { |
|
34 |
||
35 |
/* The character properties are currently encoded into 32 bits in the following manner: |
|
36 |
1 bit mirrored property |
|
37 |
4 bits directionality property |
|
38 |
9 bits signed offset used for converting case |
|
39 |
1 bit if 1, adding the signed offset converts the character to lowercase |
|
40 |
1 bit if 1, subtracting the signed offset converts the character to uppercase |
|
41 |
1 bit if 1, this character has a titlecase equivalent (possibly itself) |
|
42 |
3 bits 0 may not be part of an identifier |
|
43 |
1 ignorable control; may continue a Unicode identifier or Java identifier |
|
44 |
2 may continue a Java identifier but not a Unicode identifier (unused) |
|
45 |
3 may continue a Unicode identifier or Java identifier |
|
46 |
4 is a Java whitespace character |
|
47 |
5 may start or continue a Java identifier; |
|
48 |
may continue but not start a Unicode identifier (underscores) |
|
49 |
6 may start or continue a Java identifier but not a Unicode identifier ($) |
|
50 |
7 may start or continue a Unicode identifier or Java identifier |
|
51 |
Thus: |
|
52 |
5, 6, 7 may start a Java identifier |
|
53 |
1, 2, 3, 5, 6, 7 may continue a Java identifier |
|
54 |
7 may start a Unicode identifier |
|
55 |
1, 3, 5, 7 may continue a Unicode identifier |
|
56 |
1 is ignorable within an identifier |
|
57 |
4 is Java whitespace |
|
58 |
2 bits 0 this character has no numeric property |
|
59 |
1 adding the digit offset to the character code and then |
|
60 |
masking with 0x1F will produce the desired numeric value |
|
61 |
2 this character has a "strange" numeric value |
|
62 |
3 a Java supradecimal digit: adding the digit offset to the |
|
63 |
character code, then masking with 0x1F, then adding 10 |
|
64 |
will produce the desired numeric value |
|
65 |
5 bits digit offset |
|
66 |
5 bits character type |
|
67 |
||
68 |
The encoding of character properties is subject to change at any time. |
|
69 |
*/ |
|
70 |
||
71 |
int getProperties(int ch) { |
|
9535
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
72 |
char offset = (char)ch; |
2 | 73 |
int props = $$Lookup(offset); |
74 |
return props; |
|
75 |
} |
|
76 |
||
9535
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
77 |
int getPropertiesEx(int ch) { |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
78 |
char offset = (char)ch; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
79 |
int props = $$LookupEx(offset); |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
80 |
return props; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
81 |
} |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
82 |
|
52979
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
83 |
@HotSpotIntrinsicCandidate |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
84 |
boolean isDigit(int ch) { |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
85 |
return '0' <= ch && ch <= '9'; |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
86 |
} |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
87 |
|
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
88 |
@HotSpotIntrinsicCandidate |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
89 |
boolean isLowerCase(int ch) { |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
90 |
int props = getProperties(ch); |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
91 |
return (props & $$maskType) == Character.LOWERCASE_LETTER; |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
92 |
} |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
93 |
|
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
94 |
@HotSpotIntrinsicCandidate |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
95 |
boolean isUpperCase(int ch) { |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
96 |
int props = getProperties(ch); |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
97 |
return (props & $$maskType) == Character.UPPERCASE_LETTER; |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
98 |
} |
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
99 |
|
9535
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
100 |
boolean isOtherLowercase(int ch) { |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
101 |
int props = getPropertiesEx(ch); |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
102 |
return (props & $$maskOtherLowercase) != 0; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
103 |
} |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
104 |
|
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
105 |
boolean isOtherUppercase(int ch) { |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
106 |
int props = getPropertiesEx(ch); |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
107 |
return (props & $$maskOtherUppercase) != 0; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
108 |
} |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
109 |
|
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
110 |
boolean isOtherAlphabetic(int ch) { |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
111 |
int props = getPropertiesEx(ch); |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
112 |
return (props & $$maskOtherAlphabetic) != 0; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
113 |
} |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
114 |
|
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
115 |
boolean isIdeographic(int ch) { |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
116 |
int props = getPropertiesEx(ch); |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
117 |
return (props & $$maskIdeographic) != 0; |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
118 |
} |
d930011fd275
7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents:
5506
diff
changeset
|
119 |
|
2 | 120 |
int getType(int ch) { |
121 |
int props = getProperties(ch); |
|
122 |
return (props & $$maskType); |
|
123 |
} |
|
124 |
||
125 |
boolean isJavaIdentifierStart(int ch) { |
|
126 |
int props = getProperties(ch); |
|
127 |
return ((props & $$maskIdentifierInfo) >= $$lowJavaStart); |
|
128 |
} |
|
129 |
||
130 |
boolean isJavaIdentifierPart(int ch) { |
|
131 |
int props = getProperties(ch); |
|
132 |
return ((props & $$nonzeroJavaPart) != 0); |
|
133 |
} |
|
134 |
||
135 |
boolean isUnicodeIdentifierStart(int ch) { |
|
136 |
int props = getProperties(ch); |
|
137 |
return ((props & $$maskIdentifierInfo) == $$valueUnicodeStart); |
|
138 |
} |
|
139 |
||
140 |
boolean isUnicodeIdentifierPart(int ch) { |
|
141 |
int props = getProperties(ch); |
|
142 |
return ((props & $$maskUnicodePart) != 0); |
|
143 |
} |
|
144 |
||
145 |
boolean isIdentifierIgnorable(int ch) { |
|
146 |
int props = getProperties(ch); |
|
147 |
return ((props & $$maskIdentifierInfo) == $$valueIgnorable); |
|
148 |
} |
|
149 |
||
150 |
int toLowerCase(int ch) { |
|
151 |
int mapChar = ch; |
|
152 |
int val = getProperties(ch); |
|
153 |
||
154 |
if (((val & $$maskLowerCase) != 0) && |
|
155 |
((val & $$maskCaseOffset) != $$maskCaseOffset)) { |
|
156 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
157 |
mapChar = ch + offset; |
|
158 |
} |
|
159 |
return mapChar; |
|
160 |
} |
|
161 |
||
162 |
int toUpperCase(int ch) { |
|
163 |
int mapChar = ch; |
|
164 |
int val = getProperties(ch); |
|
165 |
||
166 |
if ((val & $$maskUpperCase) != 0) { |
|
167 |
if ((val & $$maskCaseOffset) != $$maskCaseOffset) { |
|
168 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
169 |
mapChar = ch - offset; |
|
170 |
} else if (ch == 0x00B5) { |
|
171 |
mapChar = 0x039C; |
|
172 |
} |
|
173 |
} |
|
174 |
return mapChar; |
|
175 |
} |
|
176 |
||
177 |
int toTitleCase(int ch) { |
|
178 |
return toUpperCase(ch); |
|
179 |
} |
|
180 |
||
48684
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
181 |
// Digit values for codePoints in the 0-255 range. Contents generated using: |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
182 |
// for (char i = 0; i < 256; i++) { |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
183 |
// int v = -1; |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
184 |
// if (i >= '0' && i <= '9') { v = i - '0'; } |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
185 |
// else if (i >= 'A' && i <= 'Z') { v = i - 'A' + 10; } |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
186 |
// else if (i >= 'a' && i <= 'z') { v = i - 'a' + 10; } |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
187 |
// if (i % 20 == 0) System.out.println(); |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
188 |
// System.out.printf("%2d, ", v); |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
189 |
// } |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
190 |
// |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
191 |
// Analysis has shown that generating the whole array allows the JIT to generate |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
192 |
// better code compared to a slimmed down array, such as one cutting off after 'z' |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
193 |
private static final byte[] DIGITS = new byte[] { |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
194 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
195 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
196 |
-1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
197 |
-1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
198 |
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, 10, 11, 12, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
199 |
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
200 |
33, 34, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
201 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
202 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
203 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
204 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
205 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
206 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; |
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
207 |
|
2 | 208 |
int digit(int ch, int radix) { |
48684
29c1fede33a6
8196331: Optimize Character.digit for latin1 input
redestad
parents:
47216
diff
changeset
|
209 |
int value = DIGITS[ch]; |
48740
7d5826282e8d
8196740: Character.digit(int,int) returns wrong value for out of range radix
igerasim
parents:
48684
diff
changeset
|
210 |
return (value >= 0 && value < radix && radix >= Character.MIN_RADIX |
7d5826282e8d
8196740: Character.digit(int,int) returns wrong value for out of range radix
igerasim
parents:
48684
diff
changeset
|
211 |
&& radix <= Character.MAX_RADIX) ? value : -1; |
2 | 212 |
} |
213 |
||
214 |
int getNumericValue(int ch) { |
|
215 |
int val = getProperties(ch); |
|
216 |
int retval = -1; |
|
217 |
||
218 |
switch (val & $$maskNumericType) { |
|
219 |
default: // cannot occur |
|
220 |
case ($$valueNotNumeric): // not numeric |
|
221 |
retval = -1; |
|
222 |
break; |
|
223 |
case ($$valueDigit): // simple numeric |
|
224 |
retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit; |
|
225 |
break; |
|
226 |
case ($$valueStrangeNumeric) : // "strange" numeric |
|
227 |
retval = -2; |
|
228 |
break; |
|
229 |
case ($$valueJavaSupradecimal): // Java supradecimal |
|
230 |
retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10; |
|
231 |
break; |
|
232 |
} |
|
233 |
return retval; |
|
234 |
} |
|
235 |
||
52979
7384e00d5860
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents:
48740
diff
changeset
|
236 |
@HotSpotIntrinsicCandidate |
2 | 237 |
boolean isWhitespace(int ch) { |
238 |
int props = getProperties(ch); |
|
239 |
return ((props & $$maskIdentifierInfo) == $$valueJavaWhitespace); |
|
240 |
} |
|
241 |
||
242 |
byte getDirectionality(int ch) { |
|
243 |
int val = getProperties(ch); |
|
244 |
byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi); |
|
245 |
||
246 |
if (directionality == 0xF ) { |
|
247 |
directionality = -1; |
|
248 |
} |
|
249 |
return directionality; |
|
250 |
} |
|
251 |
||
252 |
boolean isMirrored(int ch) { |
|
253 |
int props = getProperties(ch); |
|
254 |
return ((props & $$maskMirrored) != 0); |
|
255 |
} |
|
256 |
||
257 |
int toUpperCaseEx(int ch) { |
|
258 |
int mapChar = ch; |
|
259 |
int val = getProperties(ch); |
|
260 |
||
261 |
if ((val & $$maskUpperCase) != 0) { |
|
262 |
if ((val & $$maskCaseOffset) != $$maskCaseOffset) { |
|
263 |
int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset); |
|
264 |
mapChar = ch - offset; |
|
265 |
} |
|
266 |
else { |
|
267 |
switch(ch) { |
|
268 |
// map overflow characters |
|
269 |
case 0x00B5 : mapChar = 0x039C; break; |
|
270 |
default : mapChar = Character.ERROR; break; |
|
271 |
} |
|
272 |
} |
|
273 |
} |
|
274 |
return mapChar; |
|
275 |
} |
|
276 |
||
277 |
static char[] sharpsMap = new char[] {'S', 'S'}; |
|
278 |
||
279 |
char[] toUpperCaseCharArray(int ch) { |
|
280 |
char[] upperMap = {(char)ch}; |
|
281 |
if (ch == 0x00DF) { |
|
282 |
upperMap = sharpsMap; |
|
283 |
} |
|
284 |
return upperMap; |
|
285 |
} |
|
286 |
||
287 |
static final CharacterDataLatin1 instance = new CharacterDataLatin1(); |
|
288 |
private CharacterDataLatin1() {}; |
|
289 |
||
290 |
$$Tables |
|
291 |
||
292 |
static { |
|
293 |
$$Initializers |
|
294 |
} |
|
295 |
} |
|
296 |