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

All Superinterfaces:
Initializable
All Known Implementing Classes:
TaskSpawnerImpl

public interface TaskSpawner
extends Initializable

TaskSpawners manage FrameworkTasks. Maintains a Collection of all added tasks. Provides method to process the result of a FrameworkTask.

Author:
Ryan J McCall

Method Summary
 void addTask(FrameworkTask task)
          Adds and runs supplied FrameworkTask.
 void addTasks(java.util.Collection<? extends FrameworkTask> tasks)
          Adds and runs supplied FrameworkTasks.
 boolean cancelTask(FrameworkTask task)
          Cancels specified task if it exists in this TaskSpawner Task is removed from TaskSpawner and canceled in the TaskManager.
 boolean containsTask(FrameworkTask t)
          Returns whether this TaskSpawner manages this task.
 java.util.Collection<FrameworkTask> getRunningTasks()
          Returns a UnmodifiableCollection that contains the FrameworkTasks in this TaskSpawner.
 void receiveFinishedTask(FrameworkTask task)
          This method receives a task that has finished.
 void setTaskManager(TaskManager taskManager)
          Set the TaskManager this TaskSpawner will use to actually run the tasks.
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
getParam, init, init
 

Method Detail

setTaskManager

void setTaskManager(TaskManager taskManager)
Set the TaskManager this TaskSpawner will use to actually run the tasks.

Parameters:
taskManager - the TaskManager of the system.

addTask

void addTask(FrameworkTask task)
Adds and runs supplied FrameworkTask.

Parameters:
task - the task to add.

addTasks

void addTasks(java.util.Collection<? extends FrameworkTask> tasks)
Adds and runs supplied FrameworkTasks.

Parameters:
tasks - a collection of tasks to be run.

receiveFinishedTask

void receiveFinishedTask(FrameworkTask task)
This method receives a task that has finished. TaskSpawners can choose what to do with the FrameworkTask each time it finishes running. Generally the FrameworkTask's TaskStatus determines this action.

Parameters:
task - finished FrameworkTask

cancelTask

boolean cancelTask(FrameworkTask task)
Cancels specified task if it exists in this TaskSpawner Task is removed from TaskSpawner and canceled in the TaskManager. This is only possible if the tick for which the task is scheduled has not been reached.

Parameters:
task - The task to cancel.
Returns:
true if the task was canceled, false otherwise
See Also:
TaskManager.cancelTask(FrameworkTask)

getRunningTasks

java.util.Collection<FrameworkTask> getRunningTasks()
Returns a UnmodifiableCollection that contains the FrameworkTasks in this TaskSpawner.

Returns:
collection of running tasks.

containsTask

boolean containsTask(FrameworkTask t)
Returns whether this TaskSpawner manages this task.

Parameters:
t - a FrameworkTask
Returns:
True if this taskspawner contains a task with t's id