Package moa.tasks
Class StandardTaskMonitor
- java.lang.Object
-
- moa.tasks.StandardTaskMonitor
-
- All Implemented Interfaces:
TaskMonitor
public class StandardTaskMonitor extends Object implements TaskMonitor
Class that represents a standard task monitor.- Version:
- $Revision: 7 $
- Author:
- Richard Kirkby (rkirkby@cs.waikato.ac.nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
cancelFlag
protected String
currentActivityDescription
protected double
currentActivityFractionComplete
protected boolean
isComplete
protected Object
latestResultPreview
protected boolean
pauseFlag
protected ResultPreviewListener
resultPreviewer
protected boolean
resultPreviewRequested
-
Constructor Summary
Constructors Constructor Description StandardTaskMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCurrentActivityDescription()
Gets the description of the current activity.double
getCurrentActivityFractionComplete()
Gets the percentage done of the current activityObject
getLatestResultPreview()
Gets the current result to previewboolean
isCancelled()
Gets whether the task monitored is cancelled.boolean
isPaused()
Gets whether the task monitored is paused.void
requestCancel()
Requests the task monitored to cancel.void
requestPause()
Requests the task monitored to pause.void
requestResultPreview()
Requests to preview the task result.void
requestResultPreview(ResultPreviewListener toInform)
Requests to preview the task result.void
requestResume()
Requests the task monitored to resume.boolean
resultPreviewRequested()
Gets whether there is a request for preview the task result.void
setCurrentActivity(String activityDescription, double fracComplete)
Sets the description and the percentage done of the current activity.void
setCurrentActivityDescription(String activity)
Sets the description of the current activity.void
setCurrentActivityFractionComplete(double fracComplete)
Sets the percentage done of the current activityvoid
setLatestResultPreview(Object latestPreview)
Sets the current result to previewboolean
taskShouldAbort()
Gets whether the task should abort.
-
-
-
Field Detail
-
currentActivityDescription
protected String currentActivityDescription
-
currentActivityFractionComplete
protected double currentActivityFractionComplete
-
cancelFlag
protected volatile boolean cancelFlag
-
pauseFlag
protected volatile boolean pauseFlag
-
isComplete
protected volatile boolean isComplete
-
resultPreviewRequested
protected volatile boolean resultPreviewRequested
-
latestResultPreview
protected volatile Object latestResultPreview
-
resultPreviewer
protected volatile ResultPreviewListener resultPreviewer
-
-
Method Detail
-
setCurrentActivity
public void setCurrentActivity(String activityDescription, double fracComplete)
Description copied from interface:TaskMonitor
Sets the description and the percentage done of the current activity.- Specified by:
setCurrentActivity
in interfaceTaskMonitor
- Parameters:
activityDescription
- the description of the current activityfracComplete
- the percentage done of the current activity
-
setCurrentActivityDescription
public void setCurrentActivityDescription(String activity)
Description copied from interface:TaskMonitor
Sets the description of the current activity.- Specified by:
setCurrentActivityDescription
in interfaceTaskMonitor
- Parameters:
activity
- the description of the current activity
-
setCurrentActivityFractionComplete
public void setCurrentActivityFractionComplete(double fracComplete)
Description copied from interface:TaskMonitor
Sets the percentage done of the current activity- Specified by:
setCurrentActivityFractionComplete
in interfaceTaskMonitor
- Parameters:
fracComplete
- the percentage done of the current activity
-
taskShouldAbort
public boolean taskShouldAbort()
Description copied from interface:TaskMonitor
Gets whether the task should abort.- Specified by:
taskShouldAbort
in interfaceTaskMonitor
- Returns:
- true if the task should abort
-
getCurrentActivityDescription
public String getCurrentActivityDescription()
Description copied from interface:TaskMonitor
Gets the description of the current activity.- Specified by:
getCurrentActivityDescription
in interfaceTaskMonitor
- Returns:
- the description of the current activity
-
getCurrentActivityFractionComplete
public double getCurrentActivityFractionComplete()
Description copied from interface:TaskMonitor
Gets the percentage done of the current activity- Specified by:
getCurrentActivityFractionComplete
in interfaceTaskMonitor
- Returns:
- the percentage done of the current activity
-
isCancelled
public boolean isCancelled()
Description copied from interface:TaskMonitor
Gets whether the task monitored is cancelled.- Specified by:
isCancelled
in interfaceTaskMonitor
- Returns:
- true if the task is cancelled
-
requestCancel
public void requestCancel()
Description copied from interface:TaskMonitor
Requests the task monitored to cancel.- Specified by:
requestCancel
in interfaceTaskMonitor
-
requestPause
public void requestPause()
Description copied from interface:TaskMonitor
Requests the task monitored to pause.- Specified by:
requestPause
in interfaceTaskMonitor
-
requestResume
public void requestResume()
Description copied from interface:TaskMonitor
Requests the task monitored to resume.- Specified by:
requestResume
in interfaceTaskMonitor
-
isPaused
public boolean isPaused()
Description copied from interface:TaskMonitor
Gets whether the task monitored is paused.- Specified by:
isPaused
in interfaceTaskMonitor
- Returns:
- true if the task is paused
-
getLatestResultPreview
public Object getLatestResultPreview()
Description copied from interface:TaskMonitor
Gets the current result to preview- Specified by:
getLatestResultPreview
in interfaceTaskMonitor
- Returns:
- the result to preview
-
requestResultPreview
public void requestResultPreview()
Description copied from interface:TaskMonitor
Requests to preview the task result.- Specified by:
requestResultPreview
in interfaceTaskMonitor
-
requestResultPreview
public void requestResultPreview(ResultPreviewListener toInform)
Description copied from interface:TaskMonitor
Requests to preview the task result.- Specified by:
requestResultPreview
in interfaceTaskMonitor
- Parameters:
toInform
- the listener of the changes in the preview of the result
-
resultPreviewRequested
public boolean resultPreviewRequested()
Description copied from interface:TaskMonitor
Gets whether there is a request for preview the task result.- Specified by:
resultPreviewRequested
in interfaceTaskMonitor
- Returns:
- true if there is a request for preview the task result
-
setLatestResultPreview
public void setLatestResultPreview(Object latestPreview)
Description copied from interface:TaskMonitor
Sets the current result to preview- Specified by:
setLatestResultPreview
in interfaceTaskMonitor
- Parameters:
latestPreview
- the result to preview
-
-