java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.units.code.AbstractVisitResults<T> |
Known Direct Subclasses |
Skeleton implementation for visit result objects.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.IVisitResults
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public T | currentNode | for DFS pre-order only | |||||||||
public Deque<T> | parents | optional queue used to record parents; non-null only if FLAG_RECORD_PARENTS was used
when creating the object
|
|||||||||
public boolean | skipAssignmentDestination | ||||||||||
public boolean | skipVisitingChildren | for DFS pre-order only | |||||||||
public int | visitedChildPosition | Internal indicator field regarding the position of the visited child within its parent node. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractVisitResults() | |||||||||||
AbstractVisitResults(int flags) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | getFlags() | ||||||||||
int | getResultCode() | ||||||||||
void |
interrupt(boolean success, int code)
Notify the visitor that the visit of the tree should be stopped.
| ||||||||||
void |
interrupt(boolean success)
Notify the visitor that the visit of the tree should be stopped.
| ||||||||||
boolean | isInterruptedVisit() | ||||||||||
boolean | isVisitedSuccessfully() | ||||||||||
T |
parent(int index)
This convenience method returns the i'th ancestor (i=0 being the immediate parent) of the
element.
| ||||||||||
Iterator<T> |
parentsIterator()
Optional iterator containing the parents; non-null only if
FLAG_RECORD_PARENTS was
used when creating the object. | ||||||||||
void | popParent() | ||||||||||
void | pushParent(T parent) | ||||||||||
void |
setReplacedNode(T newNode)
Notify the visitor that the current node was replaced by the
process method. | ||||||||||
void |
setVisitResult(boolean success)
Saves the visit result (do not stop the visitor: use
interrupt(boolean) to stop the
process) | ||||||||||
void |
skipChildren()
Used in DFS pre-order to notify the visitor that the children of the currently visited node
should be skipped; the visitor will then proceed with the next cousin.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.IVisitResults
|
for DFS pre-order only
optional queue used to record parents; non-null only if FLAG_RECORD_PARENTS
was used
when creating the object
for DFS pre-order only
Internal indicator field regarding the position of the visited child within its parent node. This field may not be set, third-party code should not rely on it.
Notify the visitor that the visit of the tree should be stopped.
success | visit result |
---|---|
code | optional code, can be retrieved via getResultCode()
|
Notify the visitor that the visit of the tree should be stopped.
success | the result of the visit |
---|
This convenience method returns the i'th ancestor (i=0 being the immediate parent) of the element. On error, the method returns null (it never throws).
index | parent index, negative indices are allowed (-1 means the highest ancestor) |
---|
Optional iterator containing the parents; non-null only if FLAG_RECORD_PARENTS
was
used when creating the object. The first element provided by the iterator is the parent of
the currently visited element; the last element is the deepest ancestor.
Notify the visitor that the current node was replaced by the
process
method.
Note: usage of this method is not mandatory in a DFS post-order traversal.
newNode | the non-null new node |
---|
Saves the visit result (do not stop the visitor: use interrupt(boolean)
to stop the
process)
Used in DFS pre-order to notify the visitor that the children of the currently visited node should be skipped; the visitor will then proceed with the next cousin.
Note: this method is useless in DFS post-order since children of a node are always processed before their parent.