edu.cmu.cs.crystal.internal
Class ControlFlowGraph

java.lang.Object
  extended by edu.cmu.cs.crystal.internal.ControlFlowGraph

public class ControlFlowGraph
extends java.lang.Object


Constructor Summary
ControlFlowGraph(org.eclipse.jdt.core.dom.ASTNode node)
          Constructor.
 
Method Summary
static void addControlFlowNode(org.eclipse.jdt.core.dom.ASTNode astNode, ControlFlowNode cfn)
          Adds the mapping from ASTNode to ControlFlowNode for later lookup
static ControlFlowNode getControlFlowNode(org.eclipse.jdt.core.dom.ASTNode inNode)
          Retrieves the ControlFlowNode that is associated with the ASTNode.
 ControlFlowNode getEndNode()
          Retrieves the end dummy node for the graph
 java.util.Set<ControlFlowNode> getNodeSet()
          Generates a set of all nodes in the CFG
 ControlFlowNode getStartNode()
          Retrieves the start dummy node for the graph
static void removeControlFlowNode(org.eclipse.jdt.core.dom.ASTNode astNode)
          Removes a mapping from the ASTNode to ControlFlowNode map.
 java.lang.String toString()
          Creates a short textual representation of the CFG.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlFlowGraph

public ControlFlowGraph(org.eclipse.jdt.core.dom.ASTNode node)
Constructor. Initializes an empty CFG.

Method Detail

addControlFlowNode

public static void addControlFlowNode(org.eclipse.jdt.core.dom.ASTNode astNode,
                                      ControlFlowNode cfn)
Adds the mapping from ASTNode to ControlFlowNode for later lookup

Parameters:
astNode - the ASTNode
cfn - the ControlFlowNode

removeControlFlowNode

public static void removeControlFlowNode(org.eclipse.jdt.core.dom.ASTNode astNode)
Removes a mapping from the ASTNode to ControlFlowNode map. It is important to remove mappings that get removed from the CFG.

Parameters:
astNode - the node to remove

getControlFlowNode

public static ControlFlowNode getControlFlowNode(org.eclipse.jdt.core.dom.ASTNode inNode)
Retrieves the ControlFlowNode that is associated with the ASTNode. If the ASTNode does not have a direct CFN mapping, then find a parent node that does. Also responsible for caching.

Parameters:
inNode - the ASTNode
Returns:
the ControlFlowNode, or null if a CFG was never created.

getStartNode

public ControlFlowNode getStartNode()
Retrieves the start dummy node for the graph

Returns:
the starting node

getEndNode

public ControlFlowNode getEndNode()
Retrieves the end dummy node for the graph

Returns:
the end node

toString

public java.lang.String toString()
Creates a short textual representation of the CFG. (Currently only returns "A CFG")

Overrides:
toString in class java.lang.Object
Returns:
a string representing this CFG

getNodeSet

public java.util.Set<ControlFlowNode> getNodeSet()
Generates a set of all nodes in the CFG

Returns:
the set of all nodes in the CFG