ConsoleProgressBar: Prevent max from being non-positive.

This commit is contained in:
Jonathan Bernard 2015-06-28 08:49:42 -05:00
parent 14903c866c
commit 1d3f8d71e2
2 changed files with 4 additions and 1 deletions

View File

@ -2,7 +2,7 @@ apply plugin: "groovy"
apply plugin: "maven" apply plugin: "maven"
group = "com.jdbernard" group = "com.jdbernard"
version = "3.7" version = "3.8"
repositories { repositories {
mavenCentral() } mavenCentral() }

View File

@ -18,6 +18,9 @@ class ConsoleProgressBar {
private String lastInfo = "" private String lastInfo = ""
private long startTime private long startTime
public void setMax(int max) {
this.max = Math.max(max, 1) }
void update(int value, String info) { void update(int value, String info) {
if (value == 0 || startTime == 0) if (value == 0 || startTime == 0)
startTime = System.currentTimeMillis() startTime = System.currentTimeMillis()