|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.apps.dejavu.GraphTraverser
public class GraphTraverser
This class traverses two graphs using a node comparer to build a list of dangerous edges.
A dangerous edge is one which:
The traverser is designed to be completely polymorphic, in that it
operates on any Graph
or subclass, and uses an
externally specified node comparer which presumably is appropriate
for the type of graph being traversed. Generally it is expected
that nodes encode type information consistent with the types
defined in SConstants
, which is to say node type
information that should be relevant to any type of graph constructed
from Java code. In the absence of certain expected but optional type
information, the traverser will emit appropriate warnings but
will not terminate.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface sofya.base.SConstants |
---|
SConstants.BlockLabel, SConstants.BlockObjectType, SConstants.BlockSubType, SConstants.BlockType, SConstants.BranchObjectType, SConstants.BranchType, SConstants.EDObjectType, SConstants.TraceObjectType |
Field Summary |
---|
Fields inherited from interface sofya.base.SConstants |
---|
DEFAULT_PORT, INST_COMPATIBLE, INST_OLD_UNSUPPORTED, INST_OPT_NORMAL, INST_OPT_SEQUENCE, SIG_CHKALIVE, SIG_ECHO |
Constructor Summary | |
---|---|
protected |
GraphTraverser()
Protected constructor for subclasses only. |
|
GraphTraverser(NodeComparer nc,
EdgeSelector es)
Standard constructor, initializes the traverser with the given node comparer. |
Method Summary | |
---|---|
Edge[] |
getDangerousEdges(MethodPair method)
Gets the list of dangerous edges by invoking the traverser to walk the graphs. |
NodeComparer |
getNodeComparer()
Returns the node comparer which the traverser is currently set to use to test node equivalence. |
void |
setNodeComparer(NodeComparer nc)
Sets the node comparer which the traverser should use to test node equivalence. |
protected void |
traverseGraph(Node oldNode,
Node newNode)
Recursively traverses two graphs from the given start nodes in each graph respectively. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected GraphTraverser()
public GraphTraverser(NodeComparer nc, EdgeSelector es)
nc
- Node comparer which will be used to test nodes in the
graph for equivalence.Method Detail |
---|
public NodeComparer getNodeComparer()
public void setNodeComparer(NodeComparer nc)
Note: If the node comparer does not handle the type of node contained in the supplied graphs, the traverser will fail.
nc
- New node comparer to be used by the traverser
when checking nodes for equivalence.public Edge[] getDangerousEdges(MethodPair method) throws MethodNotFoundException, java.io.IOException
method
- Method pair that supplies the names and
control flow graphs for the two methods to be compared.
MethodNotFoundException
- If a method specified in
method
cannot be found in a class file loaded
by the traverser.
java.io.IOException
- For any IO error that prevents the
traverser from successfully reading a required input file.protected void traverseGraph(Node oldNode, Node newNode) throws MethodNotFoundException
The graph is traversed until all paths have reached an exit node or a changed node. There is no guarantee that the graph is traversed completely or that every node is visited.
oldNode
- Node in the old graph from which to start
the traversal.newNode
- Node in the new graph from which to start
the traversal.
MethodNotFoundException
- If the method currently
being traversed cannot be found in the classfile currently
loaded by the node comparer.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |