edu.memphis.ccrg.lida.framework.tasks
Interface FrameworkTask

All Superinterfaces:
Activatible, java.util.concurrent.Callable<FrameworkTask>, FullyInitializable, Initializable, Learnable, java.io.Serializable
All Known Subinterfaces:
AttentionCodelet, Codelet, DetectionAlgorithm, StructureBuildingCodelet
All Known Implementing Classes:
AddLinkToPerceptTask, AddNodeStructureToPerceptTask, AddNodeToPerceptTask, AttentionCodeletImpl, BasicAttentionCodelet, BasicDetectionAlgorithm, BasicStructureBuildingCodelet, CodeletImpl, CueBackgroundTask, ExcitationTask, FrameworkTaskImpl, MultipleDetectionAlgorithm, NeighborhoodAttentionCodelet, PropagationTask, SensoryMemoryBackgroundTask, StructureBuildingCodeletImpl, TriggerTask, UpdateCsmBackgroundTask

public interface FrameworkTask
extends java.util.concurrent.Callable<FrameworkTask>, Learnable, FullyInitializable

This is the base interface for all task process in the LIDA framework. All parts of processes in the LIDA Framework have to implement this interface. A FrameworkTask is intended as a small fraction of a process. For example a Codelet or a Feature detector are examples of FrameworkTask. However, if the process includes a loop, one run of the FrameworkTask represents only one iteration of the loop. A TaskSpawner can send FrameworkTasks to the TaskManager for execution. A TaskSpawner receives the task each time it finishes running, so the TaskSpawner can decide if this particular task must run again or not. This is based on the status of the FrameworkTask. The FrameworkTask should set its status during it execution. Implementations of this interface should call the task's TaskSpawner method, TaskSpawner.receiveFinishedTask(FrameworkTask), to handle the finished task at the end of the 'call' method.

Author:
Ryan J. McCall, Javier Snaider
See Also:
Most tasks can extend from this instead of implementing this interface from scratch.

Field Summary
 
Fields inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Learnable
DEFAULT_BASE_LEVEL_ACTIVATION, DEFAULT_LEARNABLE_REMOVAL_THRESHOLD
 
Fields inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Activatible
DEFAULT_ACTIVATIBLE_REMOVAL_THRESHOLD, DEFAULT_ACTIVATION
 
Method Summary
 TaskSpawner getControllingTaskSpawner()
          Gets TaskSpawner that controls this FrameworkTask.
 long getNextTicksPerRun()
          Gets nextTicksPerRun
 long getScheduledTick()
          Returns the tick when this task is scheduled to run next.
 long getTaskId()
          Each FrameworkTask is meant to have a unique id that is set at the time of creation.
 TaskStatus getTaskStatus()
          Returns status
 int getTicksPerRun()
          Gets ticksPerRun
 void setControllingTaskSpawner(TaskSpawner ts)
          Sets TaskSpawner that controls this FrameworkTask.
 void setNextTicksPerRun(long ticks)
          Sets nextTicksPerRun
 void setScheduledTick(long scheduledTick)
          Sets tick when this task will be run next.
 void setTaskStatus(TaskStatus status)
          Sets task status.
 void setTicksPerRun(int ticks)
          Sets ticksPerRun
 void stopRunning()
          Tells this FrameworkTask to shutdown.
 
Methods inherited from interface java.util.concurrent.Callable
call
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Learnable
decayBaseLevelActivation, getBaseLevelActivation, getBaseLevelDecayStrategy, getBaseLevelExciteStrategy, getLearnableRemovalThreshold, getTotalActivationStrategy, reinforceBaseLevelActivation, setBaseLevelActivation, setBaseLevelDecayStrategy, setBaseLevelExciteStrategy, setBaseLevelRemovalThreshold, setTotalActivationStrategy
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.shared.activation.Activatible
decay, excite, getActivatibleRemovalThreshold, getActivation, getDecayStrategy, getExciteStrategy, getTotalActivation, isRemovable, setActivatibleRemovalThreshold, setActivation, setDecayStrategy, setExciteStrategy
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.FullyInitializable
setAssociatedModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
getParam, init, init
 

Method Detail

getTaskStatus

TaskStatus getTaskStatus()
Returns status

Returns:
current FrameworkTask status

setTaskStatus

void setTaskStatus(TaskStatus status)
Sets task status. Intended to be called by runThisFrameworkTask() Cannot use this method to cancel the task, instead use stopRunning() to cancel the task.

Parameters:
status - the new task status

stopRunning

void stopRunning()
Tells this FrameworkTask to shutdown.


getTaskId

long getTaskId()
Each FrameworkTask is meant to have a unique id that is set at the time of creation.

Returns:
id unique task identifier

setTicksPerRun

void setTicksPerRun(int ticks)
Sets ticksPerRun

Parameters:
ticks - number of ticks that will occur between executions of this task
See Also:
change ticksPerRun for the next run only

getTicksPerRun

int getTicksPerRun()
Gets ticksPerRun

Returns:
number of ticks that will occur between executions of this task

setControllingTaskSpawner

void setControllingTaskSpawner(TaskSpawner ts)
Sets TaskSpawner that controls this FrameworkTask.

Parameters:
ts - the TaskSpawner

getControllingTaskSpawner

TaskSpawner getControllingTaskSpawner()
Gets TaskSpawner that controls this FrameworkTask.

Returns:
the TaskSpawner.

setNextTicksPerRun

void setNextTicksPerRun(long ticks)
Sets nextTicksPerRun

Parameters:
ticks - number of ticks that must pass before for the next, and only the next, execution of this FrameworkTask.
See Also:
to set the permanent (default) number of ticksPerRun

getNextTicksPerRun

long getNextTicksPerRun()
Gets nextTicksPerRun

Returns:
number of ticks that will occur before the next execution of this FrameworkTask.

setScheduledTick

void setScheduledTick(long scheduledTick)
Sets tick when this task will be run next. This method is used by TaskManager when a new task is added.

Parameters:
scheduledTick - tick to schedule this task
See Also:
TaskManager

getScheduledTick

long getScheduledTick()
Returns the tick when this task is scheduled to run next. Could be in the future if this task is already scheduled for execution.

Returns:
scheduledTick tick when this task will run next