spiglet.translate.graph
Class FlowGraph<T>

java.lang.Object
  extended by spiglet.translate.graph.Graph
      extended by spiglet.translate.graph.FlowGraph<T>
Type Parameters:
T - the type of the variable (member of def and use sets) associated with the flow graph's nodes.
Direct Known Subclasses:
SpigletFlowGraph

public abstract class FlowGraph<T>
extends Graph

This class represents an abstract control flow graph. The nodes in this graph are represented as a linked list and the edges as lists in the fields of each node. In a flow graph, if a statement is followed by another, there exists a directed edge between them.

Author:
Santoso Wijaya
See Also:
SpigletFlowGraph, Node

Field Summary
 
Fields inherited from class spiglet.translate.graph.Graph
nodes
 
Constructor Summary
FlowGraph()
           
 
Method Summary
abstract  java.util.Set<T> def(Node node)
          Returns the set of variables that are in the def set of the given node.
 Node getEntryNode()
          Returns the node that is mapped to the entry statement of the thread.
 Node getExitNode()
          Returns the node that is mapped to the exit statement of the thread.
abstract  java.util.Set<T> use(Node node)
          Returns the set of variables that are in the use set of the given node.
 
Methods inherited from class spiglet.translate.graph.Graph
addEdge, addNode, check, createNode, getNodes, removeEdge, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FlowGraph

public FlowGraph()
Method Detail

getEntryNode

public Node getEntryNode()
Returns the node that is mapped to the entry statement of the thread. This is the first node that is added to the graph, on the proviso that the StmtList used to create the graph is traversed top to down.

Returns:
the entry node

getExitNode

public Node getExitNode()
Returns the node that is mapped to the exit statement of the thread. This is the last node that is added to the graph, assuming the StmtList used to create the graph is traversed top to down.

Returns:
the exit node

def

public abstract java.util.Set<T> def(Node node)
Returns the set of variables that are in the def set of the given node.

Parameters:
node - the node to look up
Returns:
the set of variables in the def set of the given node

use

public abstract java.util.Set<T> use(Node node)
Returns the set of variables that are in the use set of the given node.

Parameters:
node - the node to look up
Returns:
the set of variables in the use set of the given node