at.tuwien.ifs.somtoolbox.util
Class StdErrProgressWriter

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.util.StdErrProgressWriter
All Implemented Interfaces:
ProgressListener
Direct Known Subclasses:
AdaptiveStdErrProgressWriter

public class StdErrProgressWriter
extends Object
implements ProgressListener

A progress listener that writes the progress messages to the standard error stream (System.err).

Version:
$Id: StdErrProgressWriter.java 3883 2010-11-02 17:13:23Z frank $
Author:
Michael Dittenbach, Rudolf Mayer

Field Summary
protected  int currentStep
           
private  long elapsed
           
private  long estimatedEndDate
           
private  long estimatedLength
           
protected  boolean finished
           
protected  DateFormat format
           
protected  String message
           
protected  short messageLength
           
protected  int newLineWidth
           
protected  short screenWidth
           
protected  long startDate
           
protected  int stepWidth
           
protected  int totalSteps
           
 
Constructor Summary
StdErrProgressWriter(int totalSteps, String message)
          Initialises a progress writer with a stepWidth of 1.
StdErrProgressWriter(int totalSteps, String message, int stepWidth)
          Initialises a new progress writer.
StdErrProgressWriter(int totalSteps, String message, int stepWidth, int newLineWidth)
           
 
Method Summary
 int getCurrentStep()
           
 String getMessage()
           
private  short getScreenWidth()
           
 int getSteps()
           
 void insertColumn(int columns, String message)
           
 void insertRow(int rows, String message)
           
 void progress()
          Progress by one step.
 void progress(int currentStep)
          Progress by the given steps.
 void progress(String message)
          Progress by one step, and change the message
 void progress(String message, int currentStep)
          Progress by the given steps, and change the message
 void setCurrentStep(int currentStep)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

protected String message

currentStep

protected int currentStep

totalSteps

protected int totalSteps

stepWidth

protected int stepWidth

startDate

protected long startDate

elapsed

private long elapsed

estimatedLength

private long estimatedLength

estimatedEndDate

private long estimatedEndDate

format

protected DateFormat format

messageLength

protected short messageLength

screenWidth

protected short screenWidth

newLineWidth

protected int newLineWidth

finished

protected boolean finished
Constructor Detail

StdErrProgressWriter

public StdErrProgressWriter(int totalSteps,
                            String message)
Initialises a progress writer with a stepWidth of 1.


StdErrProgressWriter

public StdErrProgressWriter(int totalSteps,
                            String message,
                            int stepWidth)
Initialises a new progress writer.

Parameters:
totalSteps - The total number of steps
message - The basic message, "x of y, ETA hh:mm:ss zzz" will be added automatically to this.
stepWidth - How often the message should be updated. Use a bigger stepWidth to improve the performance. The first and last step are printed regardless of the value of the stepWith.

StdErrProgressWriter

public StdErrProgressWriter(int totalSteps,
                            String message,
                            int stepWidth,
                            int newLineWidth)
Method Detail

getScreenWidth

private short getScreenWidth()

progress

public void progress()
Description copied from interface: ProgressListener
Progress by one step.

Specified by:
progress in interface ProgressListener

progress

public void progress(int currentStep)
Description copied from interface: ProgressListener
Progress by the given steps.

Specified by:
progress in interface ProgressListener

progress

public void progress(String message)
Description copied from interface: ProgressListener
Progress by one step, and change the message

Specified by:
progress in interface ProgressListener

progress

public void progress(String message,
                     int currentStep)
Description copied from interface: ProgressListener
Progress by the given steps, and change the message

Specified by:
progress in interface ProgressListener

insertRow

public void insertRow(int rows,
                      String message)
Specified by:
insertRow in interface ProgressListener

insertColumn

public void insertColumn(int columns,
                         String message)
Specified by:
insertColumn in interface ProgressListener

getMessage

public String getMessage()

getCurrentStep

public int getCurrentStep()
Specified by:
getCurrentStep in interface ProgressListener

getSteps

public int getSteps()

setCurrentStep

public void setCurrentStep(int currentStep)