java.lang.Object
java.lang.Thread
imagingbook.common.util.progress.ProgressMonitor
imagingbook.common.util.progress.ConsoleProgressMonitor
- All Implemented Interfaces:
AutoCloseable
,Runnable
A simple progress monitor that only prints the progress of the monitored target task to the console. See
ProgressMonitorExample
for a usage example.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class imagingbook.common.util.progress.ProgressMonitor
DefaultWaitTime
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
handleProgress
(double progress, long elapsedNanoTime) Called periodically by theProgressMonitor
thread supplying the current progress value (degree of completion).Methods inherited from class imagingbook.common.util.progress.ProgressMonitor
getElapsedTime, run, setWaitTime
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
ConsoleProgressMonitor
Constructor.- Parameters:
target
- the task (ProgressReporter
) to be monitored
-
-
Method Details
-
handleProgress
Description copied from class:ProgressMonitor
Called periodically by theProgressMonitor
thread supplying the current progress value (degree of completion). It is up to the implementation what action should be performed, e.g., display the current progress graphically (see e.g.IjProgressBarMonitor
).- Specified by:
handleProgress
in classProgressMonitor
- Parameters:
progress
- the current progress value (degree of completion) in [0,1)elapsedNanoTime
- the time elapsed since this progress monitor was started (in nanoseconds)
-
close
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classProgressMonitor
-