Class ShingleFilter.CircularSequence
- java.lang.Object
-
- org.apache.lucene.analysis.shingle.ShingleFilter.CircularSequence
-
- Enclosing class:
- ShingleFilter
private class ShingleFilter.CircularSequence extends java.lang.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 Summary
Fields Modifier and Type Field Description private int
minValue
private int
previousValue
private int
value
-
Constructor Summary
Constructors Constructor Description CircularSequence()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advance()
Increments this circular number's value to the next member in the circular sequencegramSize
will take on values from the circular sequence { [ 1, ]ShingleFilter.minShingleSize
[ , ...boolean
atMinValue()
Returns true if the current value is the first member of the circular sequence.int
getPreviousValue()
int
getValue()
void
reset()
Sets this circular number's value to the first member of the circular sequence
-
-
-
Method Detail
-
getValue
public int getValue()
- Returns:
- the current value.
- See Also:
advance()
-
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 beShingleFilter.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
-
-