|
Build 1.0_r1(from source) | |||||||||
| 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
Bidi is the class providing the bidirectional algorithm. The algorithm is defined in the Unicode Standard Annex #9, version 13, also described in The Unicode Standard, Version 4.0 . Use a Bidi object to get the information on the position reordering of a bidirectional text, such as Arabic or Hebrew. The natural display ordering of horizontal text in these languages is from right to left, while they order numbers from left to right. If the text contains multiple runs, the information of each run can be obtained from the run index. The level of any particular run indicates the direction of the text as well as the nesting level. Left-to-right runs have even levels while right-to-left runs have odd levels.
| Field Summary | |
|---|---|
static int |
DIRECTION_DEFAULT_LEFT_TO_RIGHT
Constant that indicates the default base level. |
static int |
DIRECTION_DEFAULT_RIGHT_TO_LEFT
Constant that indicates the default base level. |
static int |
DIRECTION_LEFT_TO_RIGHT
Constant that specifies the default base level as 0 (left-to-right). |
static int |
DIRECTION_RIGHT_TO_LEFT
Constant that specifies the default base level as 1 (right-to-left). |
| Constructor Summary | |
|---|---|
Bidi(AttributedCharacterIterator paragraph)
Create a Bidi object from the AttributedCharacterIterator of a paragraph text. |
|
Bidi(char[] text,
int textStart,
byte[] embeddings,
int embStart,
int paragraphLength,
int flags)
Create a Bidi object. |
|
Bidi(String paragraph,
int flags)
Create a Bidi object. |
|
| Method Summary | |
|---|---|
boolean |
baseIsLeftToRight()
Return whether the base level is from left to right. |
Bidi |
createLineBidi(int lineStart,
int lineLimit)
Create a new Bidi object containing the information of one line from this object. |
int |
getBaseLevel()
Return the base level. |
int |
getLength()
Return the length of the text in the Bidi object. |
int |
getLevelAt(int offset)
Return the level of a specified character. |
int |
getRunCount()
Return the number of runs in the bidirectional text. |
int |
getRunLevel(int run)
Return the level of a specified run. |
int |
getRunLimit(int run)
Return the limit offset of a specified run. |
int |
getRunStart(int run)
Return the start offset of a specified run. |
boolean |
isLeftToRight()
Return whether the text is from left to right, that is, both the base direction and the text direction is from left to right. |
boolean |
isMixed()
Return whether the text direction is mixed. |
boolean |
isRightToLeft()
Return whether the text is from right to left, that is, both the base direction and the text direction is from right to left. |
static void |
reorderVisually(byte[] levels,
int levelStart,
Object[] objects,
int objectStart,
int count)
Reorder a range of objects according to their specified levels. |
static boolean |
requiresBidi(char[] text,
int start,
int limit)
Return whether a range of characters of a text requires a Bidi object to display properly. |
String |
toString()
Return the internal message of the Bidi object, used in debugging. |
| 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 paragraph)
paragraph - TODO Make these proper links again (problem with core vs. framework).
see TextAttribute.BIDI_EMBEDDING
see TextAttribute.NUMERIC_SHAPING
see TextAttribute.RUN_DIRECTION
public Bidi(char[] text,
int textStart,
byte[] embeddings,
int embStart,
int paragraphLength,
int flags)
text - the char array of the paragraph text.textStart - the start offset of the text array to perform the algorithm.embeddings - the embedding level array of the paragraph text, specifying
the embedding level information for each character. Values
between -1 and -62 denote overrides at the level's absolute
value, values from 1 to 62 indicate embeddings, and the 0
value indicates the level is calculated by the algorithm
automatically.embStart - the start offset of the embeddings array to perform the
algorithm.paragraphLength - the length of the text to perform the algorithm. It must be
text.length >= textStart + paragraphLength, and
embeddings.length >= embStart + paragraphLength.flags - indicates the base direction of the bidirectional text. It is
expected that this will be one of the direction constant
values defined in this class. An unknown value is treated as
DIRECTION_DEFAULT_LEFT_TO_RIGHT.DIRECTION_LEFT_TO_RIGHT,
DIRECTION_RIGHT_TO_LEFT,
DIRECTION_DEFAULT_RIGHT_TO_LEFT,
DIRECTION_DEFAULT_LEFT_TO_RIGHT
public Bidi(String paragraph,
int flags)
paragraph - the String containing the paragraph text to perform the
algorithm.flags - indicates the base direction of the bidirectional text. It is
expected that this will be one of the direction constant
values defined in this class. An unknown value is treated as
DIRECTION_DEFAULT_LEFT_TO_RIGHT.DIRECTION_LEFT_TO_RIGHT,
DIRECTION_RIGHT_TO_LEFT,
DIRECTION_DEFAULT_RIGHT_TO_LEFT,
DIRECTION_DEFAULT_LEFT_TO_RIGHT| Method Detail |
|---|
public boolean baseIsLeftToRight()
public Bidi createLineBidi(int lineStart,
int lineLimit)
lineStart - the start offset of the line.lineLimit - the limit of the line.
public int getBaseLevel()
public int getLength()
public int getLevelAt(int offset)
offset - the offset of the character.
public int getRunCount()
public int getRunLevel(int run)
run - the index of the run.
public int getRunLimit(int run)
run - the index of the run.
public int getRunStart(int run)
run - the index of the run.
public boolean isLeftToRight()
public boolean isMixed()
public boolean isRightToLeft()
public static void reorderVisually(byte[] levels,
int levelStart,
Object[] objects,
int objectStart,
int count)
levels - the level array, which is already determined.levelStart - the start offset of the range of the levels.objects - the object array to reorder.objectStart - the start offset of the range of objects.count - the count of the range of objects to reorder.
public static boolean requiresBidi(char[] text,
int start,
int limit)
text - the char array of the text.start - the start offset of the range of characters.limit - the limit offset of the range of characters.
public String toString()
toString in class Object
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||