|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Bidi
public final class Bidi
Bidirectional Algorithm implementation. The full algorithm is Unicode Standard Annex #9: The Bidirectional Algorithm.
Field Summary | |
---|---|
static int |
DIRECTION_DEFAULT_LEFT_TO_RIGHT
This indicates that a strongly directional character in the text should set the initial direction, but if no such character is found, then the initial direction will be left-to-right. |
static int |
DIRECTION_DEFAULT_RIGHT_TO_LEFT
This indicates that a strongly directional character in the text should set the initial direction, but if no such character is found, then the initial direction will be right-to-left. |
static int |
DIRECTION_LEFT_TO_RIGHT
This indicates that the initial direction should be left-to-right. |
static int |
DIRECTION_RIGHT_TO_LEFT
This indicates that the initial direction should be right-to-left. |
Constructor Summary | |
---|---|
Bidi(AttributedCharacterIterator iter)
Create a new Bidi object given an attributed character iterator. |
|
Bidi(char[] text,
int offset,
byte[] embeddings,
int embedOffset,
int length,
int flags)
Create a new Bidi object with the indicated text and, possibly, explicit embedding settings. |
|
Bidi(String text,
int flags)
Create a new Bidi object using the contents of the given String as the text. |
Method Summary | |
---|---|
boolean |
baseIsLeftToRight()
Return true if the paragraph base embedding is left-to-right, false otherwise. |
Bidi |
createLineBidi(int start,
int end)
Create a new Bidi object for a single line of text, taken from the text used when creating the current Bidi object. |
int |
getBaseLevel()
Return the base embedding level of the paragraph. |
int |
getLength()
Return the length of the paragraph, in characters. |
int |
getLevelAt(int offset)
Return the level at the indicated character. |
int |
getRunCount()
Return the number of runs in the result. |
int |
getRunLevel(int which)
Return the level of the indicated run. |
int |
getRunLimit(int which)
Return the index of the character just following the end of the indicated run. |
int |
getRunStart(int which)
Return the index of the first character in the indicated run. |
boolean |
isLeftToRight()
Return true if the text is entirely left-to-right, and the base embedding is also left-to-right. |
boolean |
isMixed()
Return true if the text consists of mixed left-to-right and right-to-left runs, or if the text consists of one kind of run which differs from the base embedding direction. |
boolean |
isRightToLeft()
Return true if the text is entirely right-to-left, and the base embedding is also right-to-left. |
static void |
reorderVisually(byte[] levels,
int levelOffset,
Object[] objs,
int objOffset,
int count)
Reorder objects according to the levels passed in. |
static boolean |
requiresBidi(char[] text,
int start,
int end)
Returns false if all characters in the text between start and end are all left-to-right text. |
String |
toString()
Return a String describing the internal state of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DIRECTION_DEFAULT_LEFT_TO_RIGHT
public static final int DIRECTION_DEFAULT_RIGHT_TO_LEFT
public static final int DIRECTION_LEFT_TO_RIGHT
public static final int DIRECTION_RIGHT_TO_LEFT
Constructor Detail |
---|
public Bidi(AttributedCharacterIterator iter)
TextAttribute.RUN_DIRECTION
is used to determine the
paragraph's base embedding level. This constructor will recognize
either TextAttribute.RUN_DIRECTION_LTR
or
TextAttribute.RUN_DIRECTION_RTL
. If neither is given,
DIRECTION_DEFAULT_LEFT_TO_RIGHT
is assumed.
TextAttribute.NUMERIC_SHAPING
is seen, then numeric
shaping will be done before the Bidi algorithm is run.
TextAttribute.BIDI_EMBEDDING
is seen on a given
character, then the value of this attribute will be used as an
embedding level override.
iter
- the attributed character iterator to usepublic Bidi(char[] text, int offset, byte[] embeddings, int embedOffset, int length, int flags)
text
- the text to useoffset
- the offset of the first character of the textembeddings
- the explicit embeddings, or null if there are noneembedOffset
- the offset of the first embedding value to uselength
- the length of both the text and the embeddingsflags
- a flag indicating the base embedding directionpublic Bidi(String text, int flags)
text
- the text to useflags
- a flag indicating the base embedding directionMethod Detail |
---|
public boolean baseIsLeftToRight()
public Bidi createLineBidi(int start, int end)
start
- the index of the first character of the lineend
- the index of the final character of the line
public int getBaseLevel()
public int getLength()
public int getLevelAt(int offset)
offset
- the character to examine
public int getRunCount()
public int getRunLevel(int which)
which
- the run to examine
public int getRunLimit(int which)
which
- the run to examine
public int getRunStart(int which)
which
- the run to examine
public boolean isLeftToRight()
public boolean isMixed()
public boolean isRightToLeft()
public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)
public static void reorderVisually(byte[] levels, int levelOffset, Object[] objs, int objOffset, int count)
levels
- the levels associated with each objectlevelOffset
- the index of the first level to useobjs
- the objects to reorder according to the levelsobjOffset
- the index of the first object to usecount
- the number of objects (and levels) to manipulatepublic static boolean requiresBidi(char[] text, int start, int end)
Character.getDirectionality(char)
on all characters
and makes sure all characters are either explicitly left-to-right
or neutral in directionality (character types L, EN, ES, ET, AN,
CS, S and WS).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |