Class ProgressBar
java.lang.Object
uk.ac.manchester.spinnaker.utils.progress.ProgressBar
- All Implemented Interfaces:
- Closeable,- AutoCloseable
Progress bar for telling the user where a task is up to and for reporting the
 duration.
 
 The timer is started and the header of the bar is written during
 construction. The dash line is terminated when the last expected update
 arrives. (or if close() is called before that update). The timer is
 stopped and the duration written when close() is called. If
 close() is not called the duration is never written out.
- Author:
- Christian-B
- 
Constructor SummaryConstructorsConstructorDescriptionProgressBar(int numberOfThings, String description) Creates a Progress bar which outputs toSystem.out.ProgressBar(int numberOfThings, String description, PrintStream output) Creates a progress bar which outputs to the givenPrintStream.
- 
Method Summary
- 
Constructor Details- 
ProgressBarCreates a progress bar which outputs to the givenPrintStream.- Parameters:
- numberOfThings- The number of items to progress over
- description- A text description to add at the start and when reporting duration.
- output- The stream to write output too. For example- System.out.
 
- 
ProgressBarCreates a Progress bar which outputs toSystem.out.- Parameters:
- numberOfThings- The number of items to progress over
- description- A text description to add at the start and when reporting duration.
 
 
- 
- 
Method Details- 
updatepublic void update(int amountToAdd) Update the progress bar by a given amount.- Parameters:
- amountToAdd- Amount of things to update by.
- Throws:
- IllegalStateException- Throws if the bar is updated too often or updated after it was closed.
 
- 
updatepublic void update()Update the progress bar by a one unit.- Throws:
- IllegalStateException- Throws if the bar is updated too often or updated after it was closed.
 
- 
closepublic void close()Ends the Progress bar line and prints a duration line.If the bar is already closed then invoking this method has no effect. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
isClosedpublic boolean isClosed()- Returns:
- True if the progress bar is closed
 
 
-