com.ibm.bidiTools.bdlayout

Class ArabicOptionSet

  • java.lang.Object
    • com.ibm.bidiTools.bdlayout.ArabicOptionSet


  • public class ArabicOptionSet
    extends java.lang.Object
    This class represents an ArabicOptionSet object defining the shaping attributes to be used during Bidi Layout Transformation process. It also defines the available values for each option.

    Arabic text has some special characters that can be converted to different formats, which are characterized by four Bidi options, these options are stored in four Arabic objects. These four options constitute an ArabicOptionSet.

    An ArabicOptionSet object contains a value for each of the four Arabic objects which represent the Arabic options. The four options are:

    • Lam-Alef handling (Near, At Begin, At End or Auto)
    • Seen handling (Near or Auto)
    • Yeh Hamza handling (Near or Auto)
    • Tashkeel handling (Keep, Customized At Begin, Customized At End, or Auto)
    The Arabic options values are pre-defined in this class. Each one represents one possible value of one Arabic option.

    For more information on Arabic Shaping options, see: Bidirectional support in IBM SDK: A user guide

    Multi-threading considerations: There are no multi-threading concerns for this class, since it only defines static final instances.

    • Constructor Detail

      • ArabicOptionSet

        public ArabicOptionSet()
        Constructs an ArabicOptionSet with the default value. The default is:
          Auto for all options
         
      • ArabicOptionSet

        public ArabicOptionSet(ArabicOption option)
        Constructs an ArabicOptionSet from one ArabicOption. The other Arabic Options are set to their default.

        Example:

         ArabicOptionset bdOpts = new ArabicOptionSet(LAMALEF_NEAR);
         
        Parameters:
        option - The ArabicOption which is explicitly specified.
      • ArabicOptionSet

        public ArabicOptionSet(ArabicOption option1,
                               ArabicOption option2)
        Constructs an ArabicOptionSet from two ArabicOptions. The other Arabic options are set to their default.

        Example:

         ArabicOptionset bdOpts = new ArabicOptionSet(LAMALEF_NEAR, SEEN_NEAR);
         
        Parameters:
        option1 - The first ArabicOption which is explicitly specified.
        option2 - The second ArabicOption which is explicitly specified.
        Throws:
        java.lang.IllegalArgumentException - If the arguments conflict or are duplicates.
      • ArabicOptionSet

        public ArabicOptionSet(ArabicOption option1,
                               ArabicOption option2,
                               ArabicOption option3)
        Constructs an ArabicOptionSet from three ArabicOptions. The other Arabic option is set to its default.

        Example:

         ArabicOptionset bdOpts =
                        new ArabicOptionSet(LAMALEF_NEAR, SEEN_NEAR, YEHHAMZA_TWO_CELL_NEAR);
         
        Parameters:
        option1 - The first ArabicOption which is explicitly specified.
        option2 - The second ArabicOption which is explicitly specified.
        option3 - The third ArabicOption which is explicitly specified.
        Throws:
        java.lang.IllegalArgumentException - If the arguments conflict or are duplicates.
      • ArabicOptionSet

        public ArabicOptionSet(ArabicOption option1,
                               ArabicOption option2,
                               ArabicOption option3,
                               ArabicOption option4)
        Constructs an ArabicOptionSet from four ArabicOptions.
        Parameters:
        option1 - The first ArabicOption which is explicitly specified.
        option2 - The second ArabicOption which is explicitly specified.
        option3 - The third ArabicOption which is explicitly specified.
        option4 - The fourth ArabicOption which is explicitly specified.
        Throws:
        java.lang.IllegalArgumentException - If the arguments conflict or are duplicates.
      • ArabicOptionSet

        public ArabicOptionSet(ArabicOptionSet set)
        Constructs an ArabicOptionSet based on an existing ArabicOptionSet.
        Parameters:
        set - The ArabicOptionSet which is copied.
      • ArabicOptionSet

        public ArabicOptionSet(char[] chars)
        Constructs an ArabicOptionSet from a char array. The content of the array must follow the specification for the "S" and "U parts of the BIDI environment variable, as follows:
        • character 1: type of text = I (Implicit) or V (Visual)
        • character 2: orientation = L (LTR), R (RTL), C (Contextual LTR) or D (Contextual RTL)
        • character 3: swapping = Y (Swapping ON) or N (Swapping OFF)
        • character 4: text shaping = N (Nominal), S (Shaped), I (Initial), M (Middle), F (Final) or B (Isolated)
        • character 5: numeral shaping = N (Nominal), H (National) or C (Contextual)
        • character 6: bidi algorithm = U (Unicode) or R (Roundtrip)
        • character 7: Lamalef mode = N (Near), B (At Begin), E (At End) or A (Auto), R(Resize Buffer)
        • character 8: SeenTail mode = N (Near), A (Auto), E (AtEnd), B (AtBegin), R (Resize Buffer)
        • character 9: Yeh Hamza mode = N (Near), A (Auto), B (AtBegin), E (AtEnd) or R (Resize Buffer)
        • character 10:Tashkeel mode = K (Keep), B (Customized at Begin), R(Customize Resize Buffer), E (Customized at End), N (Customized Near) or A (Auto)

        Only characters 7 to 10 are used to build the ArabicOptionSet.

        Parameters:
        chars - character array in Convert parms format. It contains the output options specified in the Bidi environment variable
    • Method Detail

      • equals

        public boolean equals(ArabicOptionSet other)
        Compares two ArabicOptionSets. Two ArabicOptionSets are considered equal if they represent the same values for the four Arabic options.
        Parameters:
        other - The ArabicOptionSet to compare to this.
        Returns:
        true if the ArabicOptionSets are equal, false otherwise.
      • getLamAlefMode

        public ArabicOption getLamAlefMode()
        Returns the Lam Alef option from an ArabicOptionSet.
        Returns:
        The value of the Lam Alef option.

        The expected value is one of LAMALEF_NEAR, LAMALEF_ATBEGIN, LAMALEF_ATEND or LAMALEF_AUTO

      • getSeenMode

        public ArabicOption getSeenMode()
        Returns the Seen option from an ArabicOptionSet.
        Returns:
        The value of the Seen option.

        The expected value is one of SEEN_NEAR or SEEN_AUTO.

      • getTashkeelMode

        public ArabicOption getTashkeelMode()
        Returns the Tashkeel option from an ArabicOptionSet.
        Returns:
        The value of the Tashkeel option.

        The expected value is one of TASHKEEL_KEEP, TASHKEEL_CUSTOMIZED_ATBEGIN, TASHKEEL_CUSTOMIZED_ATEND or TASHKEEL_AUTO.

      • getYehHamzaMode

        public ArabicOption getYehHamzaMode()
        Returns the Yeh Hamza option from an ArabicOptionSet.
        Returns:
        The value of the Yeh Hamza option.

        The expected value is one of YEHHAMZA_TWO_CELL_NEAR or YEHHAMZA_AUTO.

      • hashCode

        public int hashCode()
        Returns a hashcode for an ArabicOptionSet. The hashcode of a ArabicOptionSet is the same as the hashcode of its value.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hashcode value.
      • setAllOptions

        public void setAllOptions(ArabicOptionSet set)
        Sets all Arabic options based on another ArabicOptionSet.
        Parameters:
        set - The ArabicOptionSet which is copied.
      • setOneOption

        public void setOneOption(ArabicOption newoption)
        Sets a new value for one of the Bidi Options in a set without changing the other Arabic Options.

        The new value must be one of the pre-defined values for ArabicOption.

        Parameters:
        newoption - The new value requested for one of the options.