|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.brics.xact.analysis.soot.ControlFlowBuilder
public class ControlFlowBuilder
Utility class assisting in the construction of method bodies.
The control-flow builder acts as a cursor in the control-flow graph. When a new statement is added, it becomes the successor of the statement under the cursor, and the cursor then moves to the new statement. As a result, successive calls toaddStatement(dk.brics.xact.analysis.flowgraph.Statement)
creates a chain of statement nodes.
The control-flow graph can be split with startBranch()
. After calling, one or more calls
to useBranch()
must be made at points where the branches should join. Finally endBranch()
should be called after the last useBranch()
. For example, to create the following control-flow,
A / | \ B C D | | | E | | \ | / Fone could add the statements in this fashion:
A startBranch() B E useBranch() C useBranch() D useBranch() endBranch() F
Constructor Summary | |
---|---|
ControlFlowBuilder(FlowGraph g,
Origin origin)
Creates a builder for inserting statements in the specified method's body. |
Method Summary | |
---|---|
void |
addEdgeFrom(Statement s,
VariableFilter filter)
|
void |
addEdgeTo(Statement s,
VariableFilter filter)
|
void |
addFilter(VariableFilter filter)
|
void |
addStatement(Statement s)
Adds a statement at the current position in the control flow graph being built. |
void |
addStatement(Statement s,
VariableFilter filter)
Adds a statement at the current position in the control flow graph being built. |
Statement |
currentStatement()
|
void |
endBranch()
Ends the current branching. |
StatementPair |
finish()
Finishes the subgraph created by the builder, and returns the first and last statement in the subgraph. |
void |
moveToIsolation()
Removes the cursor from the control-flow graph, so statements will be placed in an isolated subgraph of their own. |
void |
moveToStatement(Statement to)
Moves the cursor to the specified statement, so new statements will be successors of the specified statement. |
void |
setOrigin(Origin origin)
Sets the origin assigned to nop nodes that are generated by the control-flow builder. |
void |
startBranch()
Starts a new branching and opens one branch in it. |
void |
useBranch()
Ends the current branch and starts a new one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ControlFlowBuilder(FlowGraph g, Origin origin)
Method Detail |
---|
public void addEdgeFrom(Statement s, VariableFilter filter)
public void addEdgeTo(Statement s, VariableFilter filter)
public void addFilter(VariableFilter filter)
public void addStatement(Statement s)
s
- a statement to add.public void addStatement(Statement s, VariableFilter filter)
s
- a statement to add.public Statement currentStatement()
public void endBranch()
useBranch()
.
See ControlFlowBuilder
for a description of the branching methods.
public StatementPair finish()
moveToStatement(dk.brics.xact.analysis.flowgraph.Statement)
,
addStatement(dk.brics.xact.analysis.flowgraph.Statement)
, or
NopStm
statement preceeding all statements added with addStatement(dk.brics.xact.analysis.flowgraph.Statement)
.
addStatement(dk.brics.xact.analysis.flowgraph.Statement)
, or a NopStm
succeeding it.
public void moveToIsolation()
public void moveToStatement(Statement to)
to
- statement to add from.
IllegalStateException
- if a branch is currently unclosed.
IllegalArgumentException
- if the specified statement belongs to a different method than the builderpublic void setOrigin(Origin origin)
origin
- public void startBranch()
ControlFlowBuilder
for a description of the branching methods.
public void useBranch()
ControlFlowBuilder
for a description of the branching methods.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |