org.jtool.jxplatform.graph.cfg
Class GetReachableNodes

java.lang.Object
  extended byorg.jtool.jxplatform.graph.cfg.GetReachableNodes

public class GetReachableNodes
extends java.lang.Object

Calculates reachable nodes on a CFG.

Author:
Katsuhsa Maruyama

Constructor Summary
GetReachableNodes(CFG cfg, CFGNode fromNode, CFGNode toNode)
          Calculates reachable path between two CFG nodes and records nodes in the path.
 
Method Summary
 boolean contains(CFGNode node)
          Tests if the collection of the reachable nodes contains a node.
 GraphElementSet getBackwardReachableNode()
          Returns the collection of nodes passed backward on a CFG.
 GraphElementSet getForwardReachableNode()
          Returns the collection of nodes passed forward on a CFG.
 boolean isEmpty()
          Tests if there is no reachable node.
 java.util.Iterator iterator()
          Returns an iterator of the collection of the reachable nodes in proper sequence.
 void printNodes()
          Displays information about the collected nodes for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetReachableNodes

public GetReachableNodes(CFG cfg,
                         CFGNode fromNode,
                         CFGNode toNode)
Calculates reachable path between two CFG nodes and records nodes in the path.

Parameters:
cfg - A CFG.
fromNode - A start node of reachable path to be calculated.
toNode - An end node of reachable path to be calculated.
Method Detail

getForwardReachableNode

public GraphElementSet getForwardReachableNode()
Returns the collection of nodes passed forward on a CFG.

Returns:
The collection of nodes on the forward reachable path.

getBackwardReachableNode

public GraphElementSet getBackwardReachableNode()
Returns the collection of nodes passed backward on a CFG.

Returns:
The collection of nodes on the backward reachable path.

contains

public boolean contains(CFGNode node)
Tests if the collection of the reachable nodes contains a node.

Parameters:
node - A CFG node to be tested.
Returns:
true if the reachable nodes contains the specified node, otherwise false.

isEmpty

public boolean isEmpty()
Tests if there is no reachable node.

Returns:
true if there is no reachable node, otherwise false.

iterator

public java.util.Iterator iterator()
Returns an iterator of the collection of the reachable nodes in proper sequence.

Returns:
The iterator of the collection of the reachable nodes.

printNodes

public void printNodes()
Displays information about the collected nodes for debugging.