public class ChunkedWordIter extends BasicWordIter implements Cloneable
Chunk
s. Applies section limits at empty chunks
(section limits can be overcome in any method to which they apply by
simply setting the 'force' parameter.)Modifier and Type | Field and Description |
---|---|
protected Chunk |
chunk
Current chunk whose tokens we're currently traversing
|
protected ChunkSource |
chunkSource
Source for fetching chunks
|
maxWordPos, text, tokens, tokNum, wordPos
FIELD_END, FIELD_START, TERM_END, TERM_END_PLUS, TERM_START
Constructor and Description |
---|
ChunkedWordIter(ChunkSource chunkSource)
Construct the iterator to access text from the given chunk source.
|
Modifier and Type | Method and Description |
---|---|
MarkPos |
createPos() |
void |
getPos(MarkPos pos,
int startOrEnd)
Replace the position within a MarkPos created by
WordIter.getPos(int)
using the iterator's current position. |
boolean |
next(boolean force)
Advance to the next word.
|
boolean |
prev(boolean force)
Back up to the previous word.
|
protected void |
reseek(Chunk toChunk) |
protected void |
reseek(int targetPos) |
void |
seekFirst(int targetPos,
boolean force)
Reposition the iterator at the first word whose position is
greater than or equal to 'wordPos'.
|
void |
seekLast(int targetPos,
boolean force)
Reposition the iterator at the last word whose position is
less than or equal to 'wordPos'.
|
clone, getPos, term
protected ChunkSource chunkSource
protected Chunk chunk
public ChunkedWordIter(ChunkSource chunkSource)
chunkSource
- Source to read chunks from.public boolean next(boolean force)
WordIter
next
in interface WordIter
next
in class BasicWordIter
force
- true to ignore section boundariespublic boolean prev(boolean force)
WordIter
prev
in interface WordIter
prev
in class BasicWordIter
force
- true to ignore section boundariesprotected void reseek(int targetPos)
protected void reseek(Chunk toChunk)
public void seekFirst(int targetPos, boolean force)
WordIter
seekFirst
in interface WordIter
seekFirst
in class BasicWordIter
targetPos
- Position to seek toforce
- true to ignore section boundariespublic void seekLast(int targetPos, boolean force)
WordIter
seekLast
in interface WordIter
seekLast
in class BasicWordIter
targetPos
- Position to seek toforce
- true to ignore section boundariespublic MarkPos createPos()
public void getPos(MarkPos pos, int startOrEnd)
WordIter
WordIter.getPos(int)
using the iterator's current position.getPos
in interface WordIter
getPos
in class BasicWordIter
startOrEnd
- FIELD_START for the very start of the field;
TERM_START for the first character of the word;
TERM_END for the last character of the word;
TERM_END_PLUS for the last character plus any trailing
punctuation and/or spaces;
FIELD_END for the very last end of the field.