Class RuleBasedBreakIterator.DictionaryCache

  • Enclosing class:
    RuleBasedBreakIterator

    class RuleBasedBreakIterator.DictionaryCache
    extends java.lang.Object
    DictionaryCache stores the boundaries obtained from a run of dictionary characters. Dictionary boundaries are moved first to this cache, then from here to the main BreakCache, where they may inter-leave with non-dictionary boundaries. The public BreakIterator API always fetches directly from the main BreakCache, not from here. In common situations, the number of boundaries in a single dictionary run should be quite small, it will be terminated by punctuation, spaces, or any other non-dictionary characters. The main BreakCache may end up with boundaries from multiple dictionary based runs. The boundaries are stored in a simple ArrayList (vector), with the assumption that they will be accessed sequentially.
    • Field Detail

      • fPositionInCache

        int fPositionInCache
      • fStart

        int fStart
      • fLimit

        int fLimit
      • fFirstRuleStatusIndex

        int fFirstRuleStatusIndex
      • fOtherRuleStatusIndex

        int fOtherRuleStatusIndex
      • fBoundary

        int fBoundary
      • fStatusIndex

        int fStatusIndex
    • Constructor Detail

      • DictionaryCache

        DictionaryCache()
    • Method Detail

      • reset

        void reset()
      • following

        boolean following​(int fromPos)
      • preceding

        boolean preceding​(int fromPos)
      • populateDictionary

        void populateDictionary​(int startPos,
                                int endPos,
                                int firstRuleStatus,
                                int otherRuleStatus)
        Populate the cache with the dictionary based boundaries within a region of text.
        Parameters:
        startPos - The start position of a range of text
        endPos - The end position of a range of text
        firstRuleStatus - The rule status index that applies to the break at startPos
        otherRuleStatus - The rule status index that applies to boundaries other than startPos