Progress is advanced via tick() or tick(int), each of which
re-renders the bar in place. The bar is considered complete when currentTick >= total,
at which point isDone() returns true and a newline is emitted on the
next render(PrintStream) call.
Rendering uses a format string from ProgressBarConfiguration that supports
the following tokens:
:bar — the filled/unfilled bar segment:progress — current tick count, right-aligned to total width:total — the total tick count:percent — completion percentage, right-aligned to 3 characters:elapsed — elapsed time in mm:ss:remaining — estimated remaining time in mm:ss, or --:-- if unavailableThis class is not thread-safe. Concurrent calls to tick(int) or
tickAnimated(int) from multiple threads require external synchronization.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ProgressBarConfiguration | |
| pack-priv final long | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| private | ProgressBar(int currentTick, int total, boolean isDone, long creationTime, ProgressBarConfiguration configuration)
|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private String | |
| private String | |
| public ProgressBar | Returns: this instanceAdvances the progress bar to completion and re-renders it to |
| public ProgressBar | Returns: this instanceif the progress bar should be re-rendered to render)System#outAdvances the progress bar to completion. |
| private void | |
| private long | |
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public String | Returns: the rendered progress bar string; nevernullImplements io. Returns the current rendered string representation of the progress bar, with all format tokens resolved. |
| public int | |
| private String | |
| public boolean | Returns: true if currentTick >= total; false otherwiseReturns whether the progress bar has reached its total. |
| private int | |
| private Long | |
| public void | render(PrintStream
the stream to render to; must not be printStream)nullOverrides default io. Renders the progress bar to the given |
| public ProgressBar | |
| public ProgressBar | Returns: this instancethe number of ticks to advance; must be amount)>= 1Advances the progress bar by the given number of ticks and re-renders it to |
| public ProgressBar | Returns: this instanceif the progress bar should be re-rendered to render)System#out
Equivalent to Advances the progress bar by |
| public ProgressBar | Returns: this instancethe number of ticks to advance; must be amount, boolean >= 1if the progress bar should be re-rendered to render)System#outAdvances the progress bar by the given number of ticks. |
| public ProgressBar | Returns: this instancethe number of ticks to advance; must be amount)>= 1Advances the progress bar by the given amount, applying easing if configured. |
| public String |
| configuration | back to summary |
|---|---|
| pack-priv final ProgressBarConfiguration configuration | |
| creationTime | back to summary |
|---|---|
| pack-priv final long creationTime | |
| currentTick | back to summary |
|---|---|
| pack-priv int currentTick | |
| isDone | back to summary |
|---|---|
| pack-priv boolean isDone | |
| total | back to summary |
|---|---|
| pack-priv final int total | |
| ProgressBar | back to summary |
|---|---|
| private ProgressBar(int currentTick, int total, boolean isDone, long creationTime, ProgressBarConfiguration configuration) | |
| ProgressBar | back to summary |
|---|---|
| public ProgressBar(int total, ProgressBarConfiguration configuration) | |
| ProgressBar | back to summary |
|---|---|
| public ProgressBar(int total) | |
| alignRight | back to summary |
|---|---|
| private String alignRight(String text, int size) | |
| barText | back to summary |
|---|---|
| private String barText() | |
| complete | back to summary |
|---|---|
| public ProgressBar complete() Advances the progress bar to completion and re-renders it to Equivalent to ticking by
| |
| complete | back to summary |
|---|---|
| public ProgressBar complete(boolean render) Advances the progress bar to completion. Equivalent to ticking by
| |
| easeTick | back to summary |
|---|---|
| private void easeTick(int amount, EasingConfiguration easingConfig) | |
| elapsedTime | back to summary |
|---|---|
| private long elapsedTime() | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| get | back to summary |
|---|---|
| public String get() Implements io. Returns the current rendered string representation of the progress bar, with all format tokens resolved. The format string is sourced from
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| interval | back to summary |
|---|---|
| private String interval(Long milliseconds) | |
| isDone | back to summary |
|---|---|
| public boolean isDone() Returns whether the progress bar has reached its total.
| |
| percent | back to summary |
|---|---|
| private int percent() | |
| remainingTime | back to summary |
|---|---|
| private Long remainingTime() | |
| render | back to summary |
|---|---|
| public void render(PrintStream printStream) Overrides default io. Renders the progress bar to the given When
| |
| tick | back to summary |
|---|---|
| public ProgressBar tick() Advances the progress bar by Equivalent to
| |
| tick | back to summary |
|---|---|
| public ProgressBar tick(int amount) Advances the progress bar by the given number of ticks and re-renders it to The current tick is clamped to
| |
| tick | back to summary |
|---|---|
| public ProgressBar tick(boolean render) Advances the progress bar by
| |
| tick | back to summary |
|---|---|
| public ProgressBar tick(int amount, boolean render) Advances the progress bar by the given number of ticks. The current tick is clamped to
| |
| tickAnimated | back to summary |
|---|---|
| public ProgressBar tickAnimated(int amount) Advances the progress bar by the given amount, applying easing if configured. If the active This method blocks the calling thread for the duration of the animation when easing is applied.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |