public class BidiText
extends java.lang.Object
Layout transformations allow to convert a given instance of Bidi text into another instance with possibly different Bidi flags while conserving the semantics of the text.
A BidiText object contains a BidiFlagSet to store the Bidi flags characterizing its character data. The characters are contained in a character array. This array may contain more data than the Bidi text to process. The part of the array to process is called the "interesting" data, and is defined by its length and its offset from the beginning of the character array.
Multi-threading considerations: Each thread must use its own instances of this class.
Modifier and Type | Field and Description |
---|---|
int |
count
length of the "interesting" data within the character array
|
char[] |
data
character array containing the data
|
BidiFlagSet |
flags
BidiFlagSet qualifying the character data
|
int |
offset
offset of the "interesting" data within the character array
|
Constructor and Description |
---|
BidiText()
Constructor with no arguments to create a flags member with
a DEFAULT value.
|
BidiText(BidiFlagSet initFlags)
Constructs a BidiText object based on an existing BidiFlagSet.
|
BidiText(BidiFlagSet initFlags,
char[] initData)
Constructs a BidiText object based on an existing
BidiFlagSet and the data in a character array.
|
BidiText(BidiFlagSet initFlags,
char[] initData,
int offset,
int length,
int capacity)
Constructs a BidiText object based on an existing
BidiFlagSet and the data in part of a character array.
|
BidiText(BidiFlagSet initFlags,
java.lang.String str)
Constructs a BidiText object based on an existing
BidiFlagSet and the data in a string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(BidiText other)
Compares two BidiText objects.
|
boolean |
equals(java.lang.Object other) |
void |
setCharsRef(char[] newData,
int newOffset,
int newLength)
Replaces the character data reference in the BidiText object.
|
char[] |
toCharArray()
Extracts the character data from a BidiText in character array format
|
java.lang.String |
toString()
Extracts the character data from a BidiText in string format
|
BidiText |
transform(BidiFlagSet dstFlags)
Transforms the data in the "this" BidiText object and return the resulting
BidiText object.
|
BidiText |
transform(BidiTransform bdx)
Transforms the data in the "this" BidiText object and return the resulting
BidiText object.
|
public BidiFlagSet flags
public char[] data
public int offset
public int count
public BidiText()
public BidiText(BidiFlagSet initFlags)
initFlags
- public BidiText(BidiFlagSet initFlags, char[] initData)
The argument flags and data are duplicated. Changing them will not affect the BidiText instance.
initFlags
- The Bidi flags of the data.initData
- The character data.public BidiText(BidiFlagSet initFlags, char[] initData, int offset, int length, int capacity)
The argument flags and data are duplicated. Changing them will not affect the BidiText instance.
initFlags
- The Bidi flags of the data.initData
- The character data.offset
- The offset of the "interesting" data in initData.length
- The length of the "interesting" data in initData.capacity
- The length of the created character array (may be
larger than "length" to reserve space for
adding more data).public BidiText(BidiFlagSet initFlags, java.lang.String str)
The argument flags and data are duplicated. Changing them will not affect the BidiText instance.
initFlags
- The Bidi flags of the data.str
- The character data.public boolean equals(BidiText other)
other
- The BidiText to compare to this.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public void setCharsRef(char[] newData, int newOffset, int newLength)
This method avoids the overhead of creating a character array and copying the source data to it, when the source data is already contained in a character array.
This method can be used after creating a BidiText object with no arguments, or to reuse a BidiText object with new data.
This is a convenience method. It is also possible to manipulate directly the data, offset and count members of the BidiText instance.
newData
- A reference to the character data.newOffset
- The offset of the "interesting" data in newData.newLength
- The length of the "interesting" data in newData.public char[] toCharArray()
public java.lang.String toString()
toString
in class java.lang.Object
public BidiText transform(BidiFlagSet dstFlags)
The source BidiText is never modified by the transform.
The destination BidiText has its Bidi flags set to those of the argument.
A typical usage of this method could be:
BidiText src = new BidiText(); // source text BidiFlagSet dstFlags; // Bidi flags for destination BidiText dst; // destination reference src.flags.setAllFlags( {flag values for source} ); dstFlags.setAllFlags( {flag values for destination} ); // assign values to src.data, src.offset, src.count dst = src.transform(dstFlags);
dstFlags
- Bidi flags of the destination BidiText.public BidiText transform(BidiTransform bdx)
The source BidiText is never modified by the transform.
The destination BidiText has its Bidi flags set to those of the argument.
Output fields of the BidiTransform object are set by this method. srcToDstMap, DstToSrcMap and propertyMap may be set by this method if the corresponding options have been required in BidiTransform when calling it.
By default, transformed output data is written to the destination BidiText character array but no maps are created.
A typical usage of this method could be:
BidiTransform bdx = new BidiTransform(); BidiText src = new BidiText(); // source text BidiText dst; // destination reference src.flags.setAllFlags( {flag values for source} ); bdx.flags.setAllFlags( {flag values for destination} ); // assign values to src.data, src.offset, src.count dst = src.transform(bdx);
This method is still in construction. Currently only the default options are implemented. No maps are created.
bdx
- The BidiTransform object defining the transformation.