dcf.tasks
Class RandomizerTask

dcf.tasks.RandomizerTask
All Implemented Interfaces:
Task

public class RandomizerTask
implements Task

Randomizer Task - Simply holds an array of ints.
The solver will randomly fill them with integers.
Note: This is a circualr task, What this means is that when the task is done it will generate a new task with itself as the input.
A circular task could optionally create a different kind of task thus, you might want to create a group of tasks where each task handles only a part of the whole solution.

Author:
Tal Salmona

Constructor Summary
RandomizerTask()
           
 
Method Summary
 void addResult(java.lang.Object obj)
           
 void divide()
          Divide the task into parts - if the data is a List it is already divided.
 java.util.Vector generate()
          If this is a circular task it should generate a vector of new tasks
 java.lang.Object getData()
           
 dcf.tasks.String getName()
           
 java.lang.Object getResults()
           
 int getSize()
           
 boolean hasMore()
           
 boolean isCircular()
          The Distributer will call this method when a Task is returned by the client.
If the task is circualr the client will call the generate() method to create additinal tasks.
 java.lang.Object next()
           
 void processResults()
          Called by Distributer when a task is returned.
 void setData(java.lang.Object obj)
           
 void setName(dcf.tasks.String n)
           
 void setParent(Worker w)
          Sets the parent for this task.
 void setProgress(float i)
          Sets the task progress (used by the Solver to set it to the Worker)
 
Methods inherited from interface dcf.server.Task
setName
 

Constructor Detail

RandomizerTask

public RandomizerTask()
Method Detail

setData

public void setData(java.lang.Object obj)
Specified by:
setData in interface Task
Following copied from interface: dcf.server.Task
Parameters:
obj - Most commonly a Vector of data to be processed.

getData

public java.lang.Object getData()
Specified by:
getData in interface Task

divide

public void divide()
Description copied from interface: Task
Divide the task into parts - if the data is a List it is already divided.
Specified by:
divide in interface Task

hasMore

public boolean hasMore()
Specified by:
hasMore in interface Task

next

public java.lang.Object next()
Specified by:
next in interface Task

getSize

public int getSize()
Specified by:
getSize in interface Task

addResult

public void addResult(java.lang.Object obj)
Specified by:
addResult in interface Task
Following copied from interface: dcf.server.Task
Parameters:
obj - An Object to add to the results.

getResults

public java.lang.Object getResults()
Specified by:
getResults in interface Task

setName

public void setName(dcf.tasks.String n)

getName

public dcf.tasks.String getName()
Specified by:
getName in interface Task

isCircular

public boolean isCircular()
Description copied from interface: Task
The Distributer will call this method when a Task is returned by the client.
If the task is circualr the client will call the generate() method to create additinal tasks.
Specified by:
isCircular in interface Task
Following copied from interface: dcf.server.Task
Returns:
true - If the task should create new tasks. false - If the task ends when returned.

generate

public java.util.Vector generate()
Description copied from interface: Task
If this is a circular task it should generate a vector of new tasks
Specified by:
generate in interface Task
Following copied from interface: dcf.server.Task
Returns:
A Vector of new Tasks.

processResults

public void processResults()
Description copied from interface: Task
Called by Distributer when a task is returned.
Specified by:
processResults in interface Task

setParent

public void setParent(Worker w)
Description copied from interface: Task
Sets the parent for this task.
Specified by:
setParent in interface Task
Following copied from interface: dcf.server.Task
Parameters:
w - The active Worker for this task.

setProgress

public void setProgress(float i)
Sets the task progress (used by the Solver to set it to the Worker)
Parameters:
i - The progress for this task.




Distributed Computation Framework