Plexus v0.13.1

com.phoenixst.plexus.util
Class LoggingTraverser

java.lang.Object
  extended by com.phoenixst.collections.LoggingIterator
      extended by com.phoenixst.plexus.util.LoggingTraverser
All Implemented Interfaces:
Traverser, Iterator

public class LoggingTraverser
extends LoggingIterator
implements Traverser

A Traverser which wraps another to provide logging support.

Since:
1.0
Version:
$Revision: 1.3 $
Author:
Ray A. Conner

Constructor Summary
LoggingTraverser(Traverser delegate)
          Creates a new LoggingTraverser which logs to a category corresponding to this class at the DEBUG level.
LoggingTraverser(Traverser delegate, org.apache.log4j.Logger logger)
          Creates a new LoggingTraverser which uses the specified log at the DEBUG level.
LoggingTraverser(Traverser delegate, org.apache.log4j.Logger logger, org.apache.log4j.Level level)
          Creates a new LoggingTraverser.
 
Method Summary
 Graph.Edge getEdge()
          Returns the Edge which was traversed to get to the last node returned by next(), or null if no Edge was traversed.
 void removeEdge()
          Removes from the underlying Graph the Edge that would be returned by getEdge() (optional operation).
 
Methods inherited from class com.phoenixst.collections.LoggingIterator
getDelegate, getLevel, getLogger, hasNext, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

LoggingTraverser

public LoggingTraverser(Traverser delegate)
Creates a new LoggingTraverser which logs to a category corresponding to this class at the DEBUG level.


LoggingTraverser

public LoggingTraverser(Traverser delegate,
                        org.apache.log4j.Logger logger)
Creates a new LoggingTraverser which uses the specified log at the DEBUG level.


LoggingTraverser

public LoggingTraverser(Traverser delegate,
                        org.apache.log4j.Logger logger,
                        org.apache.log4j.Level level)
Creates a new LoggingTraverser.

Method Detail

getEdge

public Graph.Edge getEdge()
Description copied from interface: Traverser
Returns the Edge which was traversed to get to the last node returned by next(), or null if no Edge was traversed. This call can be made only if remove() or removeEdge() has not been called after the last call to next().

Specified by:
getEdge in interface Traverser
Returns:
The Edge which was traversed to get to the last node returned by next(), or null if no Edge was traversed.

removeEdge

public void removeEdge()
Description copied from interface: Traverser
Removes from the underlying Graph the Edge that would be returned by getEdge() (optional operation). If no Edge was traversed (as in the root of a breadth-first search), this method throws a IllegalStateException. This method can be called only once per call to next(). The behavior of a traverser is unspecified if the underlying graph structure is modified while the traversal is in progress in any way other than by calling this method or remove().

Specified by:
removeEdge in interface Traverser

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.