gov.sandia.cognition.algorithm.event
Class IterationStartReporter

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.algorithm.event.AbstractIterativeAlgorithmListener
          extended by gov.sandia.cognition.algorithm.event.IterationStartReporter
All Implemented Interfaces:
IterativeAlgorithmListener, CloneableSerializable, Serializable, Cloneable

public class IterationStartReporter
extends AbstractIterativeAlgorithmListener

An iterative algorithm listener that reports the start of each iteration to the given print stream.

Since:
3.3.3
Author:
Justin Basilico
See Also:
IterativeAlgorithm, Serialized Form

Field Summary
static String DEFAULT_FORMAT
          The default format is "Iteration %d".
protected  String format
          The format for the performance report, passed to String.format.
protected  PrintStream out
          The print stream to report performance to.
 
Constructor Summary
IterationStartReporter()
          Creates a new IterationStartReporter that reports to System.out using the default format.
IterationStartReporter(PrintStream out)
          Creates a new IterationStartReporter that reports to the given print stream using the default format.
IterationStartReporter(PrintStream out, String format)
          Creates a new IterationStartReporter that reports to the given print stream and format.
IterationStartReporter(String format)
          Creates a new IterationStartReporter that reports to System.out and the given format.
 
Method Summary
 void stepStarted(IterativeAlgorithm algorithm)
          This method is called when the algorithm has started a step in its execution.
 
Methods inherited from class gov.sandia.cognition.algorithm.event.AbstractIterativeAlgorithmListener
algorithmEnded, algorithmStarted, stepEnded
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

public static final String DEFAULT_FORMAT
The default format is "Iteration %d".

See Also:
Constant Field Values

out

protected PrintStream out
The print stream to report performance to.


format

protected String format
The format for the performance report, passed to String.format.

Constructor Detail

IterationStartReporter

public IterationStartReporter()
Creates a new IterationStartReporter that reports to System.out using the default format.


IterationStartReporter

public IterationStartReporter(PrintStream out)
Creates a new IterationStartReporter that reports to the given print stream using the default format.

Parameters:
out - Print stream to report the status to.

IterationStartReporter

public IterationStartReporter(String format)
Creates a new IterationStartReporter that reports to System.out and the given format.

Parameters:
format - Format string for the status messages, which passed to String.format.

IterationStartReporter

public IterationStartReporter(PrintStream out,
                              String format)
Creates a new IterationStartReporter that reports to the given print stream and format.

Parameters:
out - Print stream to report the status to.
format - Format string for the status messages, which passed to String.format.
Method Detail

stepStarted

public void stepStarted(IterativeAlgorithm algorithm)
Description copied from interface: IterativeAlgorithmListener
This method is called when the algorithm has started a step in its execution.

Specified by:
stepStarted in interface IterativeAlgorithmListener
Overrides:
stepStarted in class AbstractIterativeAlgorithmListener
Parameters:
algorithm - The algorithm that has started another step of its execution.