- java.lang.Object
-
- org.scijava.progress.Progress
-
public final class Progress extends Object
A static utility class serving as the interface between progress reporters and progress listeners.- Author:
- Gabriel Selzer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddGlobalListener(Consumer<Task> l)static voidaddListener(Object progressible, Consumer<Task> l)static voidcomplete()Completes the current task on thisThread's execution hierarchy, removing it in the process.static TaskcurrentTask()static voiddefineTotal(long elements)Defines the total progress of the currentTaskstatic voiddefineTotal(long elements, long subTasks)Defines the total progress of the currentTaskstatic voidignore()static voidregister(Object progressible)Creates a newTaskforprogressible.static voidregister(Object progressible, String description)Creates a newTaskforprogressible.static voidsetStatus(String status)static voidupdate()static voidupdate(long elements)static voidupdate(long numElements, Task task)
-
-
-
Method Detail
-
complete
public static void complete()
Completes the current task on thisThread's execution hierarchy, removing it in the process. This method also takes care to ping relevantConsumers.- See Also:
Task.complete()
-
ignore
public static void ignore()
Adds a new NOPTaskto the current execution chain, used to ignoreProgresscalls by a progressible object. This NOP task will handle allProgresscalls on thisThreadbetween the time this method is invoked and the time whencomplete()is called.
-
register
public static void register(Object progressible)
Creates a newTaskforprogressible. This method makes the assumption thatprogressibleis responsible for any calls toProgress' progress-reporting API between the time this method is called and the time whencomplete()is called.- Parameters:
progressible- anObjectthat would like to report its progress.
-
register
public static void register(Object progressible, String description)
Creates a newTaskforprogressible. This method makes the assumption thatprogressibleis responsible for any calls toProgress' progress-reporting API between the time this method is called and the time whencomplete()is called.
-
update
public static void update()
- See Also:
Task.update(long)
-
update
public static void update(long elements)
- Parameters:
elements- the number of elements completed in the current stage.- See Also:
Task.update(long)
-
update
public static void update(long numElements, Task task)- Parameters:
numElements- the number of elements completed in the current stage.task- theTaskto update- See Also:
Task.update(long)
-
setStatus
public static void setStatus(String status)
- See Also:
Task.setStatus(String)
-
defineTotal
public static void defineTotal(long elements)
Defines the total progress of the currentTask- Parameters:
elements- the number of discrete packets of computation.- See Also:
Task.defineTotal(long)
-
defineTotal
public static void defineTotal(long elements, long subTasks)Defines the total progress of the currentTask- Parameters:
elements- the number of discrete packets of computation.subTasks- the number of times subtasks are called upon within the task. This is not the same as the number of subtasks used (as one subtask may run multiple times).- See Also:
Task.defineTotal(long, long)
-
-