1422 |
* of String.value to avoid copying the array. |
* of String.value to avoid copying the array. |
1423 |
* @see CharData#DIRECTION |
* @see CharData#DIRECTION |
1424 |
*/ |
*/ |
1425 |
private static final char[] direction = CharData.DIRECTION.value; |
// Package visible for use by String. |
1426 |
|
static final char[] direction = CharData.DIRECTION.value; |
1427 |
|
|
1428 |
/** |
/** |
1429 |
* Stores unicode titlecase table. Exploit package visibility of |
* Stores unicode titlecase table. Exploit package visibility of |
1462 |
* @see CharData#DATA |
* @see CharData#DATA |
1463 |
* @see CharData#SHIFT |
* @see CharData#SHIFT |
1464 |
*/ |
*/ |
1465 |
private static char readChar(char ch) |
// Package visible for use in String. |
1466 |
|
static char readChar(char ch) |
1467 |
{ |
{ |
1468 |
// Perform 16-bit addition to find the correct entry in data. |
// Perform 16-bit addition to find the correct entry in data. |
1469 |
return data[(char) (blocks[ch >> CharData.SHIFT] + ch)]; |
return data[(char) (blocks[ch >> CharData.SHIFT] + ch)]; |
1520 |
*/ |
*/ |
1521 |
public String toString() |
public String toString() |
1522 |
{ |
{ |
1523 |
// This assumes that String.valueOf(char) can create a single-character |
// Package constructor avoids an array copy. |
1524 |
// String more efficiently than through the public API. |
return new String(new char[] { value }, 1); |
|
return String.valueOf(value); |
|
1525 |
} |
} |
1526 |
|
|
1527 |
/** |
/** |
1533 |
*/ |
*/ |
1534 |
public String toString(char ch) |
public String toString(char ch) |
1535 |
{ |
{ |
1536 |
// This assumes that String.valueOf(char) can create a single-character |
// Package constructor avoids an array copy. |
1537 |
// String more efficiently than through the public API. |
return new String(new char[] { value }, 1); |
|
return String.valueOf(ch); |
|
1538 |
} |
} |
1539 |
|
|
1540 |
/** |
/** |
2195 |
public static byte getDirectionality(char ch) |
public static byte getDirectionality(char ch) |
2196 |
{ |
{ |
2197 |
// The result will correctly be signed. |
// The result will correctly be signed. |
2198 |
return (byte) direction[readChar(ch) >> 7]; |
return (byte) (direction[readChar(ch) >> 7] >> 2); |
2199 |
} |
} |
2200 |
|
|
2201 |
/** |
/** |