com.google.javascript.jscomp.graph
Class FixedPointGraphTraversal<N,E>

java.lang.Object
  extended by com.google.javascript.jscomp.graph.FixedPointGraphTraversal<N,E>
Type Parameters:
N - Value type that the graph node stores.
E - Value type that the graph edge stores.

public final class FixedPointGraphTraversal<N,E>
extends Object

A utility class for doing fixed-point computations. We traverse the edges over the given directed graph until the graph reaches a steady state.


Nested Class Summary
static interface FixedPointGraphTraversal.EdgeCallback<Node,Edge>
           
 
Field Summary
static String NON_HALTING_ERROR_MSG
           
 
Constructor Summary
FixedPointGraphTraversal(FixedPointGraphTraversal.EdgeCallback<N,E> callback)
          Create a new traversal.
 
Method Summary
 void computeFixedPoint(DiGraph<N,E> graph)
          Compute a fixed point for the given graph.
 void computeFixedPoint(DiGraph<N,E> graph, N entry)
          Compute a fixed point for the given graph, entering from the given node.
 void computeFixedPoint(DiGraph<N,E> graph, Set<N> entrySet)
          Compute a fixed point for the given graph, entering from the given nodes.
static
<NODE,EDGE>
FixedPointGraphTraversal<NODE,EDGE>
newTraversal(FixedPointGraphTraversal.EdgeCallback<NODE,EDGE> callback)
          Helper method for creating new traversals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NON_HALTING_ERROR_MSG

public static final String NON_HALTING_ERROR_MSG
See Also:
Constant Field Values
Constructor Detail

FixedPointGraphTraversal

public FixedPointGraphTraversal(FixedPointGraphTraversal.EdgeCallback<N,E> callback)
Create a new traversal.

Parameters:
callback - A callback for updating the state of the graph each time an edge is traversed.
Method Detail

newTraversal

public static <NODE,EDGE> FixedPointGraphTraversal<NODE,EDGE> newTraversal(FixedPointGraphTraversal.EdgeCallback<NODE,EDGE> callback)
Helper method for creating new traversals.


computeFixedPoint

public void computeFixedPoint(DiGraph<N,E> graph)
Compute a fixed point for the given graph.

Parameters:
graph - The graph to traverse.

computeFixedPoint

public void computeFixedPoint(DiGraph<N,E> graph,
                              N entry)
Compute a fixed point for the given graph, entering from the given node.

Parameters:
graph - The graph to traverse.
entry - The node to begin traversing from.

computeFixedPoint

public void computeFixedPoint(DiGraph<N,E> graph,
                              Set<N> entrySet)
Compute a fixed point for the given graph, entering from the given nodes.

Parameters:
graph - The graph to traverse.
entrySet - The nodes to begin traversing from.