|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.cau.cs.kieler.core.alg.BasicProgressMonitor
public class BasicProgressMonitor
Base class for implementations of progress monitors. This class performs execution time measurement, keeps track of the amount of completed work, and handles sub-tasks properly.
Field Summary |
---|
Fields inherited from interface de.cau.cs.kieler.core.alg.IKielerProgressMonitor |
---|
UNKNOWN_WORK |
Constructor Summary | |
---|---|
BasicProgressMonitor()
Creates a progress monitor with infinite number of hierarchy levels. |
|
BasicProgressMonitor(int themaxLevels)
Creates a progress monitor with the given maximal number of hierarchy levels. |
Method Summary | |
---|---|
void |
begin(String name,
int thetotalWork)
Notifies that the task will begin after this method has been called. |
protected void |
doBegin(String name,
int newTotalWork,
boolean topInstance,
int maxHierarchyLevels)
Invoked when a task begins, to be overridden by subclasses. |
protected void |
doDone(boolean topInstance,
int maxHierarchyLevels)
Invoked when a task ends, to be overridden by subclasses. |
void |
done()
Notifies that the current task is done and closes the monitor. |
protected BasicProgressMonitor |
doSubTask(int work,
int maxHierarchyLevels)
Invoked when a sub-task is created, to be overridden by subclasses. |
protected void |
doWorked(float work,
float thecompletedWork,
boolean topInstance)
Invoked when work is done for this progress monitor, to be overridden by subclasses. |
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()
This implementation always returns false . |
IKielerProgressMonitor |
subTask(int work)
Creates a new sub-task that will complete the given amount of work units when it is done. |
void |
worked(int work)
Notifies that the given number of work units has been completed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicProgressMonitor()
public BasicProgressMonitor(int themaxLevels)
themaxLevels
- the maximal number of hierarchy levels for which progress is
reportedMethod Detail |
---|
public final void begin(String name, int thetotalWork)
begin
in interface IKielerProgressMonitor
name
- readable name of the new taskthetotalWork
- total amount of work units, or UNKNOWN_WORK
if this is not specifiedprotected void doBegin(String name, int newTotalWork, boolean topInstance, int maxHierarchyLevels)
name
- task namenewTotalWork
- total amount of work for the new tasktopInstance
- if true, this progress monitor is the top instancemaxHierarchyLevels
- the maximal number of reported hierarchy levels, or -1
for infinite levelspublic final void done()
done
in interface IKielerProgressMonitor
protected void doDone(boolean topInstance, int maxHierarchyLevels)
topInstance
- if true, this progress monitor is the top instancemaxHierarchyLevels
- the maximal number of reported hierarchy levels, or -1
for infinite levelspublic final double getExecutionTime()
getExecutionTime
in interface IKielerProgressMonitor
public final List<IKielerProgressMonitor> getSubMonitors()
getSubMonitors
in interface IKielerProgressMonitor
public final IKielerProgressMonitor getParentMonitor()
IKielerProgressMonitor.subTask(int)
resulted in the current monitor instance.
getParentMonitor
in interface IKielerProgressMonitor
public String getTaskName()
getTaskName
in interface IKielerProgressMonitor
public boolean isCanceled()
false
.
isCanceled
in interface IKielerProgressMonitor
false
public final IKielerProgressMonitor subTask(int work)
IKielerProgressMonitor.begin(String, int)
is
called for the new progress monitor instance, and it ends when
IKielerProgressMonitor.done()
is called for that instance.
subTask
in interface IKielerProgressMonitor
work
- number of work units that are completed in the current
monitor instance when the sub-task is done
protected BasicProgressMonitor doSubTask(int work, int maxHierarchyLevels)
BasicProgressMonitor
instance.
work
- amount of work that is completed in the current monitor
instance when the sub-task endsmaxHierarchyLevels
- the maximal number of reported hierarchy levels for the parent
progress monitor, or -1 for infinite levels
public final void worked(int work)
worked
in interface IKielerProgressMonitor
work
- number of work unitsprotected void doWorked(float work, float thecompletedWork, boolean topInstance)
work
- amount of work that has just been donethecompletedWork
- total number of work that is done for this tasktopInstance
- if true, this progress monitor is the top instance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |