edu.stanford.smi.protegex.owl.inference.protegeowl.task
Class AbstractReasonerTask

java.lang.Object
  extended byedu.stanford.smi.protegex.owl.inference.protegeowl.task.AbstractReasonerTask
All Implemented Interfaces:
ReasonerTask
Direct Known Subclasses:
AbstractSingleConceptWithConceptCollectionResultTask, ClassifyTaxonomyTask, GetConceptIntersectionSuperclassesTask, GetConceptSatisfiableTask, GetIndividualInferredTypesTask, GetIndividualsBelongingToConceptTask, GetSubsumptionRelationshipTask, IsConceptIntersectionSatisfiableTask, IsDisjointToTask, IsSubsumedByTask, ResetInferredHierarchyTask, SynchronizeReasonerTask, UpdateEquivalentClassesTask, UpdateInconsistentClassesTask, UpdateInferredHierarchyTask, UpdateInferredTypesTask

public abstract class AbstractReasonerTask
extends Object
implements ReasonerTask

User: matthewhorridge
The Univeristy Of Manchester
Medical Informatics Group
Date: Aug 13, 2004

matthew.horridge@cs.man.ac.uk
www.cs.man.ac.uk/~horridgm

A partial implementation of ReasonerTask that implements several useful methods to set the task state and simultaneously notify listeners of state changes.


Field Summary
private  boolean abortTask
           
private  String description
           
private  ReasonerTaskEvent evt
           
private  ArrayList listeners
           
private  String message
           
private  int progress
           
private  boolean progressIndeterminate
           
private  DIGTranslator translator
           
 
Constructor Summary
AbstractReasonerTask(ProtegeOWLReasoner protegeOWLReasoner)
           
 
Method Summary
 void addTaskListener(ReasonerTaskListener lsnr)
          Adds a listener.
protected  void doAbortCheck()
           
protected  void fireDescriptionChangedEvent()
          Informs registered listeners of a change in task description.
protected  void fireMessageChangedEvent()
          Informs registered listeners of a change in task message
protected  void fireProgressChangedEvent()
          Informs registered listeners of a change in task progress
protected  void fireProgressIndeterminateChnaged()
          Informs registered listeners of a change in the state of whether the task progress can be determined or not.
protected  void fireTaskCompletedEvent()
          Informs registered listeners that the task was completed.
protected  void fireTaskFailedEvent()
          Informs registered listeners that the task failed.
 String getDescription()
          Gets a high level description of the task.
 String getMessage()
          Gets the current task message.
 int getProgress()
          Gets the current progress of a task.
protected  DIGTranslator getTranslator()
          Gets the translator that should be used to convert Protege-OWL to DIG and vice versa
 boolean isProgressIndeterminate()
          Determines whether the task can determine its overall progress.
 boolean isRequestAbort()
           
protected  void postLogRecord(ReasonerLogRecord logRecord)
           
 void removeTaskListener(ReasonerTaskListener lsnr)
          Removes a previously added listener.
protected  void setDescription(String description)
          Sets the high level task description, notifiying listeners of the change in description.
protected  void setMessage(String message)
          Sets the task message, notifying any listeners of the change in message.
protected  void setProgress(int progress)
          Sets the progress of the task, simultaneously notifying listeners that the progress has changed.
protected  void setProgressIndeterminate(boolean b)
          Sets the progress as indeterminate, notifying listeners of the change.
 void setRequestAbort()
           
protected  void setTaskCompleted()
          Sets the task as having a 'complete' status, notifying listeners that the task is complete.
protected  void setTaskFailed()
          Sets the task as having a 'failed' status, notifying listeners that the task failed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.stanford.smi.protegex.owl.inference.protegeowl.task.ReasonerTask
getTaskSize, run
 

Field Detail

listeners

private ArrayList listeners

progress

private int progress

progressIndeterminate

private boolean progressIndeterminate

description

private String description

message

private String message

evt

private ReasonerTaskEvent evt

abortTask

private boolean abortTask

translator

private DIGTranslator translator
Constructor Detail

AbstractReasonerTask

public AbstractReasonerTask(ProtegeOWLReasoner protegeOWLReasoner)
Method Detail

getTranslator

protected DIGTranslator getTranslator()
Gets the translator that should be used to convert Protege-OWL to DIG and vice versa


setProgress

protected void setProgress(int progress)
Sets the progress of the task, simultaneously notifying listeners that the progress has changed.

Parameters:
progress - The new progress value

setProgressIndeterminate

protected void setProgressIndeterminate(boolean b)
Sets the progress as indeterminate, notifying listeners of the change.

Parameters:
b - true if the task progress cannot be determined, false if the task progress can be determined.

getProgress

public int getProgress()
Description copied from interface: ReasonerTask
Gets the current progress of a task.

Specified by:
getProgress in interface ReasonerTask

isProgressIndeterminate

public boolean isProgressIndeterminate()
Description copied from interface: ReasonerTask
Determines whether the task can determine its overall progress. If the task cannot determine its progress then the progress may not be tracked - the progress is indeterminate.

Specified by:
isProgressIndeterminate in interface ReasonerTask
Returns:
true if the progress cannot be determined. false if the progress can be determined. If a task is indeterminate the results for getTaskSize and getProgress are undefined.

getDescription

public String getDescription()
Description copied from interface: ReasonerTask
Gets a high level description of the task. This description should typically describe the overall status of the task e.g. "Classifying taxonomy"

Specified by:
getDescription in interface ReasonerTask

setDescription

protected void setDescription(String description)
Sets the high level task description, notifiying listeners of the change in description.

Parameters:
description - The new task description.

setMessage

protected void setMessage(String message)
Sets the task message, notifying any listeners of the change in message.

Parameters:
message - The new message.

getMessage

public String getMessage()
Description copied from interface: ReasonerTask
Gets the current task message. This will typically change throughout the course of the task procedure.

Specified by:
getMessage in interface ReasonerTask

setTaskCompleted

protected void setTaskCompleted()
Sets the task as having a 'complete' status, notifying listeners that the task is complete.


setTaskFailed

protected void setTaskFailed()
Sets the task as having a 'failed' status, notifying listeners that the task failed.


addTaskListener

public void addTaskListener(ReasonerTaskListener lsnr)
Adds a listener.

Specified by:
addTaskListener in interface ReasonerTask

removeTaskListener

public void removeTaskListener(ReasonerTaskListener lsnr)
Removes a previously added listener.

Specified by:
removeTaskListener in interface ReasonerTask

fireProgressChangedEvent

protected void fireProgressChangedEvent()
Informs registered listeners of a change in task progress


fireProgressIndeterminateChnaged

protected void fireProgressIndeterminateChnaged()
Informs registered listeners of a change in the state of whether the task progress can be determined or not.


fireDescriptionChangedEvent

protected void fireDescriptionChangedEvent()
Informs registered listeners of a change in task description.


fireMessageChangedEvent

protected void fireMessageChangedEvent()
Informs registered listeners of a change in task message


fireTaskFailedEvent

protected void fireTaskFailedEvent()
Informs registered listeners that the task failed.


fireTaskCompletedEvent

protected void fireTaskCompletedEvent()
Informs registered listeners that the task was completed.


postLogRecord

protected void postLogRecord(ReasonerLogRecord logRecord)

setRequestAbort

public void setRequestAbort()
Specified by:
setRequestAbort in interface ReasonerTask

isRequestAbort

public boolean isRequestAbort()
Specified by:
isRequestAbort in interface ReasonerTask

doAbortCheck

protected void doAbortCheck()
                     throws DIGReasonerException
Throws:
DIGReasonerException