Class CollationDataBuilder

java.lang.Object
com.ibm.icu.impl.coll.CollationDataBuilder

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

  • Constructor Details

    • CollationDataBuilder

      CollationDataBuilder()
  • Method Details

    • initForTailoring

      void initForTailoring(CollationData b)
    • 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(CharSequence prefix, 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(CharSequence prefix, CharSequence s, int ce32)
    • copyFrom

      Copies all mappings from the src builder, with modifications. This builder here must not be built yet, and should be empty.
    • optimize

      void optimize(UnicodeSet set)
    • suppressContractions

      void suppressContractions(UnicodeSet set)
    • enableFastLatin

      void enableFastLatin()
    • build

      void build(CollationData data)
    • getCEs

      int getCEs(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(CharSequence prefix, 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(String context, int ce32)
    • getConditionalCE32

      protected CollationDataBuilder.ConditionalCE32 getConditionalCE32(int index)
    • getConditionalCE32ForCE32

      protected CollationDataBuilder.ConditionalCE32 getConditionalCE32ForCE32(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(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.
    • enumRangeForCopy

      private static void enumRangeForCopy(int start, int end, int value, CollationDataBuilder.CopyHelper helper)
    • 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()
    • buildContext

      protected int buildContext(CollationDataBuilder.ConditionalCE32 head)
    • addContextTrie

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

      protected void buildFastLatinTable(CollationData data)
    • getCEs

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

      protected static int jamoCpFromIndex(int i)
    • isMutable

      protected final boolean isMutable()