Class ShingleFilter.CircularSequence

java.lang.Object
org.apache.lucene.analysis.shingle.ShingleFilter.CircularSequence
Enclosing class:
ShingleFilter

private class ShingleFilter.CircularSequence extends Object
An instance of this class is used to maintain the number of input stream tokens that will be used to compose the next unigram or shingle: ShingleFilter.gramSize.

gramSize will take on values from the circular sequence { [ 1, ] ShingleFilter.minShingleSize [ , ... , ShingleFilter.maxShingleSize ] }.

1 is included in the circular sequence only if ShingleFilter.outputUnigrams = true.

  • Field Details

    • value

      private int value
    • previousValue

      private int previousValue
    • minValue

      private int minValue
  • Constructor Details

    • CircularSequence

      public CircularSequence()
  • Method Details

    • getValue

      public int getValue()
      Returns:
      the current value.
      See Also:
    • advance

      public void advance()
      Increments this circular number's value to the next member in the circular sequence gramSize will take on values from the circular sequence { [ 1, ] ShingleFilter.minShingleSize [ , ... , ShingleFilter.maxShingleSize ] }.

      1 is included in the circular sequence only if ShingleFilter.outputUnigrams = true.

    • reset

      public void reset()
      Sets this circular number's value to the first member of the circular sequence

      gramSize will take on values from the circular sequence { [ 1, ] ShingleFilter.minShingleSize [ , ... , ShingleFilter.maxShingleSize ] }.

      1 is included in the circular sequence only if ShingleFilter.outputUnigrams = true.

    • atMinValue

      public boolean atMinValue()
      Returns true if the current value is the first member of the circular sequence.

      If ShingleFilter.outputUnigrams = true, the first member of the circular sequence will be 1; otherwise, it will be ShingleFilter.minShingleSize.

      Returns:
      true if the current value is the first member of the circular sequence; false otherwise
    • getPreviousValue

      public int getPreviousValue()
      Returns:
      the value this instance had before the last advance() call