|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.uci.eecs.doc.cascade.controlflow.Node
public class Node
A base class for source code constructs in control flow graphs and trees.
| Field Summary | |
|---|---|
protected StructuredBlock |
block
|
protected Node |
nextNode
|
protected Node |
parent
|
protected int |
scope
|
protected Tree |
tree
|
| Constructor Summary | |
|---|---|
protected |
Node(Tree tree,
int scope,
Node parent)
|
| Method Summary | |
|---|---|
StructuredBlock |
getBlock()
Returns a handle to the corresponding JODE object representing this node. |
Loop |
getEnclosingLoop()
Returns a handle to the node's enclosing loop, if one exists. |
protected InstructionHandle |
getFirstInstruction()
|
List<InstructionHandle> |
getInstructions()
Returns the list of instructions that correspond to this control flow node. |
protected InstructionHandle |
getLastInstruction()
|
List<MethodInvocation> |
getMethodInvocations()
Returns the methods that this node invokes in the order in which they are invoked. |
protected List<MethodInvocation> |
getMethodInvocations(Operator operator)
|
Node |
getNext()
Returns the next node in this node's scope (lexical level). |
Loop |
getOutermostLoop()
Returns the outermost enclosing loop of this node. |
Node |
getParent()
Returns the parent of the given node. |
int |
getScope()
Returns the lexical scope of this node. |
int |
getSourceCodeLineNumber()
Returns the line number of the source code on which this node begins. |
int |
getStartAddress()
Returns the address in the bytecode where this node begins. |
Tree |
getTree()
Returns the control flow tree to which this node belongs. |
Iterator<Node> |
iterator()
Returns an iterator that iterates over this node and all of its children. |
Node |
lastNode()
This helper function walks this node's scope (lexical level) and returns the last one it sees. |
void |
setNext(Node nextNode)
Sets the next node in this node's scope (lexical level). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Node nextNode
protected Node parent
protected StructuredBlock block
protected int scope
protected Tree tree
| Constructor Detail |
|---|
protected Node(Tree tree,
int scope,
Node parent)
| Method Detail |
|---|
public Tree getTree()
public int getScope()
void foobar(int i) {
if (i == 42) // scope 0
i++; // scope 1
i *= 9; // scope 0
...
public Node getParent()
void foobar(int i) {
if (i == 42) // parent is null
i++; // parent is if-then-else node
i *= 9; // parent is null
...
public Iterator<Node> iterator()
iterator in interface Iterable<Node>TreeIteratorpublic Node getNext()
val*=10 in the following code, then getNext()
would return a node representing b=true. But if this node is
i--, then getNext() returns null.
if (i > 0)
{
val *= 10;
b = true;
i--;
}
public void setNext(Node nextNode)
nextNode - the next nodepublic StructuredBlock getBlock()
public List<InstructionHandle> getInstructions()
getBlock() returns null), to
avoid null pointer exceptions.
public List<MethodInvocation> getMethodInvocations()
public int getStartAddress()
public int getSourceCodeLineNumber()
throws UnknownLineNumberException
UnknownLineNumberException - if the line number for the node could not be determinedpublic Node lastNode()
public Loop getEnclosingLoop()
for (...)
{
NODE
}
but in this example, calling NODE.getEnclosingLoop() returns null:
for (...)
{
myMethod();
}
void myMethod()
{
NODE
}
getOutermostLoop()public Loop getOutermostLoop()
getEnclosingLoop()protected InstructionHandle getFirstInstruction()
protected InstructionHandle getLastInstruction()
protected List<MethodInvocation> getMethodInvocations(Operator operator)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||