de.cau.cs.kieler.core.alg
Interface IKielerProgressMonitor

All Known Implementing Classes:
BasicProgressMonitor, KielerProgressMonitor

public interface IKielerProgressMonitor

Interface for monitors of progress of a job. A progress monitor can be used in conjunction with IAlgorithm to track progress of an algorithm run.

Rating proposed yellow
(2009-12-11) msp

Field Summary
static float UNKNOWN_WORK
          constant indicating an unknown amount of work.
 
Method Summary
 void begin(String name, float totalWork)
          Notifies that the task will begin after this method has been called.
 void done()
          Notifies that the current task is done and closes the monitor.
 double getExecutionTime()
          Returns the measured execution time for the task associated with this monitor.
 IKielerProgressMonitor getParentMonitor()
          Returns the parent monitor.
 List<IKielerProgressMonitor> getSubMonitors()
          Returns a list of all monitors associated with direct sub-tasks.
 String getTaskName()
          Returns the name of the task associated with this progress monitor.
 boolean isCanceled()
          Returns whether cancellation of the task has been requested.
 IKielerProgressMonitor subTask(float work)
          Creates a new sub-task that will complete the given amount of work units when it is done.
 void worked(float work)
          Notifies that the given number of work units has been completed.
 

Field Detail

UNKNOWN_WORK

static final float UNKNOWN_WORK
constant indicating an unknown amount of work.

See Also:
Constant Field Values
Method Detail

begin

void begin(String name,
           float totalWork)
Notifies that the task will begin after this method has been called. This method will have no effect is the monitor is closed.

Parameters:
name - readable name of the new task
totalWork - total amount of work units, or UNKNOWN_WORK if this is not specified

done

void done()
Notifies that the current task is done and closes the monitor. This method may be called multiple times, without any effect after the first time.


worked

void worked(float work)
Notifies that the given number of work units has been completed. This method will have no effect is the monitor is closed.

Parameters:
work - number of work units

isCanceled

boolean isCanceled()
Returns whether cancellation of the task has been requested.

Returns:
true if cancellation has been requested

subTask

IKielerProgressMonitor subTask(float work)
Creates a new sub-task that will complete the given amount of work units when it is done. The sub-task begins when #begin(String, int) is called for the new progress monitor instance, and it ends when done() is called for that instance.

Parameters:
work - number of work units that are completed in the current monitor instance when the sub-task is done
Returns:
a progress monitor for the new sub-task, or null if the monitor is closed

getSubMonitors

List<IKielerProgressMonitor> getSubMonitors()
Returns a list of all monitors associated with direct sub-tasks.

Returns:
list of sub-task monitors

getParentMonitor

IKielerProgressMonitor getParentMonitor()
Returns the parent monitor. The parent monitor is the one for which a call to #subTask(int) resulted in the current monitor instance.

Returns:
the parent monitor, or null if there is none

getTaskName

String getTaskName()
Returns the name of the task associated with this progress monitor.

Returns:
task name

getExecutionTime

double getExecutionTime()
Returns the measured execution time for the task associated with this monitor.

Returns:
number of seconds used for execution