|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.icu.NumberShaper
public class NumberShaper
NumberShaper changes numbers from one number system to another. That is, the numbers 0-9 have different representations in some locales. This means that they have different code points. For example, Eastern Arabic numbers are from ? - ?.
Internally, numbers will be represented with 0-9, but externally they should show as a user wishes. Further user input may, optionally, use the external form.
This shaper has special behavior for Arabic numbers that are in the form "12:34" as this is taken as chapter:verse. Normally, a ':' is treated as a numeric separator, this results in "12:34", but for verses it should be "34:12". That is, Arabic, numbers are left-to-right (even though the rest of the script is right-to-left) and the ':' as a numeric separator does not change that. So to get around this we mark the ':' as a right-to-left character.
See also: com.ibm.icu.text.ArabicShaping
NumericShaper
,
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormField Summary | |
---|---|
private char |
nineShape
Nine for this shaper. |
private static long |
serialVersionUID
Serialization ID |
Constructor Summary | |
---|---|
NumberShaper()
Create a shaper that is appropriate for the user's locale. |
Method Summary | |
---|---|
boolean |
canShape()
Determine whether shaping is possible. |
boolean |
canUnshape()
Determine whether shaping back to 0-9 is possible. |
private char |
getNine()
Establish nine for the script. |
String |
shape(String input)
Replace 0-9 in the input with representations appropriate for the script. |
private char[] |
shaped(char[] src,
boolean[] transformed)
|
private char[] |
transform(char[] src,
int zero,
int nine,
int offset,
boolean[] transformed)
Transform either to or from 0-9 and the script representation, returning the result and true when at least one character is transformed. |
String |
unshape(String input)
Replace script representations of numbers with 0-9. |
private char[] |
unshaped(char[] src,
boolean[] transformed)
Perform shaping back to 0-9. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private char nineShape
private static final long serialVersionUID
Constructor Detail |
---|
public NumberShaper()
Method Detail |
---|
public boolean canShape()
public String shape(String input)
input
- the text to be transformed
public boolean canUnshape()
public String unshape(String input)
input
- the text to be transformed
private char[] unshaped(char[] src, boolean[] transformed)
private char[] shaped(char[] src, boolean[] transformed)
src
- transformed
-
private char[] transform(char[] src, int zero, int nine, int offset, boolean[] transformed)
src
- the text to transformzero
- zero in the source representationnine
- nine in the source representationoffset
- the distance between zeros in the source and target
representationtransformed
- an input parameter of one boolean that can hold whether there
was a transformation
private char getNine()
|
Copyright ? 2003-2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |