Class CollationDataBuilder


  • final class CollationDataBuilder
    extends java.lang.Object
    Low-level CollationData builder. Takes (character, CE) pairs and builds them into runtime data structures. Supports characters with context prefixes and contraction suffixes.
    • Constructor Detail

      • CollationDataBuilder

        CollationDataBuilder()
    • Method Detail

      • isCompressibleLeadByte

        boolean isCompressibleLeadByte​(int b)
      • isCompressiblePrimary

        boolean isCompressiblePrimary​(long p)
      • hasMappings

        boolean hasMappings()
        Returns:
        true if this builder has mappings (e.g., add() has been called)
      • isAssigned

        boolean isAssigned​(int c)
        Returns:
        true if c has CEs in this builder
      • add

        void add​(java.lang.CharSequence prefix,
                 java.lang.CharSequence s,
                 long[] ces,
                 int cesLength)
      • encodeCEs

        int encodeCEs​(long[] ces,
                      int cesLength)
        Encodes the ces as either the returned ce32 by itself, or by storing an expansion, with the returned ce32 referring to that.

        add(p, s, ces, cesLength) = addCE32(p, s, encodeCEs(ces, cesLength))

      • addCE32

        void addCE32​(java.lang.CharSequence prefix,
                     java.lang.CharSequence s,
                     int ce32)
      • suppressContractions

        void suppressContractions​(UnicodeSet set)
      • enableFastLatin

        void enableFastLatin()
      • getCEs

        int getCEs​(java.lang.CharSequence s,
                   long[] ces,
                   int cesLength)
        Looks up CEs for s and appends them to the ces array. Does not handle normalization: s should be in FCD form. Does not write completely ignorable CEs. Does not write beyond Collation.MAX_EXPANSION_LENGTH.
        Returns:
        incremented cesLength
      • getCEs

        int getCEs​(java.lang.CharSequence prefix,
                   java.lang.CharSequence s,
                   long[] ces,
                   int cesLength)
      • getCE32FromOffsetCE32

        protected int getCE32FromOffsetCE32​(boolean fromBase,
                                            int c,
                                            int ce32)
      • addCE

        protected int addCE​(long ce)
      • addCE32

        protected int addCE32​(int ce32)
      • addConditionalCE32

        protected int addConditionalCE32​(java.lang.String context,
                                         int ce32)
      • makeBuilderContextCE32

        protected static int makeBuilderContextCE32​(int index)
      • isBuilderContextCE32

        protected static boolean isBuilderContextCE32​(int ce32)
      • encodeOneCEAsCE32

        protected static int encodeOneCEAsCE32​(long ce)
      • encodeOneCE

        protected int encodeOneCE​(long ce)
      • encodeExpansion

        protected int encodeExpansion​(long[] ces,
                                      int start,
                                      int length)
      • encodeExpansion32

        protected int encodeExpansion32​(int[] newCE32s,
                                        int start,
                                        int length)
      • copyFromBaseCE32

        protected int copyFromBaseCE32​(int c,
                                       int ce32,
                                       boolean withContext)
      • copyContractionsFromBaseCE32

        protected int copyContractionsFromBaseCE32​(java.lang.StringBuilder context,
                                                   int c,
                                                   int ce32,
                                                   CollationDataBuilder.ConditionalCE32 cond)
        Copies base contractions to a list of ConditionalCE32. Sets cond.next to the index of the first new item and returns the index of the last new item.
      • getJamoCE32s

        protected boolean getJamoCE32s​(int[] jamoCE32s)
      • setDigitTags

        protected void setDigitTags()
      • setLeadSurrogates

        protected void setLeadSurrogates()
      • buildMappings

        protected void buildMappings​(CollationData data)
      • clearContexts

        protected void clearContexts()
      • buildContexts

        protected void buildContexts()
      • addContextTrie

        protected int addContextTrie​(int defaultCE32,
                                     CharsTrieBuilder trieBuilder)
      • buildFastLatinTable

        protected void buildFastLatinTable​(CollationData data)
      • getCEs

        protected int getCEs​(java.lang.CharSequence s,
                             int start,
                             long[] ces,
                             int cesLength)
      • jamoCpFromIndex

        protected static int jamoCpFromIndex​(int i)
      • isMutable

        protected final boolean isMutable()