tools.progressbar
Class AbstractProgressBar

java.lang.Object
  extended by tools.progressbar.AbstractProgressBar
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ProgressBar

public abstract class AbstractProgressBar
extends java.lang.Object
implements java.io.Serializable

General class for progress bars. This class does the management and computations. The visualization should be done in implementing classes. The principle is, setting a number of "calls" and calling this class exactly that often. Example: setNumberOfTotalCalls(5) for (int i=0; i<5; i++) { DisplayBar(); }

Author:
wrzodek
See Also:
Serialized Form

Constructor Summary
AbstractProgressBar()
           
 
Method Summary
 void DisplayBar()
          Call this function, to set the counter one step further to totalCalls.
 void DisplayBar(java.lang.String additionalText)
          Call this function, to set the counter one step further to totalCalls.
 void DisplayBar(java.lang.String additionalText, boolean omitTimeCount)
          See DisplayBar(String).
abstract  void finished()
          This method is called automatically, when all calculations are finished (callNr=TotalCalls).
 long getCallNumber()
           
 boolean getEstimateTime()
           
 void reset()
           
 void setCallNr(long callNr)
           
 void setEstimateTime(boolean estimateTime)
           
 void setNumberOfTotalCalls(long totalCalls)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProgressBar

public AbstractProgressBar()
Method Detail

reset

public void reset()

setNumberOfTotalCalls

public void setNumberOfTotalCalls(long totalCalls)

setEstimateTime

public void setEstimateTime(boolean estimateTime)

getEstimateTime

public boolean getEstimateTime()
Returns:
Should the class calculate the remaining time?

getCallNumber

public long getCallNumber()
Returns:
How often the DisplayBar method has been called.

DisplayBar

public void DisplayBar()
Call this function, to set the counter one step further to totalCalls. Paints automatically the progress bar.


DisplayBar

public void DisplayBar(java.lang.String additionalText)
Call this function, to set the counter one step further to totalCalls. Paints automatically the progress bar and adds an @param additionalText. This function should be called exactly as often as defined in the constructor. It will draw or update a previously drawn progressBar.

Parameters:
additionalText - - Any additional text (e.g. "Best item found so far XYZ")

DisplayBar

public void DisplayBar(java.lang.String additionalText,
                       boolean omitTimeCount)
See DisplayBar(String).

Parameters:
omitTimeCount - - If true, increases call number, but does not include this call into the ETA estimation. Does also NOT reset the timer, if true.

finished

public abstract void finished()
This method is called automatically, when all calculations are finished (callNr=TotalCalls). Please implement it SYNCHRONIZED. Only call it manually, when you finish before reaching 100%.


setCallNr

public void setCallNr(long callNr)
Parameters:
callNr -