Class WordStorage.Builder

  • Enclosing class:
    WordStorage

    static class WordStorage.Builder
    extends java.lang.Object
    • Field Detail

      • hasCustomMorphData

        private final boolean hasCustomMorphData
      • hashTable

        private final int[] hashTable
      • wordData

        private byte[] wordData
      • chainLengths

        private final int[] chainLengths
      • group

        private final java.util.List<char[]> group
      • morphDataIDs

        private final java.util.List<java.lang.Integer> morphDataIDs
      • currentEntry

        private java.lang.String currentEntry
      • wordCount

        private final int wordCount
      • commonPrefixLength

        private int commonPrefixLength
      • commonPrefixPos

        private int commonPrefixPos
      • actualWords

        private int actualWords
    • Constructor Detail

      • Builder

        Builder​(int wordCount,
                boolean hasCustomMorphData,
                FlagEnumerator flagEnumerator)
        Parameters:
        wordCount - an approximate number of the words in the resulting dictionary, used to pre-size the hash table. This argument can be a bit larger than the actual word count, but not smaller.
    • Method Detail

      • add

        void add​(java.lang.String entry,
                 char[] flags,
                 int morphDataID)
          throws java.io.IOException
        Add a dictionary entry. This method should be called for entries sorted non-descending by String.compareTo(java.lang.String) rules.
        Throws:
        java.io.IOException
      • flushGroup

        private int flushGroup()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • hasHiddenFlag

        private static boolean hasHiddenFlag​(char[] flags)
      • build

        WordStorage build()
                   throws java.io.IOException
        Throws:
        java.io.IOException