The Octet Molecular Representation Framework v0.8.2

net.sf.octet.traversal
Interface DepthTraverser

All Known Implementing Classes:
BasicDepthTraverser

public interface DepthTraverser

Traverses an AtomGraph in depth first order starting from a client-defined root Atom. DepthTraverser traverses each Atom and AtomPair at least once for a connected AtomGraph. The order of traversal is:

  1. The root Atom.
  2. One AtomPair associated with the root Atom followed by the neighbor Atom. The selection of this neighbor will be implementation-dependent.
  3. One neighbor of the atom in the previous step. The selection of this neighbor will also be implementation-dependent.

Note that the deepest branch may or may not be traversed first, depending on implementation.

This process continues until a terminating atom is encountered. A terminating atom has one of the following two characteristics:

Upon encountering a terminating atom, traversal then moves to the next neighbor of the last branch atom.

Using DepthTraverser consists of providing an AtomGraph , a root Atom, and an implementation of the DepthTraverser.Handler interface to the traverse method. The handler will be notified of various stages in the traversal.

Author:
Richard Apodaca
See Also:
TraversalHandler

Nested Class Summary
static interface DepthTraverser.Handler
          An extension of the TraversalHandler that includes methods specific to DepthTraverser traversal.
 
Method Summary
 void traverse(AtomGraph graph, Atom root, DepthTraverser.Handler handler)
          Traverses graph starting from root while notifying Handler of traversal events.
 

Method Detail

traverse

public void traverse(AtomGraph graph,
                     Atom root,
                     DepthTraverser.Handler handler)
Traverses graph starting from root while notifying Handler of traversal events.

Parameters:
graph - the AtomGraph to traverse
root - the root Atom in graph to start from
handler - receives traversal events

The Octet Molecular Representation Framework v0.8.2