Class DFSDiscoverTimeIterator<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
com.ibm.wala.util.graph.traverse.DFSDiscoverTimeIterator<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, Iterator<T>, List<T>, RandomAccess
Direct Known Subclasses:
NumberedDFSDiscoverTimeIterator, SlowDFSDiscoverTimeIterator

public abstract class DFSDiscoverTimeIterator<T> extends ArrayList<T> implements Iterator<T>
This class implements depth-first search over a NumberedGraph, return an enumeration of the nodes of the graph in order of increasing discover time. This class follows the outNodes of the graph nodes to define the graph, but this behavior can be changed by overriding the getConnected method.
See Also:
  • Constructor Details

    • DFSDiscoverTimeIterator

      public DFSDiscoverTimeIterator()
  • Method Details

    • init

      protected void init(Iterator<? extends T> nodes)
      subclass constructors must call this!
    • init

      protected void init(T N)
      subclass constructors must call this!
    • hasNext

      public boolean hasNext()
      Return whether there are any more nodes left to enumerate.
      Specified by:
      hasNext in interface Iterator<T>
      Returns:
      true if there nodes left to enumerate.
    • getPendingChildren

      protected abstract @Nullable Iterator<? extends T> getPendingChildren(T n)
    • setPendingChildren

      protected abstract void setPendingChildren(T v, Iterator<? extends T> iterator)
    • next

      @NullUnmarked public T next() throws NoSuchElementException
      Find the next graph node in discover time order.
      Specified by:
      next in interface Iterator<T>
      Returns:
      the next graph node in discover time order.
      Throws:
      NoSuchElementException
    • getConnected

      protected abstract Iterator<? extends T> getConnected(T n)
      get the out edges of a given node
      Parameters:
      n - the node of which to get the out edges
      Returns:
      the out edges
    • remove

      public void remove() throws UnimplementedError
      Specified by:
      remove in interface Iterator<T>
      Throws:
      UnimplementedError
    • visitEdge

      protected void visitEdge(T from, T to)
      Parameters:
      from - source of the edge to visit
      to - target of the edge to visit