Package net.ssehub.easy.basics.progress
Class ProgressObserver
java.lang.Object
net.ssehub.easy.basics.progress.ProgressObserver
- Direct Known Subclasses:
BasicProgressObserver
Observes the progress of a longer lasting task.
- Author:
- Holger Eichelberger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMarker interface for a subtask.static interfaceMarker interface for a task. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ProgressObserverDefines an observer which does nothing.static final ProgressObserver.ISubtaskDenotes the empty subtask. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotifies about ending a (sub)task.abstract voidnotifyEnd(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask) Notifies about ending a (sub)task.voidnotifyProgress(ProgressObserver.ITask task, int step) Notifies about processing a task or a subtask.voidnotifyProgress(ProgressObserver.ITask task, int step, int max) Notifies about processing a task or a subtask.voidnotifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step) Notifies about processing a task or a subtask.abstract voidnotifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max) Notifies about processing a task or a subtask.voidnotifyStart(ProgressObserver.ITask task, int max) Notifies about starting a task.abstract voidnotifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max) Notifies about starting a (sub)task.abstract ProgressObserver.ISubtaskregisterSubtask(String subtask) Registers a subtask to notify about processing progress.abstract ProgressObserver.ITaskregisterTask(String task) Registers a task for notify about processing progress.
-
Field Details
-
NO_SUBTASK
Denotes the empty subtask. -
NO_OBSERVER
Defines an observer which does nothing. Avoids a lot of if-then-else constructs.
-
-
Constructor Details
-
ProgressObserver
public ProgressObserver()
-
-
Method Details
-
registerTask
Registers a task for notify about processing progress.- Parameters:
task- the name of the task- Returns:
- the task identification
-
registerSubtask
Registers a subtask to notify about processing progress.- Parameters:
subtask- the name of the sub task- Returns:
- the task identification
-
notifyStart
Notifies about starting a task.- Parameters:
task- the identification of task to notify about (initially useregisterTask(String)for registering a task)max- the intended maximum steps of the subtask
-
notifyStart
public abstract void notifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max) Notifies about starting a (sub)task. Subtask notifications shall occur after task notifications, i.e. nested.- Parameters:
task- the identification of task to notify about (initially useregisterTask(String)for registering a task)subtask- the subtask (may beNO_SUBTASK) (initially useregisterSubtask(String)for registering a sub task)max- the intended maximum steps of the subtask
-
notifyProgress
Notifies about processing a task or a subtask.- Parameters:
task- the identification of the task to notify about (initially useregisterTask(String)for registering a task)step- the current step in 0<=step<=maxmax- the maximum number of steps, ignored if negative and value from start notification is used instead
-
notifyProgress
Notifies about processing a task or a subtask.- Parameters:
task- the identification of the task to notify about (initially useregisterTask(String)for registering a task)step- the current step in 0<=step<=max
-
notifyProgress
public void notifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step) Notifies about processing a task or a subtask.- Parameters:
task- the identification of the task to notify about (initially useregisterTask(String)for registering a task)subtask- the identification of the subtask (may beNO_SUBTASK, initially useregisterSubtask(String)for registering a sub task)step- the current step in 0<=step<=max
-
notifyProgress
public abstract void notifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max) Notifies about processing a task or a subtask.- Parameters:
task- the identification of the task to notify about (initially useregisterTask(String)for registering a task)subtask- the identification of the subtask (may beNO_SUBTASK, initially useregisterSubtask(String)for registering a sub task)step- the current step in 0<=step<=maxmax- the maximum number of steps, ignored if negative and value from start notification is used instead
-
notifyEnd
Notifies about ending a (sub)task. Subtask notifications shall occur before task notifications, i.e. correctly nested. Use the identifications returned byregisterTask(String)andregisterSubtask(String). This method shall implicitly unregister the given task and/or subtask.- Parameters:
task- the identification of the task which ends (initially useregisterTask(String)for registering a task)
-
notifyEnd
Notifies about ending a (sub)task. Subtask notifications shall occur before task notifications, i.e. correctly nested. Use the identifications returned byregisterTask(String)andregisterSubtask(String). This method shall implicitly unregister the given task and/or subtask.- Parameters:
task- the identification of the task which ends (initially useregisterTask(String)for registering a task)subtask- the identification of the subtask withtask(may beNO_SUBTASK, if given, only the subtask is supposed to end, initially useregisterSubtask(String)for registering a sub task)
-