|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsofya.apps.dejavu.EdgeSelector
public abstract class EdgeSelector
The edge selector retrieves and matches edges from the graphs being traversed, using this information to control how the graph traverser walks the graphs.
The graph traverser raises 'event' methods defined by this class to indicate when it is at certain points in the traversal. This provides an edge selector the opportunity to guide the graph traverser based on knowledge it has about the specific types of edges (and nodes) contained in the graphs being walked, and special conditions which may apply to the particular type of graph. An edge selector is also responsible for determining how to handle new edges found in the graph for a new version of a method.
Nested Class Summary | |
---|---|
static class |
EdgeSelector.EdgeMatchData
Data container class which records information about the outgoing edges from nodes in each graph and the path (or paths) the traverser should follow next. |
static class |
EdgeSelector.EdgeTraversal
Data container class which is used to direct the behavior of the graph traverser. |
Field Summary | |
---|---|
protected Graph |
newGraph
Graph for the method from the new version of the program. |
protected Graph |
oldGraph
Graph for the method from the old version of the program. |
Constructor Summary | |
---|---|
EdgeSelector()
|
Method Summary | |
---|---|
abstract EdgeSelector.EdgeMatchData |
beginVisit(Node oldNode,
Node newNode)
Event raised by the traverser when it reaches a node in the graph which has not been visited. |
protected Edge |
findEdge(Edge[] edgeList,
Node sourceNode,
Node sinkNode)
Utility method to find the first edge with the given source and sink nodes in a list of edges. |
protected java.util.List |
findEdges(Edge[] edgeList,
Node sourceNode,
Node sinkNode)
Utility method to find all edges with the given source and sink nodes in a list of edges. |
Graph[] |
getGraphs()
Gets the graphs currently in use. |
protected Edge |
matchLabelToEdge(Edge[] edgeList,
java.lang.String edgeLabel)
Utility method to find an edge with a given basic label in a list of edges. |
abstract void |
newEdges(Node oldNode,
java.util.List newEdges,
EdgeSelector.EdgeMatchData edgeData,
java.util.Set dangerousEdges)
Event raised by the traverser when it has determined that the graph for the new version of the method contains new edges out of a given node. |
abstract EdgeSelector.EdgeTraversal |
nodesCompared(Edge oldEdge,
Edge newEdge)
Event raised by the traverser immediately after comparison of two successor nodes when it is in the process of following all outgoing edges from a node. |
void |
setGraphs(Graph oldGraph,
Graph newGraph)
Sets the graphs for the old and new versions of the methods. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Graph oldGraph
protected Graph newGraph
Constructor Detail |
---|
public EdgeSelector()
Method Detail |
---|
public abstract EdgeSelector.EdgeMatchData beginVisit(Node oldNode, Node newNode)
This event provides an opportunity for subclasses to produce edge data and control the traversal based on information that may be available from specific types of edges contained in the graphs.
oldNode
- Node in the graph for the old version of the method.newNode
- Node in the graph for the new version of the method
which has been determined to correspond to oldNode
.
public abstract EdgeSelector.EdgeTraversal nodesCompared(Edge oldEdge, Edge newEdge)
This event provides an opportunity for subclasses to provide special case control over the traversal based on information that may be available from specific types of edges and nodes contained in the graphs.
oldEdge
- Edge which was followed in the old graph to reach
the node from that graph which was used in the comparison.newEdge
- Edge which was followed in the new graph to reach
the node from that graph which was used in the comparison.
public abstract void newEdges(Node oldNode, java.util.List newEdges, EdgeSelector.EdgeMatchData edgeData, java.util.Set dangerousEdges)
This event provides an opportunity for subclasses to specify how the new edges impact the dangerous edge set based on information that may be available from specific types of edges and nodes contained in the graphs.
oldNode
- Node from the graph of the old version of the method
from which new outgoing edges were found in the graph for the new
version of the method.newEdges
- List of the new outgoing edges found in the graph
for the new version of the method at the given node.edgeData
- Data about outgoing edges in both graphs, as
determined by the last call to beginVisit(sofya.graphs.Node, sofya.graphs.Node)
.dangerousEdges
- Set containing the dangerous edges identified
by the traversal up to the current point.public void setGraphs(Graph oldGraph, Graph newGraph)
oldGraph
- Graph corresponding to the old version of the method.newGraph
- Graph corresponding to the new version of the method.public Graph[] getGraphs()
protected Edge findEdge(Edge[] edgeList, Node sourceNode, Node sinkNode)
edgeList
- List of edges to be searched, as an array.sourceNode
- Node which must be the predecessor node of
a matching edge.sinkNode
- Node which must be the successor node of a
matching edge.
null
if no matching edge can be found.protected java.util.List findEdges(Edge[] edgeList, Node sourceNode, Node sinkNode)
edgeList
- List of edges to be searched, as an array.sourceNode
- Node which must be the predecessor node of
a matching edge.sinkNode
- Node which must be the successor node of a
matching edge.
protected Edge matchLabelToEdge(Edge[] edgeList, java.lang.String edgeLabel)
edgeList
- List of edges to be searched, as an array.edgeLabel
- Basic label of the edge to found. (Auxiliary
label information is ignored).
null
if no such edge exists.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |