public class TermNavigator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
TermNavigator.MutablePair
A mutable tuple of two types
|
Modifier and Type | Field and Description |
---|---|
private static int |
POOL_SIZE |
private java.util.ArrayDeque<TermNavigator.MutablePair> |
stack
top element on stack contains always the pair whose
first component is the element to be returned by
#next() while the second points to the child to
be visited next (or equals the arity of the first component
if no such child exists)
For all elements on the stack that are not the top element
the second component is less than the arity of the term in the
first component |
private static java.util.ArrayDeque<TermNavigator> |
TERM_NAVIGATOR_POOL
TERM_NAVIGATOR_POOL of TermNavigator as these are created very often and short-living
we reuse them as far as possible
The used TermNavigator have to be explicitly released by the user via
release() |
Modifier | Constructor and Description |
---|---|
private |
TermNavigator() |
private |
TermNavigator(Term term) |
Modifier and Type | Method and Description |
---|---|
static TermNavigator |
get(Term term)
returns a pooled
TermNavigator or a new one if the TERM_NAVIGATOR_POOL is currently empty
The used TermNavigator have to be explicitly released by the user via release() |
Term |
getCurrentSubterm() |
void |
gotoNext() |
private void |
gotoNextHelper() |
void |
gotoNextSibling() |
boolean |
hasNext() |
boolean |
hasNextSibling() |
void |
release() |
private static final int POOL_SIZE
private static java.util.ArrayDeque<TermNavigator> TERM_NAVIGATOR_POOL
release()
private final java.util.ArrayDeque<TermNavigator.MutablePair> stack
#next()
while the second points to the child to
be visited next (or equals the arity of the first component
if no such child exists)
For all elements on the stack that are not the top element
the second component is less than the arity of the term in the
first componentprivate TermNavigator()
private TermNavigator(Term term)
public static TermNavigator get(Term term)
TermNavigator
or a new one if the TERM_NAVIGATOR_POOL is currently empty
The used TermNavigator have to be explicitly released by the user via release()
TermNavigator
or a new one if the TERM_NAVIGATOR_POOL is currently emptypublic boolean hasNext()
public boolean hasNextSibling()
public Term getCurrentSubterm()
private void gotoNextHelper()
public void gotoNext()
public void gotoNextSibling()
public void release()