public class ProgressBar extends Object
| Constructor and Description |
|---|
ProgressBar(String task,
long initialMax)
Creates a progress bar with the specific task name and initial maximum value.
|
ProgressBar(String task,
long initialMax,
int updateIntervalMillis) |
ProgressBar(String task,
long initialMax,
int updateIntervalMillis,
PrintStream os,
ProgressBarStyle style)
Creates a progress bar with the specific task name, initial maximum value,
customized update interval (default 1000 ms), the PrintStream to be used, and output style.
|
ProgressBar(String task,
long initialMax,
ProgressBarStyle style) |
| Modifier and Type | Method and Description |
|---|---|
long |
getCurrent()
Returns the current progress.
|
String |
getExtraMessage()
Returns the extra message at the end of the progress bar.
|
long |
getMax()
Returns the maximum value of this progress bar.
|
String |
getTask()
Returns the name of this task.
|
ProgressBar |
maxHint(long n)
Gives a hint to the maximum value of the progress bar.
|
ProgressBar |
setExtraMessage(String msg)
Sets the extra message at the end of the progress bar.
|
ProgressBar |
start()
Starts this progress bar.
|
ProgressBar |
step()
Advances this progress bar by one step.
|
ProgressBar |
stepBy(long n)
Advances this progress bar by a specific amount.
|
ProgressBar |
stepTo(long n)
Advances this progress bar to the specific progress value.
|
ProgressBar |
stop()
Stops this progress bar.
|
static <T> Iterable<T> |
wrap(Iterable<T> ts,
String task)
Wraps an iterable so that when iterated, a progress bar is shown to track the traversal progress.
|
static <T> Iterator<T> |
wrap(Iterator<T> it,
String task)
Wraps an iterator so that when iterated, a progress bar is shown to track the traversal progress.
|
public ProgressBar(String task, long initialMax)
task - Task nameinitialMax - Initial maximum valuepublic ProgressBar(String task, long initialMax, ProgressBarStyle style)
public ProgressBar(String task, long initialMax, int updateIntervalMillis)
public ProgressBar(String task, long initialMax, int updateIntervalMillis, PrintStream os, ProgressBarStyle style)
task - Task nameinitialMax - Initial maximum valueupdateIntervalMillis - Update interval (default value 1000 ms)os - Print stream (default value System.err)style - Output style (default value ProgresBarStyle.UNICODE_BLOCK)public ProgressBar start()
public ProgressBar stepBy(long n)
n - Step sizepublic ProgressBar stepTo(long n)
n - New progress valuepublic ProgressBar step()
public ProgressBar maxHint(long n)
n - Hint of the maximum valuepublic ProgressBar stop()
public ProgressBar setExtraMessage(String msg)
msg - New messagepublic long getCurrent()
public long getMax()
public String getTask()
public String getExtraMessage()
public static <T> Iterator<T> wrap(Iterator<T> it, String task)
it - Underlying iteratortask - Task nameCopyright © 2018. All rights reserved.