public final class CfgWalker
extends java.lang.Object
Provides methods for traversing nodes of CfgModel
control flow graph model.
Actions taken in the traversal process depend on the current status of the visitor (see
CfgVisitor.Status
). Possible status values are:
The status is checked after calling any visitor method. Once Status.ABORT
is set,
all traversal methods cease the execution. If after a call to a method having the Begin suffix
(e.g. onModuleBegin), the Status.SKIP
status is set, nested elements of the visited node
(child nodes or subtrees) are not traversed and a corresponding terminating method
(that has the End suffix eg. onModuleEnd) is called.
Constructor and Description |
---|
CfgWalker(CfgVisitor visitor)
Constructs object with the specified visitor.
|
CfgWalker(CfgVisitor visitor,
CfgWalkerMode mode)
Constructs object with the specified visitor and mode.
|
Modifier and Type | Method and Description |
---|---|
CfgVisitor |
getVisitor()
Returns visitor.
|
void |
start(CfgModel model)
Starts control flow graph model walking.
|
void |
visit(java.lang.Iterable<CfgModelNode> nodes)
Visits a sequence of control flow graph model nodes.
|
void |
visitNode(CfgModelNode node)
Visits the specified node.
|
public CfgWalker(CfgVisitor visitor)
By default, object's mode is "depth-first search without repetitions".
visitor
- visitor to be applied to control flow graph modeljava.lang.IllegalArgumentException
- when argument is null
.public CfgWalker(CfgVisitor visitor, CfgWalkerMode mode)
visitor
- visitor to be applied to control flow graph modelmode
- visiting and walking modejava.lang.IllegalArgumentException
- when any of the arguments is null
.public CfgVisitor getVisitor()
CfgVisitor
public void start(CfgModel model)
model
- control flow graph modeljava.lang.IllegalArgumentException
- when argument is null
.public void visit(java.lang.Iterable<CfgModelNode> nodes)
nodes
- a sequence of nodes to be visitedjava.lang.IllegalArgumentException
- when argument is null
.public void visitNode(CfgModelNode node)
node
- node to be visitedjava.lang.IllegalArgumentException
- when argument is null
.