public abstract class LookaheadStream<T> extends FastQueue<T>
Modifier and Type | Field and Description |
---|---|
T |
eof
Returned by nextElement upon end of stream; we add to buffer also
|
protected int |
eofElementIndex
Set to buffer index of eof when nextElement returns eof
|
protected int |
lastMarker
Track the last mark() call result value for use in rewind().
|
protected int |
markDepth
tracks how deep mark() calls are nested
|
static int |
UNINITIALIZED_EOF_ELEMENT_INDEX |
Constructor and Description |
---|
LookaheadStream(T eof) |
Modifier and Type | Method and Description |
---|---|
void |
consume()
Make sure we have at least one element to remove, even if EOF
|
void |
fill(int n)
add n elements to buffer
|
Object |
getCurrentSymbol() |
int |
index() |
protected Object |
LB(int k)
Look backwards k nodes
|
Object |
LT(int k) |
int |
mark() |
abstract T |
nextElement()
Implement nextElement to supply a stream of elements to this
lookahead buffer.
|
void |
release(int marker) |
T |
remove()
Get and remove first element in queue; override FastQueue.remove()
|
void |
reset() |
void |
rewind() |
void |
rewind(int marker) |
void |
seek(int index)
Seek to a 0-indexed position within data buffer.
|
int |
size()
Size of entire stream is unknown; we only know buffer size from FastQueue
|
void |
sync(int need)
Make sure we have 'need' elements from current position p.
|
public static final int UNINITIALIZED_EOF_ELEMENT_INDEX
protected int eofElementIndex
public T eof
protected int lastMarker
protected int markDepth
public LookaheadStream(T eof)
public abstract T nextElement()
public T remove()
public void consume()
public void sync(int need)
public void fill(int n)
public int size()
public Object LT(int k)
protected Object LB(int k)
public Object getCurrentSymbol()
public int index()
public int mark()
public void release(int marker)
public void rewind(int marker)
public void rewind()
public void seek(int index)
Copyright © 2020. All rights reserved.