offlineProcessing
Class OfflineTask<T extends PamDataUnit>

java.lang.Object
  extended by offlineProcessing.OfflineTask<T>
Direct Known Subclasses:
ReclassifyTask

public abstract class OfflineTask<T extends PamDataUnit>
extends java.lang.Object

An offline task, such as click species id. Generally controlled and operated from within an OLProcessDialog

Author:
Doug Gillespie
See Also:
OLProcessDialog

Field Summary
private  java.util.ArrayList<PamDataBlock> affectedDataBlocks
          Data blocks who's data may be affected by this task (so will need saving)
private  PamDataBlock<T> dataBlock
          primary data block for the task;
private  boolean doRun
          We want this particular task to run ? N.B.
private  java.util.ArrayList<PamDataBlock> requiredDatablocks
          list of other data blocks also required by this task.
 
Constructor Summary
OfflineTask()
           
 
Method Summary
 void addAffectedDataBlock(PamDataBlock dataBlock)
          Add an affected data block.
 void addRequiredDataBlock(PamDataBlock dataBlock)
          Add a required data block.
 boolean callSettings()
          Call any task specific settings
 boolean canRun()
          can the task be run ? This will generally be true, but may be false if the task is dependent on some other module which may not be present.
 PamDataBlock getAffectedDataBlock(int iBlock)
          A data block required to run this task.
 PamDataBlock<T> getDataBlock()
          (Not sure what happens if we need multiple data units to complete a task !)
abstract  java.lang.String getName()
           
 int getNumAffectedDataBlocks()
           
 int getNumRequiredDataBlocks()
           
 PamDataBlock getRequiredDataBlock(int iBlock)
          A data block required to run this task.
 boolean hasSettings()
          task has settings which can be called
 boolean isDoRun()
          return whether or not the task SHOULD be run - i.e.
abstract  void newDataLoad(long startTime, long endTime, OfflineDataMapPoint mapPoint)
          Called when new data are loaded for offline processing (or once at the start of processing loaded data).
abstract  boolean processDataUnit(T dataUnit)
          Process a single data unit.
abstract  void processingComplete()
          Called when processing of loaded data, or each map point worth of data, is complete.
 void setDataBlock(PamDataBlock<T> dataBlock)
           
 void setDoRun(boolean doRun)
          Set whether or not this task within a taskGroup should be run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doRun

private boolean doRun
We want this particular task to run ? N.B. this is different to canRun !


dataBlock

private PamDataBlock<T extends PamDataUnit> dataBlock
primary data block for the task;


requiredDatablocks

private java.util.ArrayList<PamDataBlock> requiredDatablocks
list of other data blocks also required by this task.


affectedDataBlocks

private java.util.ArrayList<PamDataBlock> affectedDataBlocks
Data blocks who's data may be affected by this task (so will need saving)

Constructor Detail

OfflineTask

public OfflineTask()
Method Detail

getDataBlock

public PamDataBlock<T> getDataBlock()
(Not sure what happens if we need multiple data units to complete a task !)

Returns:
the datablock used by the task.

setDataBlock

public void setDataBlock(PamDataBlock<T> dataBlock)
Parameters:
dataBlock - the dataBlock to set

getName

public abstract java.lang.String getName()
Returns:
a name for the task, to be displayed in the dialog.

hasSettings

public boolean hasSettings()
task has settings which can be called

Returns:
true or false

callSettings

public boolean callSettings()
Call any task specific settings

Returns:
true if settings may have changed.

canRun

public boolean canRun()
can the task be run ? This will generally be true, but may be false if the task is dependent on some other module which may not be present.

Returns:
true if it's possible to run the task.

processDataUnit

public abstract boolean processDataUnit(T dataUnit)
Process a single data unit.

Returns:
true if the data unit has changed in some way so that it will need re-writing to it's binary file or database.

newDataLoad

public abstract void newDataLoad(long startTime,
                                 long endTime,
                                 OfflineDataMapPoint mapPoint)
Called when new data are loaded for offline processing (or once at the start of processing loaded data).

Parameters:
startTime - start time of loaded data
endTime - end time of loaded data

processingComplete

public abstract void processingComplete()
Called when processing of loaded data, or each map point worth of data, is complete.


addRequiredDataBlock

public void addRequiredDataBlock(PamDataBlock dataBlock)
Add a required data block. These are data blocks apart from the main one which are required before this task can complete. Data for these block will be loaded automatically.

Parameters:
dataBlock - required data block.

getNumRequiredDataBlocks

public int getNumRequiredDataBlocks()
Returns:
the number of data blocks required to run this task.

getRequiredDataBlock

public PamDataBlock getRequiredDataBlock(int iBlock)
A data block required to run this task.

Parameters:
iBlock - block index
Returns:
data block .

addAffectedDataBlock

public void addAffectedDataBlock(PamDataBlock dataBlock)
Add an affected data block. These are data blocks apart from the main one which will have their contents changed by tehe task and will require saving / updating as the task progresses.

Parameters:
dataBlock - affected data block.

getNumAffectedDataBlocks

public int getNumAffectedDataBlocks()
Returns:
the number of data blocks required to run this task.

getAffectedDataBlock

public PamDataBlock getAffectedDataBlock(int iBlock)
A data block required to run this task.

Parameters:
iBlock - block index
Returns:
data block .

isDoRun

public boolean isDoRun()
return whether or not the task SHOULD be run - i.e. is it selected in the dialog, etc. ?

Returns:
the doRun

setDoRun

public void setDoRun(boolean doRun)
Set whether or not this task within a taskGroup should be run.

Parameters:
doRun - the doRun to set