public class BidiFlagSet
extends java.lang.Object
Bidi text can be stored in different formats, which are characterized by 5 Bidi attributes, whose values may be stored in 5 Bidi flags. These 5 flags constitute a BidiFlagSet.
A BidiFlagSet object contains a value for each of the 5 Bidi flags which represent the Bidi attributes. The 5 attributes are:
Multi-threading considerations: Different threads may use the same BidiFlagSet instance if they all mean it to represent identical values of the Bidi attributes. For different values of the Bidi attributes, distinct instances of this class must be used.
Constructor and Description |
---|
BidiFlagSet()
Constructs a BidiFlagSet with the default value.
|
BidiFlagSet(BidiFlag flag)
Constructs a BidiFlagSet from one BidiFlag.
|
BidiFlagSet(BidiFlag flag1,
BidiFlag flag2)
Constructs a BidiFlagSet from two BidiFlags.
|
BidiFlagSet(BidiFlag flag1,
BidiFlag flag2,
BidiFlag flag3)
Constructs a BidiFlagSet from three BidiFlags.
|
BidiFlagSet(BidiFlag flag1,
BidiFlag flag2,
BidiFlag flag3,
BidiFlag flag4)
Constructs a BidiFlagSet from four BidiFlags.
|
BidiFlagSet(BidiFlag flag1,
BidiFlag flag2,
BidiFlag flag3,
BidiFlag flag4,
BidiFlag flag5)
Constructs a BidiFlagSet from five BidiFlags.
|
BidiFlagSet(BidiFlagSet model)
Constructs a BidiFlagSet based on an existing BidiFlagSet.
|
BidiFlagSet(char[] chars)
Constructs a BidiFlagSet from a char array.
|
BidiFlagSet(java.lang.String str)
Constructs a BidiFlagSet from a string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares two BidiFlagSets.
|
BidiFlag |
getNumerals()
Returns the numeral shapes flag from a BidiFlagSet.
|
BidiFlag |
getOrientation()
Returns the orientation flag from a BidiFlagSet.
|
BidiFlag |
getSwap()
Returns the symmetric swapping flag from a BidiFlagSet.
|
BidiFlag |
getText()
Returns the text shapes flag from a BidiFlagSet.
|
BidiFlag |
getType()
Returns the type-of-text flag from a BidiFlagSet.
|
int |
hashCode()
Returns a hashcode for a BidiFlagSet.
|
static void |
set2AllFlags(BidiFlagSet flags1,
BidiFlagSet flags2,
java.lang.String str)
Sets all the Bidi flags in 2 BidiFlagSets based on a string.
|
void |
setAllFlags(BidiFlagSet model)
Sets all bidi flags based on another BidiFlagSet.
|
void |
setAllFlags(java.lang.String str)
Sets all bidi flags from a string.
|
void |
setOneFlag(BidiFlag newFlag)
Sets a new value for one of the Bidi flags in a set without changing
the other Bidi flags.
|
java.lang.String |
toString()
Creates a string that represents the various Bidi flags grouped in
a BidiFlagSet.
|
public BidiFlagSet()
Type: implicit Orientation: LTR Swapping: YES Numeral Shapes: Nominal Text Shapes: Nominal
public BidiFlagSet(BidiFlagSet model)
model
- The BidiFlagSet which is copied.public BidiFlagSet(BidiFlag flag)
Example:
BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL);
flag
- The BidiFlag which is explicitly specified.public BidiFlagSet(BidiFlag flag1, BidiFlag flag2)
Example:
BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL, TYPE_VISUAL);
flag1
- The first BidiFlag which is explicitly specified.flag2
- The second BidiFlag which is explicitly specified.java.lang.IllegalArgumentException
- If the arguments conflict or are duplicates.public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, BidiFlag flag3)
Example:
BidiFlagset bdfs = new BidiFlagSet(ORIENTATION_RTL, TYPE_VISUAL, SWAP_YES);
flag1
- The first BidiFlag which is explicitly specified.flag2
- The second BidiFlag which is explicitly specified.flag3
- The third BidiFlag which is explicitly specified.java.lang.IllegalArgumentException
- If the arguments conflict or are duplicates.public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, BidiFlag flag3, BidiFlag flag4)
flag1
- The first BidiFlag which is explicitly specified.flag2
- The second BidiFlag which is explicitly specified.flag3
- The third BidiFlag which is explicitly specified.flag4
- The fourth BidiFlag which is explicitly specified.java.lang.IllegalArgumentException
- If the arguments conflict or are duplicates.public BidiFlagSet(BidiFlag flag1, BidiFlag flag2, BidiFlag flag3, BidiFlag flag4, BidiFlag flag5)
flag1
- The first BidiFlag which is explicitly specified.flag2
- The second BidiFlag which is explicitly specified.flag3
- The third BidiFlag which is explicitly specified.flag4
- The fourth BidiFlag which is explicitly specified.flag5
- The fifth BidiFlag which is explicitly specified.java.lang.IllegalArgumentException
- If the arguments conflict or duplicatepublic BidiFlagSet(char[] chars)
Only characters 1 to 5 are used to build the BidiFlagSet.
chars
- A character array.public BidiFlagSet(java.lang.String str) throws java.lang.IllegalArgumentException
The string contains sequences in the form "keyword=value" separated by commas.
This format is compatible with the result of the toString method. This format is useful when readibility is more important than efficiency.
The supported keywords are: typeoftext, orientation, context, swapping, numerals and shaping.
The following keywords are ignored but do not cause a syntax error: @ls, implicitalg, checkmode, shapcharset.
Example:
typeoftext=implicit, orientation=rtl, swap=yes, shaping=nominal, numerals=nominal
str
- A string in the format "flag=value [,...]".java.lang.IllegalArgumentException
- If the syntax of the data is invalid.toString()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The BidiFlagSet to compare to this.public BidiFlag getNumerals()
The expected value is one of NUMERALS_NOMINAL, NUMERALS_NATIONAL,
NUMERALS_CONTEXTUAL, NUMERALS_ANY.
It can be tested as in the following example:
if (getNumerals(myFlags) == NUMERALS_NATIONAL) . . .
public BidiFlag getOrientation()
The expected value is one of ORIENTATION_LTR, ORIENTATION_RTL,
ORIENTATION_CONTEXT_LTR, ORIENTATION_CONTEXT_RTL.
It can be tested as in the following example:
if (getOrientation(myFlags) == ORIENTATION_RTL) . . .
public BidiFlag getSwap()
The expected value is one of SWAP_YES, SWAP_NO.
It can be tested as in the following example:
if (getSwap(myFlags) == SWAP_YES) . . .
public BidiFlag getText()
The expected value is one of TEXT_NOMINAL, TEXT_SHAPED,
TEXT_INITIAL, TEXT_MIDDLE, TEXT_FINAL, TEXT_ISOLATED.
It can be tested as in the following example:
if (getText(myFlags) == TEXT_MIDDLE) . . .
public BidiFlag getType()
The expected value is one of TYPE_IMPLICIT, TYPE_VISUAL.
It can be tested as in the following example:
if (getType(myFlags) == TYPE_VISUAL) . . .
public int hashCode()
hashCode
in class java.lang.Object
public void setAllFlags(BidiFlagSet model)
model
- The BidiFlagSet which is copied.public void setAllFlags(java.lang.String str) throws java.lang.IllegalArgumentException
The string contains sequences of the form "keyword=value" separated by commas.
This format is compatible with the result of the toString method. This format is useful when readibility is more important than efficiency.
The supported keywords are: typeoftext, orientation, context, swapping, numerals and shaping.
The following keywords are ignored but do not cause a syntax error: @ls, implicitalg, checkmode, shapcharset.
Example:
typeoftext=visual, orientation=ltr, swap=no, shaping=shaped, numerals=contextual
str
- A string in the format "flag=value [,...]".java.lang.IllegalArgumentException
- If the syntax of the data is invalid.toString()
public static void set2AllFlags(BidiFlagSet flags1, BidiFlagSet flags2, java.lang.String str) throws java.lang.IllegalArgumentException
The string contains sequences of the form "keyword=value" or "keyword=value1:value2", with a separating comma. Each keyword is followed by one or two values. In the first case, this value applies to both source and destination. In the second case, the two values are separated by a colon; the first value applies to the source and the second value to the destination.
The supported keywords are: typeoftext, orientation, context, swapping, numerals and shaping.
The following keywords are ignored but do not cause a syntax error: @ls, implicitalg, checkmode, shapcharset.
Example: the source flags are "implicit, ltr, swapping on"; the target flags are "visual, ltr, no swapping". The string will be:
typeoftext=implicit:visual, orientation=ltr, swapping=yes:no
flags1
- The first BidiFlagSet to be set.flags2
- The second BidiFlagSet to be set.str
- A string in the format "flag=value [,...]".java.lang.IllegalArgumentException
- If the syntax of the data is invalid.public void setOneFlag(BidiFlag newFlag)
The new value must be one of the pre-defined values for BidiFlag.
newFlag
- The new value requested for one of the flags.public java.lang.String toString()
The format is compatible with the syntax of modifiers in X/Open standard "Portable Layout Services".
For each flag, an expression of the form "keyword=value" is added to the string. Adjacent expressions are separated by a comma and a space.
The keywords and their respective sets of values are:
KEYWORD VALUES ----------- --------------- typeoftext implicit visual orientation ltr rtl contextual context ltr rtl swapping yes no numerals nominal national contextual any shaping nominal shaped shform1 shform2 shform3 shform4
toString
in class java.lang.Object