edu.memphis.ccrg.lida.framework.mockclasses
Class ExecutingMockTaskSpawner

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.tasks.TaskSpawnerImpl
      extended by edu.memphis.ccrg.lida.framework.mockclasses.ExecutingMockTaskSpawner
All Implemented Interfaces:
Initializable, TaskSpawner

public class ExecutingMockTaskSpawner
extends TaskSpawnerImpl
implements TaskSpawner


Field Summary
 java.util.List<FrameworkTask> tasks
           
 
Constructor Summary
ExecutingMockTaskSpawner()
           
 
Method Summary
 void addTask(FrameworkTask task)
          Adds and runs supplied FrameworkTask.
 void addTasks(java.util.Collection<? extends FrameworkTask> initialTasks)
          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 init()
          This is a convenience method to initialize this Object.
 void receiveFinishedTask(FrameworkTask task)
          This method receives a task that has finished.
 
Methods inherited from class edu.memphis.ccrg.lida.framework.tasks.TaskSpawnerImpl
getParam, init, processResults, setTaskManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.tasks.TaskSpawner
setTaskManager
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
getParam, init
 

Field Detail

tasks

public java.util.List<FrameworkTask> tasks
Constructor Detail

ExecutingMockTaskSpawner

public ExecutingMockTaskSpawner()
Method Detail

addTask

public void addTask(FrameworkTask task)
Description copied from interface: TaskSpawner
Adds and runs supplied FrameworkTask.

Specified by:
addTask in interface TaskSpawner
Overrides:
addTask in class TaskSpawnerImpl
Parameters:
task - the task to add.

cancelTask

public boolean cancelTask(FrameworkTask task)
Description copied from interface: TaskSpawner
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.

Specified by:
cancelTask in interface TaskSpawner
Overrides:
cancelTask in class TaskSpawnerImpl
Parameters:
task - The task to cancel.
Returns:
true if the task was canceled, false otherwise
See Also:
TaskManager.cancelTask(FrameworkTask)

getRunningTasks

public java.util.Collection<FrameworkTask> getRunningTasks()
Description copied from interface: TaskSpawner
Returns a UnmodifiableCollection that contains the FrameworkTasks in this TaskSpawner.

Specified by:
getRunningTasks in interface TaskSpawner
Overrides:
getRunningTasks in class TaskSpawnerImpl
Returns:
collection of running tasks.

receiveFinishedTask

public void receiveFinishedTask(FrameworkTask task)
Description copied from interface: TaskSpawner
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.

Specified by:
receiveFinishedTask in interface TaskSpawner
Overrides:
receiveFinishedTask in class TaskSpawnerImpl
Parameters:
task - finished FrameworkTask

addTasks

public void addTasks(java.util.Collection<? extends FrameworkTask> initialTasks)
Description copied from interface: TaskSpawner
Adds and runs supplied FrameworkTasks.

Specified by:
addTasks in interface TaskSpawner
Overrides:
addTasks in class TaskSpawnerImpl
Parameters:
initialTasks - a collection of tasks to be run.

init

public void init()
Description copied from interface: Initializable
This is a convenience method to initialize this Object. It is called from init(Map parameters). Subclasses can overwrite this method in order to initialize this Object. But make sure to call super.init(); at the beginning of the implementation of this method.

Specified by:
init in interface Initializable
Overrides:
init in class TaskSpawnerImpl

containsTask

public boolean containsTask(FrameworkTask t)
Description copied from interface: TaskSpawner
Returns whether this TaskSpawner manages this task.

Specified by:
containsTask in interface TaskSpawner
Overrides:
containsTask in class TaskSpawnerImpl
Parameters:
t - a FrameworkTask
Returns:
True if this taskspawner contains a task with t's id