dcf.server
Interface Task

All Known Implementing Classes:
RandomizerTask, HTMLCrawlerTask, SimpleTask

public interface Task

A General task interface should be implemented by all task objects

Author:
Tal Salmona

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.server.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.server.String str)
          Sets the display name for the task - This is used by the server to index tasks.
 void setParent(Worker w)
          Sets the parent for this task.
 

Method Detail

setData

public void setData(java.lang.Object obj)
Parameters:
obj - Most commonly a Vector of data to be processed.

getData

public java.lang.Object getData()

divide

public void divide()
Divide the task into parts - if the data is a List it is already divided.

hasMore

public boolean hasMore()

next

public java.lang.Object next()

getSize

public int getSize()

addResult

public void addResult(java.lang.Object obj)
Parameters:
obj - An Object to add to the results.

getResults

public java.lang.Object getResults()

setName

public void setName(dcf.server.String str)
Sets the display name for the task - This is used by the server to index tasks.
Parameters:
str - The name for this task.

getName

public dcf.server.String getName()

isCircular

public 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.
Returns:
true - If the task should create new tasks. false - If the task ends when returned.

generate

public java.util.Vector generate()
If this is a circular task it should generate a vector of new tasks
Returns:
A Vector of new Tasks.

processResults

public void processResults()
Called by Distributer when a task is returned.

setParent

public void setParent(Worker w)
Sets the parent for this task.
Parameters:
w - The active Worker for this task.




Distributed Computation Framework