Class CaseMapImpl


  • public final class CaseMapImpl
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      CaseMapImpl()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int addTitleAdjustmentOption​(int options, int newOption)  
      static int addTitleIteratorOption​(int options, int newOption)  
      private static int appendCodePoint​(java.lang.Appendable a, int c)  
      private static void appendResult​(int result, java.lang.Appendable dest, int cpLength, int options, Edits edits)
      Appends a full case mapping result, see UCaseProps.MAX_STRING_LENGTH.
      private static void appendUnchanged​(java.lang.CharSequence src, int start, int length, java.lang.Appendable dest, int options, Edits edits)  
      private static java.lang.String applyEdits​(java.lang.CharSequence src, java.lang.StringBuilder replacementChars, Edits edits)  
      static java.lang.String fold​(int options, java.lang.CharSequence src)  
      static <A extends java.lang.Appendable>
      A
      fold​(int options, java.lang.CharSequence src, A dest, Edits edits)  
      static BreakIterator getTitleBreakIterator​(ULocale locale, int options, BreakIterator iter)  
      static BreakIterator getTitleBreakIterator​(java.util.Locale locale, int options, BreakIterator iter)  
      private static void internalToLower​(int caseLocale, int options, java.lang.CharSequence src, int srcStart, int srcLimit, CaseMapImpl.StringContextIterator iter, java.lang.Appendable dest, Edits edits)
      caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account.
      private static void internalToUpper​(int caseLocale, int options, java.lang.CharSequence src, java.lang.Appendable dest, Edits edits)  
      private static boolean isLNS​(int c)  
      private static <A extends java.lang.Appendable>
      int
      maybeTitleDutchIJ​(java.lang.CharSequence src, int c, int start, int segmentLimit, A dest, int options, Edits edits)
      Input: c is a letter I with or without acute accent.
      static java.lang.String toLower​(int caseLocale, int options, java.lang.CharSequence src)  
      static <A extends java.lang.Appendable>
      A
      toLower​(int caseLocale, int options, java.lang.CharSequence src, A dest, Edits edits)  
      static java.lang.String toTitle​(int caseLocale, int options, BreakIterator iter, java.lang.CharSequence src)  
      static <A extends java.lang.Appendable>
      A
      toTitle​(int caseLocale, int options, BreakIterator titleIter, java.lang.CharSequence src, A dest, Edits edits)  
      static java.lang.String toUpper​(int caseLocale, int options, java.lang.CharSequence src)  
      static <A extends java.lang.Appendable>
      A
      toUpper​(int caseLocale, int options, java.lang.CharSequence src, A dest, Edits edits)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TITLECASE_ITERATOR_MASK

        private static final int TITLECASE_ITERATOR_MASK
        Bit mask for the titlecasing iterator options bit field. Currently only 3 out of 8 values are used: 0 (words), TITLECASE_WHOLE_STRING, TITLECASE_SENTENCES. See stringoptions.h.
        See Also:
        Constant Field Values
      • TITLECASE_ADJUST_TO_CASED

        public static final int TITLECASE_ADJUST_TO_CASED
        See Also:
        Constant Field Values
      • TITLECASE_ADJUSTMENT_MASK

        private static final int TITLECASE_ADJUSTMENT_MASK
        Bit mask for the titlecasing index adjustment options bit set. Currently two bits are defined: TITLECASE_NO_BREAK_ADJUSTMENT, TITLECASE_ADJUST_TO_CASED. See stringoptions.h.
        See Also:
        Constant Field Values
      • OMIT_UNCHANGED_TEXT

        public static final int OMIT_UNCHANGED_TEXT
        Omit unchanged text when case-mapping with Edits.
        See Also:
        Constant Field Values
      • CASE_TRIE

        private static final Trie2_16 CASE_TRIE
    • Constructor Detail

      • CaseMapImpl

        public CaseMapImpl()
    • Method Detail

      • addTitleAdjustmentOption

        public static int addTitleAdjustmentOption​(int options,
                                                   int newOption)
      • isLNS

        private static boolean isLNS​(int c)
      • addTitleIteratorOption

        public static int addTitleIteratorOption​(int options,
                                                 int newOption)
      • getTitleBreakIterator

        public static BreakIterator getTitleBreakIterator​(java.util.Locale locale,
                                                          int options,
                                                          BreakIterator iter)
      • appendCodePoint

        private static int appendCodePoint​(java.lang.Appendable a,
                                           int c)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • appendResult

        private static void appendResult​(int result,
                                         java.lang.Appendable dest,
                                         int cpLength,
                                         int options,
                                         Edits edits)
                                  throws java.io.IOException
        Appends a full case mapping result, see UCaseProps.MAX_STRING_LENGTH.
        Throws:
        java.io.IOException
      • appendUnchanged

        private static final void appendUnchanged​(java.lang.CharSequence src,
                                                  int start,
                                                  int length,
                                                  java.lang.Appendable dest,
                                                  int options,
                                                  Edits edits)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • applyEdits

        private static java.lang.String applyEdits​(java.lang.CharSequence src,
                                                   java.lang.StringBuilder replacementChars,
                                                   Edits edits)
      • internalToLower

        private static void internalToLower​(int caseLocale,
                                            int options,
                                            java.lang.CharSequence src,
                                            int srcStart,
                                            int srcLimit,
                                            CaseMapImpl.StringContextIterator iter,
                                            java.lang.Appendable dest,
                                            Edits edits)
                                     throws java.io.IOException
        caseLocale >= 0: Lowercases [srcStart..srcLimit[ but takes context [0..srcLength[ into account. caseLocale < 0: Case-folds [srcStart..srcLimit[.
        Throws:
        java.io.IOException
      • internalToUpper

        private static void internalToUpper​(int caseLocale,
                                            int options,
                                            java.lang.CharSequence src,
                                            java.lang.Appendable dest,
                                            Edits edits)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • toLower

        public static java.lang.String toLower​(int caseLocale,
                                               int options,
                                               java.lang.CharSequence src)
      • toLower

        public static <A extends java.lang.Appendable> A toLower​(int caseLocale,
                                                                 int options,
                                                                 java.lang.CharSequence src,
                                                                 A dest,
                                                                 Edits edits)
      • toUpper

        public static java.lang.String toUpper​(int caseLocale,
                                               int options,
                                               java.lang.CharSequence src)
      • toUpper

        public static <A extends java.lang.Appendable> A toUpper​(int caseLocale,
                                                                 int options,
                                                                 java.lang.CharSequence src,
                                                                 A dest,
                                                                 Edits edits)
      • toTitle

        public static java.lang.String toTitle​(int caseLocale,
                                               int options,
                                               BreakIterator iter,
                                               java.lang.CharSequence src)
      • toTitle

        public static <A extends java.lang.Appendable> A toTitle​(int caseLocale,
                                                                 int options,
                                                                 BreakIterator titleIter,
                                                                 java.lang.CharSequence src,
                                                                 A dest,
                                                                 Edits edits)
      • maybeTitleDutchIJ

        private static <A extends java.lang.Appendable> int maybeTitleDutchIJ​(java.lang.CharSequence src,
                                                                              int c,
                                                                              int start,
                                                                              int segmentLimit,
                                                                              A dest,
                                                                              int options,
                                                                              Edits edits)
                                                                       throws java.io.IOException
        Input: c is a letter I with or without acute accent. start is the index in src after c, and is less than segmentLimit. If a plain i/I is followed by a plain j/J, or an i/I with acute (precomposed or decomposed) is followed by a j/J with acute, then we output accordingly.
        Returns:
        the src index after the titlecased sequence, or the start index if no Dutch IJ
        Throws:
        java.io.IOException
      • fold

        public static java.lang.String fold​(int options,
                                            java.lang.CharSequence src)
      • fold

        public static <A extends java.lang.Appendable> A fold​(int options,
                                                              java.lang.CharSequence src,
                                                              A dest,
                                                              Edits edits)