Package org.apache.lucene.util.fst
Class FSTEnum<T>
- java.lang.Object
-
- org.apache.lucene.util.fst.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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private FST.Arc<T>
backtrackToFloorArc(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
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.protected void
doNext()
protected void
doSeekCeil()
Seeks to smallest term that's >= target.private FST.Arc<T>
doSeekCeilArrayDirectAddressing(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
private FST.Arc<T>
doSeekCeilArrayPacked(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
private FST.Arc<T>
doSeekCeilList(FST.Arc<T> arc, int targetLabel)
(package private) boolean
doSeekExact()
Seeks to exactly target term.(package private) void
doSeekFloor()
Seeks to largest term that's <= target.private FST.Arc<T>
doSeekFloorArrayDirectAddressing(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
private FST.Arc<T>
doSeekFloorArrayPacked(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
private FST.Arc<T>
doSeekFloorList(FST.Arc<T> arc, int targetLabel)
private void
findNextFloorArcBinarySearch(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
Same asfindNextFloorArcDirectAddressing(org.apache.lucene.util.fst.FST.Arc<T>, int, org.apache.lucene.util.fst.FST.BytesReader)
for binary search node.private void
findNextFloorArcDirectAddressing(FST.Arc<T> arc, int targetLabel, FST.BytesReader in)
Finds and reads an arc on the current node which label is strictly less than the given label.private FST.Arc<T>
getArc(int idx)
protected abstract int
getCurrentLabel()
protected abstract int
getTargetLabel()
protected abstract void
grow()
private void
incr()
private void
pushFirst()
private void
pushLast()
private void
rewindPrefix()
Rewinds enum state to match the shared prefix between current term and target termprotected abstract void
setCurrentLabel(int label)
-
-
-
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
-
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
-
doSeekFloorArrayDirectAddressing
private FST.Arc<T> doSeekFloorArrayDirectAddressing(FST.Arc<T> arc, int targetLabel, FST.BytesReader in) throws java.io.IOException
- 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
-
findNextFloorArcBinarySearch
private void findNextFloorArcBinarySearch(FST.Arc<T> arc, int targetLabel, FST.BytesReader in) throws java.io.IOException
Same asfindNextFloorArcDirectAddressing(org.apache.lucene.util.fst.FST.Arc<T>, int, org.apache.lucene.util.fst.FST.BytesReader)
for binary search 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
-
-