public interface

IVisitResults

com.pnfsoftware.jeb.core.units.code.IVisitResults<T>
Known Indirect Subclasses

Class Overview

Visit results interface for statement trees.

Summary

Constants
int FLAG_RECORD_PARENTS Record the parents in a stack, made available when visiting a child.
int FLAG_SKIP_ASSIGN_DST Skip written (defined) elements.
Public Methods
abstract int getResultCode()
abstract void interrupt(boolean success, int code)
Notify the visitor that the visit of the tree should be stopped.
abstract void interrupt(boolean success)
Notify the visitor that the visit of the tree should be stopped.
abstract boolean isInterruptedVisit()
abstract boolean isVisitedSuccessfully()
abstract T parent(int index)
This convenience method returns the i'th ancestor (i=0 being the immediate parent) of the element.
abstract Iterator<T> parentsIterator()
Optional iterator containing the parents; non-null only if FLAG_RECORD_PARENTS was used when creating the object.
abstract void setReplacedNode(T newNode)
Notify the visitor that the current node was replaced by the process method.
abstract void setVisitResult(boolean success)
Saves the visit result (do not stop the visitor: use interrupt(boolean) to stop the process)
abstract 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.

Constants

public static final int FLAG_RECORD_PARENTS

Record the parents in a stack, made available when visiting a child. Parents recording is seldom used, and disabled by default.

Constant Value: 1 (0x00000001)

public static final int FLAG_SKIP_ASSIGN_DST

Skip written (defined) elements. Note: the name of this flag is misleading, implementations may skip more than simply the destination of assignments.

Constant Value: 2 (0x00000002)

Public Methods

public abstract int getResultCode ()

public abstract void interrupt (boolean success, int code)

Notify the visitor that the visit of the tree should be stopped.

Parameters
success visit result
code optional code, can be retrieved via getResultCode()

public abstract void interrupt (boolean success)

Notify the visitor that the visit of the tree should be stopped.

Parameters
success the result of the visit

public abstract boolean isInterruptedVisit ()

public abstract boolean isVisitedSuccessfully ()

public abstract T parent (int index)

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).

Parameters
index parent index, negative indices are allowed (-1 means the highest ancestor)
Returns
  • the requested parent or null

public abstract Iterator<T> parentsIterator ()

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.

public abstract void setReplacedNode (T newNode)

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.

Parameters
newNode the non-null new node

public abstract void setVisitResult (boolean success)

Saves the visit result (do not stop the visitor: use interrupt(boolean) to stop the process)

public abstract 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.

Note: this method is useless in DFS post-order since children of a node are always processed before their parent.