Class FSTEnum<T>

  • Direct Known Subclasses:
    BytesRefFSTEnum, IntsRefFSTEnum

    abstract class FSTEnum<T>
    extends java.lang.Object
    Can next() and advance() through the terms in an FST
    • Field Detail

      • fst

        protected final FST<T> fst
      • output

        protected T[] output
      • NO_OUTPUT

        protected final T NO_OUTPUT
      • upto

        protected int upto
      • targetLength

        int targetLength
    • Constructor Detail

      • FSTEnum

        FSTEnum​(FST<T> fst)
        doFloor controls the behavior of advance: if it's true doFloor is true, advance positions to the biggest term before target.
    • Method Detail

      • getTargetLabel

        protected abstract int getTargetLabel()
      • getCurrentLabel

        protected abstract int getCurrentLabel()
      • setCurrentLabel

        protected abstract void setCurrentLabel​(int label)
      • grow

        protected abstract void grow()
      • rewindPrefix

        private void rewindPrefix()
                           throws java.io.IOException
        Rewinds enum state to match the shared prefix between current term and target term
        Throws:
        java.io.IOException
      • doNext

        protected void doNext()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekCeil

        protected void doSeekCeil()
                           throws java.io.IOException
        Seeks to smallest term that's >= target.
        Throws:
        java.io.IOException
      • doSeekCeilArrayContinuous

        private FST.Arc<T> doSeekCeilArrayContinuous​(FST.Arc<T> arc,
                                                     int targetLabel,
                                                     FST.BytesReader in)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekCeilArrayDirectAddressing

        private FST.Arc<T> doSeekCeilArrayDirectAddressing​(FST.Arc<T> arc,
                                                           int targetLabel,
                                                           FST.BytesReader in)
                                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekCeilArrayPacked

        private FST.Arc<T> doSeekCeilArrayPacked​(FST.Arc<T> arc,
                                                 int targetLabel,
                                                 FST.BytesReader in)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekCeilList

        private FST.Arc<T> doSeekCeilList​(FST.Arc<T> arc,
                                          int targetLabel)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekFloor

        void doSeekFloor()
                  throws java.io.IOException
        Seeks to largest term that's <= target.
        Throws:
        java.io.IOException
      • doSeekFloorContinuous

        private FST.Arc<T> doSeekFloorContinuous​(FST.Arc<T> arc,
                                                 int targetLabel,
                                                 FST.BytesReader in)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekFloorArrayDirectAddressing

        private FST.Arc<T> doSeekFloorArrayDirectAddressing​(FST.Arc<T> arc,
                                                            int targetLabel,
                                                            FST.BytesReader in)
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • rollbackToLastForkThenPush

        private void rollbackToLastForkThenPush()
                                         throws java.io.IOException
        Target is beyond the last arc, out of label range. Dead end (target is after the last arc); rollback to last fork then push
        Throws:
        java.io.IOException
      • backtrackToFloorArc

        private FST.Arc<T> backtrackToFloorArc​(FST.Arc<T> arc,
                                               int targetLabel,
                                               FST.BytesReader in)
                                        throws java.io.IOException
        Backtracks until it finds a node which first arc is before our target label.` Then on the node, finds the arc just before the targetLabel.
        Returns:
        null to continue the seek floor recursion loop.
        Throws:
        java.io.IOException
      • findNextFloorArcDirectAddressing

        private void findNextFloorArcDirectAddressing​(FST.Arc<T> arc,
                                                      int targetLabel,
                                                      FST.BytesReader in)
                                               throws java.io.IOException
        Finds and reads an arc on the current node which label is strictly less than the given label. Skips the first arc, finds next floor arc; or none if the floor arc is the first arc itself (in this case it has already been read).

        Precondition: the given arc is the first arc of the node.

        Throws:
        java.io.IOException
      • doSeekFloorArrayPacked

        private FST.Arc<T> doSeekFloorArrayPacked​(FST.Arc<T> arc,
                                                  int targetLabel,
                                                  FST.BytesReader in)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekFloorList

        private FST.Arc<T> doSeekFloorList​(FST.Arc<T> arc,
                                           int targetLabel)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • doSeekExact

        boolean doSeekExact()
                     throws java.io.IOException
        Seeks to exactly target term.
        Throws:
        java.io.IOException
      • incr

        private void incr()
      • pushFirst

        private void pushFirst()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • pushLast

        private void pushLast()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getArc

        private FST.Arc<T> getArc​(int idx)