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

All Superinterfaces:
Activatible, java.util.concurrent.Callable<FrameworkTask>, FullyInitializable, Initializable, Learnable
All Known Subinterfaces:
AttentionCodelet, Codelet, DetectionAlgorithm, StructureBuildingCodelet
All Known Implementing Classes:
AddLinkToPerceptTask, AddNodeStructureToPerceptTask, AddNodeToPerceptTask, AttentionCodeletImpl, BasicAttentionCodelet, BasicDetectionAlgorithm, BasicStructureBuildingCodelet, CodeletImpl, CueBackgroundTask, DefaultAttentionCodelet, 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
 void cancel()
          Sets this FrameworkTask's TaskStatus to TaskStatus.CANCELED.
FrameworkTask cannot be restarted and its TaskStatus can no longer change.
 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()
          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 t)
          Sets nextTicksPerRun
 void setScheduledTick(long t)
          Sets tick when this task will be run next.
 void setTaskStatus(TaskStatus s)
          Sets the task's TaskStatus.
 void setTicksPerRun(int t)
          Sets ticksPerRun
 void stopRunning()
          Deprecated. To be replaced by cancel() which should be used instead. The method's name makes it ambiguous as to whether it sets TaskStatus to TaskStatus.FINISHED or TaskStatus.CANCELED.
 
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.Initializable
containsParameter, getParam, getParameters, init, init
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.FullyInitializable
setAssociatedModule
 

Method Detail

getTaskStatus

TaskStatus getTaskStatus()
Returns status

Returns:
current FrameworkTask status

setTaskStatus

void setTaskStatus(TaskStatus s)
Sets the task's TaskStatus. If TaskStatus is TaskStatus.CANCELED TaskStatus will not be modified.

Parameters:
s - the new TaskStatus

stopRunning

@Deprecated
void stopRunning()
Deprecated. To be replaced by cancel() which should be used instead. The method's name makes it ambiguous as to whether it sets TaskStatus to TaskStatus.FINISHED or TaskStatus.CANCELED.

Tells this FrameworkTask to shutdown.


cancel

void cancel()
Sets this FrameworkTask's TaskStatus to TaskStatus.CANCELED.
FrameworkTask cannot be restarted and its TaskStatus can no longer change.


getTaskId

long getTaskId()
A unique id that is set at the time of creation.

Returns:
id unique task identifier

setTicksPerRun

void setTicksPerRun(int t)
Sets ticksPerRun

Parameters:
t - 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 t)
Sets nextTicksPerRun

Parameters:
t - 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 t)
Sets tick when this task will be run next. This method is used by TaskManager when a new task is added.

Parameters:
t - 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