The Octet Molecular Representation Framework v0.8.2

net.sf.octet.traversal
Interface TraversalHandler

All Known Subinterfaces:
BreadthTraverser.Handler, CycleSystemTraverser.Handler, CycleTraverser.Handler, DepthTraverser.Handler, IsomorphismTraverser.Handler
All Known Implementing Classes:
BasicTraversalHandler, PrintingHandler

public interface TraversalHandler

TraversalHandler receives messages from a traverser indicating the completion of various stages of its traversal algorithm. The order of events in this interface is important and reflects both the structure of the AtomGraph being traversed and the traversal algorithm.

Separating the implementation of traversal algorithms from the processing of traversal events maximizes the reusability of TraversalHandlers and traversals. The design and use of TraversalHandler are analogous to those of the SAX ContentHandler interface. TraversalHandler is similar in use to the Strategy design pattern and similar in intent to the Template Method pattern.

Author:
Richard Apodaca
See Also:
"Strategy Pattern (GoF95)", "Template Method Pattern (GoF95)"

Method Summary
 boolean abortTraversal()
          Implement this method to enable a traversal algorithm to be aborted.
 void atomPairTraversed(AtomPair pair)
          Implement this method to be notified that traversal of pair has just been completed.
 void atomTraversed(Atom atom)
          Implement this method to be notified that traversal of atom has just been completed.
 void traversalFinished(AtomGraph graph)
          Implement this method to be notified that traversal of graph is finished.
 void traversalStarted(AtomGraph graph)
          Implement this method to be notified that traversal of graph has started.
 

Method Detail

traversalStarted

public void traversalStarted(AtomGraph graph)
Implement this method to be notified that traversal of graph has started.

Parameters:
graph - the AtomGraph that will be traversed

traversalFinished

public void traversalFinished(AtomGraph graph)
Implement this method to be notified that traversal of graph is finished.

Parameters:
graph - the AtomGraph whose traversal was completed

atomTraversed

public void atomTraversed(Atom atom)
Implement this method to be notified that traversal of atom has just been completed.

Parameters:
atom - the Atom that was just traversed

atomPairTraversed

public void atomPairTraversed(AtomPair pair)
Implement this method to be notified that traversal of pair has just been completed.

Parameters:
pair - the AtomPair that was just traversed

abortTraversal

public boolean abortTraversal()
Implement this method to enable a traversal algorithm to be aborted.

Returns:
true if traversal should be aborted, or false otherwise

The Octet Molecular Representation Framework v0.8.2