本文整理汇总了Java中me.tongfei.progressbar.ProgressBar.start方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar.start方法的具体用法?Java ProgressBar.start怎么用?Java ProgressBar.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.tongfei.progressbar.ProgressBar
的用法示例。
在下文中一共展示了ProgressBar.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mark
import me.tongfei.progressbar.ProgressBar; //导入方法依赖的package包/类
/**
* Marks all of the submissions.
* @param threads The thread-pool size to use in marking the assignments
*/
public void mark(final int threads)
throws Exception {
final ProgressBar pb = new ProgressBar("Marking", this.submissions.size());
pb.start();
final CountDownLatch latch = new CountDownLatch(this.submissions.size());
final ThreadPoolExecutor executor = new ThreadPoolExecutor(
threads,
threads,
0L,
TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<>(threads),
new ThreadPoolExecutor.CallerRunsPolicy()
);
for (Submission s : this.submissions) {
executor.submit(() -> {
try {
s.results(this.markingResults(s.directory()));
pb.step();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
latch.countDown();
}
});
}
executor.shutdown();
latch.await();
pb.stop();
}
示例2: printBar
import me.tongfei.progressbar.ProgressBar; //导入方法依赖的package包/类
public void printBar(ProgressGauge progressGauge) {
PrintStream os = new PrintStream(new WriterOutputStream(rawPrint ? pw : console.getOutput()));
String label = app().config().i18nEnabled() ? i18n("act.progress.capFirst") : "Progress";
ProgressBar pb = new ProgressBar(label, progressGauge.maxHint(), 200, os, ProgressBarStyle.UNICODE_BLOCK);
pb.start();
while (!progressGauge.done()) {
pb.maxHint(progressGauge.maxHint());
pb.stepTo(progressGauge.currentSteps());
flush();
}
pb.stepTo(pb.getMax());
pb.stop();
}