public class DebugTreeNodeStream extends java.lang.Object implements TreeNodeStream
| Modifier and Type | Field and Description |
|---|---|
protected TreeAdaptor |
adaptor |
protected DebugEventListener |
dbg |
protected boolean |
initialStreamState |
protected TreeNodeStream |
input |
protected int |
lastMarker
Track the last mark() call result value for use in rewind().
|
| Constructor and Description |
|---|
DebugTreeNodeStream(TreeNodeStream input,
DebugEventListener dbg) |
| Modifier and Type | Method and Description |
|---|---|
void |
consume() |
java.lang.Object |
get(int i)
Get a tree node at an absolute index i; 0..n-1.
|
java.lang.String |
getSourceName()
Where are you getting symbols from? Normally, implementations will
pass the buck all the way to the lexer who can ask its input stream
for the file name or whatever.
|
TokenStream |
getTokenStream()
If the tree associated with this stream was created from a TokenStream,
you can specify it here.
|
TreeAdaptor |
getTreeAdaptor()
What adaptor can tell me how to interpret/navigate nodes and
trees.
|
java.lang.Object |
getTreeSource()
Where is this stream pulling nodes from? This is not the name, but
the object that provides node objects.
|
int |
index()
Return the current input symbol index 0..n where n indicates the
last symbol has been read.
|
int |
LA(int i)
Get int at current input pointer + i ahead where i=1 is next int.
|
java.lang.Object |
LT(int i)
Get tree node at current input pointer + i ahead where i=1 is next node.
|
int |
mark()
Tell the stream to start buffering if it hasn't already.
|
void |
release(int marker)
You may want to commit to a backtrack but don't want to force the
stream to keep bookkeeping objects around for a marker that is
no longer necessary.
|
void |
replaceChildren(java.lang.Object parent,
int startChildIndex,
int stopChildIndex,
java.lang.Object t)
Replace from start to stop child index of parent with t, which might
be a list.
|
void |
reset()
Reset the tree node stream in such a way that it acts like
a freshly constructed stream.
|
void |
rewind()
Rewind to the input position of the last marker.
|
void |
rewind(int marker)
Reset the stream so that next call to index would return marker.
|
void |
seek(int index)
Set the input cursor to the position indicated by index.
|
void |
setDebugListener(DebugEventListener dbg) |
void |
setUniqueNavigationNodes(boolean uniqueNavigationNodes)
It is normally this object that instructs the node stream to
create unique nav nodes, but to satisfy interface, we have to
define it.
|
int |
size()
Only makes sense for streams that buffer everything up probably, but
might be useful to display the entire stream or for testing.
|
java.lang.String |
toString(java.lang.Object start,
java.lang.Object stop)
Return the text of all nodes from start to stop, inclusive.
|
protected DebugEventListener dbg
protected TreeAdaptor adaptor
protected TreeNodeStream input
protected boolean initialStreamState
protected int lastMarker
public DebugTreeNodeStream(TreeNodeStream input, DebugEventListener dbg)
public void setDebugListener(DebugEventListener dbg)
public TreeAdaptor getTreeAdaptor()
TreeNodeStreamgetTreeAdaptor in interface TreeNodeStreampublic java.lang.Object get(int i)
TreeNodeStreamget in interface TreeNodeStreampublic java.lang.Object LT(int i)
TreeNodeStreamLT in interface TreeNodeStreampublic int LA(int i)
IntStreampublic int mark()
IntStreampublic int index()
IntStreampublic void rewind(int marker)
IntStreampublic void rewind()
IntStreampublic void release(int marker)
IntStreampublic void seek(int index)
IntStreampublic int size()
IntStreampublic void reset()
TreeNodeStreamreset in interface TreeNodeStreampublic java.lang.Object getTreeSource()
TreeNodeStreamgetTreeSource in interface TreeNodeStreampublic java.lang.String getSourceName()
IntStreamgetSourceName in interface IntStreampublic TokenStream getTokenStream()
TreeNodeStreamgetTokenStream in interface TreeNodeStreampublic void setUniqueNavigationNodes(boolean uniqueNavigationNodes)
setUniqueNavigationNodes in interface TreeNodeStreampublic void replaceChildren(java.lang.Object parent,
int startChildIndex,
int stopChildIndex,
java.lang.Object t)
TreeNodeStreamreplaceChildren in interface TreeNodeStreampublic java.lang.String toString(java.lang.Object start,
java.lang.Object stop)
TreeNodeStreamtoString in interface TreeNodeStream