|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.uci.eecs.doc.cascade.tree.Tree
public class Tree
A control flow tree of a Java method or part of a Java method. This data structure is nearly identical to a control flow graph (CFG), but having a tree structure, it can be parsed more easily and can be displayed in a manner that closely resembles the original source code structure.
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares this tree to the specified object. |
Tree |
getCallerTree()
Returns a handle to the control flow tree that invoked this control flow tree. |
List<String> |
getClassPath()
Returns the class path that was specified when the tree was created. |
List<InstructionHandle> |
getInstructions()
Returns the complete list of instructions that correspond to this tree's method. |
Tree |
getInvokedTree(InstructionHandle instructionHandle)
Returns a control flow tree representing the method that the given invocation instruction invokes. |
Field |
getInvokingField()
Returns a handle to the field that was used to invoke this control flow tree. |
Method |
getMethod()
Returns the method from which this control flow tree was constructed. |
Set<Method> |
getMethodInvocations()
Returns the methods that this tree invokes. |
Set<Method> |
getMethodInvocations(Node startNode)
Returns the methods that the given node invokes. |
Node |
getRootNode()
Returns the node at the top of the control flow tree (the entry point). |
Tree |
getRootTree()
Returns the control flow tree at the top of the call graph. |
int |
hashCode()
Returns a hash code for this tree. |
Iterator<Node> |
iterator()
Returns an iterator that will walk through every node of this control flow tree. |
static Tree |
load(List<String> classPath,
Method method,
Tree callerTree,
Field invokingField)
Creates a new control flow tree. |
String |
toString()
Returns a simple one-line string describing the method represented by this tree. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static Tree load(List<String> classPath, Method method, Tree callerTree, Field invokingField) throws IOException, NoSuchMethodException, ClassNotFoundException
classPath
- a list of directories that will be searched when loading
classes during control flow constructionmethod
- the method whose control flow tree should be createdcallerTree
- a control flow tree that invoked this tree (or null if this is the root tree)invokingField
- the field used to invoke this tree (or null if no field was used)
IOException
- if the method cannot be loaded
NoSuchMethodException
- if the method cannot be found
ClassNotFoundException
- if a class in the control flow cannot be loadedpublic Node getRootNode()
public Tree getRootTree()
void methodA() { methodB(); } void methodB() { methodC(); } void methodC() {}This method will return A's control flow tree if invoked on a tree representing method B or C.
public Method getMethod()
public Tree getCallerTree()
public Field getInvokingField()
public List<String> getClassPath()
public Set<Method> getMethodInvocations()
public Set<Method> getMethodInvocations(Node startNode)
Node.getMethodInvocations()
, the returned set includes method
invocations in sub-scopes. For example, consider the following code:
if (isAvailable()) { requestMessage(); }Calling
Node.getMethodInvocations()
on this if-then-else node would
return only isAvailable()
. However, if
Tree.getMethodInvocations()
were called with the if-then-else node
as a parameter, the returned set would include both isAvailable()
and requestMessage()
.
startNode
- a node in a control flow tree
public Tree getInvokedTree(InstructionHandle instructionHandle)
instructionHandle
- a handle to an invocation instruction
(instructionHandle.getInstruction() must be of type InvokeInstruction)
public List<InstructionHandle> getInstructions()
public Iterator<Node> iterator()
iterator
in interface Iterable<Node>
public boolean equals(Object obj)
Tree
object for the same method that this tree
represents.
equals
in class Object
obj
- the object to compare this tree against
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |