| java.lang.Object | |
| ↳ | java.text.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.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | DIRECTION_DEFAULT_LEFT_TO_RIGHT | Constant that indicates the default base level. | |||||||||
| int | DIRECTION_DEFAULT_RIGHT_TO_LEFT | Constant that indicates the default base level. | |||||||||
| int | DIRECTION_LEFT_TO_RIGHT | Constant that specifies the default base level as 0 (left-to-right). | |||||||||
| int | DIRECTION_RIGHT_TO_LEFT | Constant that specifies the default base level as 1 (right-to-left). | |||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Create a Bidi object from the AttributedCharacterIterator of a paragraph
text.
| |||||||||||
Create a Bidi object.
| |||||||||||
Create a Bidi object.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Return whether the base level is from left to right.
| |||||||||||
Create a new Bidi object containing the information of one line from this
object.
| |||||||||||
Return the base level.
| |||||||||||
Return the length of the text in the Bidi object.
| |||||||||||
Return the level of a specified character.
| |||||||||||
Return the number of runs in the bidirectional text.
| |||||||||||
Return the level of a specified run.
| |||||||||||
Return the limit offset of a specified run.
| |||||||||||
Return the start offset of a specified run.
| |||||||||||
Return whether the text is from left to right, that is, both the base
direction and the text direction is from left to right.
| |||||||||||
Return whether the text direction is mixed.
| |||||||||||
Return whether the text is from right to left, that is, both the base
direction and the text direction is from right to left.
| |||||||||||
Reorder a range of objects according to their specified levels.
| |||||||||||
Return whether a range of characters of a text requires a Bidi object to
display properly.
| |||||||||||
Return the internal message of the Bidi object, used in debugging.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Constant that indicates the default base level. If there is no strong character, then set the paragraph level to 0 (left-to-right).
Constant that indicates the default base level. If there is no strong character, then set the paragraph level to 1 (right-to-left).
Constant that specifies the default base level as 0 (left-to-right).
Constant that specifies the default base level as 1 (right-to-left).
Create a Bidi object from the AttributedCharacterIterator of a paragraph text. The RUN_DIRECTION attribute determines the base direction of the bidirectional text. If it's not specified explicitly, the algorithm uses DIRECTION_DEFAULT_LEFT_TO_RIGHT by default. The BIDI_EMBEDDING attribute specifies the level of embedding 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. For the character with no BIDI_EMBEDDING attribute or with a improper attribute value, such as a null value, the algorithm treats its embedding level as 0. The NUMERIC_SHAPING attribute specifies the instance of NumericShaper used to convert European digits to other decimal digits before performing the bidi algorithm.
| paragraph | TODO Make these proper links again (problem with core vs. framework). see TextAttribute.BIDI_EMBEDDING see TextAttribute.NUMERIC_SHAPING see TextAttribute.RUN_DIRECTION |
|---|
Create a Bidi object.
| 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. |
Create a Bidi object.
| 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. |
Return whether the base level is from left to right.
Create a new Bidi object containing the information of one line from this object.
| lineStart | the start offset of the line. |
|---|---|
| lineLimit | the limit of the line. |
Return the base level.
Return the length of the text in the Bidi object.
Return the level of a specified character.
| offset | the offset of the character. |
|---|
Return the number of runs in the bidirectional text.
Return the level of a specified run.
| run | the index of the run. |
|---|
Return the limit offset of a specified run.
| run | the index of the run. |
|---|
Return the start offset of a specified run.
| run | the index of the run. |
|---|
Return whether the text is from left to right, that is, both the base direction and the text direction is from left to right.
Return whether the text direction is mixed.
Return whether the text is from right to left, that is, both the base direction and the text direction is from right to left.
Reorder a range of objects according to their specified levels. This is a convenience function that does not use a Bidi object. The range of objects at index from objectStart to objectStart + count will be reordered according to the range of levels at index from levelStart to levelStart + 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. |
Return whether a range of characters of a text requires a Bidi object to display properly.
| 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. |
Return the internal message of the Bidi object, used in debugging.