api
Class Task

java.lang.Object
  extended by api.Task
All Implemented Interfaces:
TaskInterface, java.io.Serializable
Direct Known Subclasses:
EuclideanTspMinTask, EuclideanTspTask, SudokuTask

public abstract class Task
extends java.lang.Object
implements TaskInterface

Abstract class that describes the system enforced specifications of a task.

Author:
Diana Abbas, Ryan Neal
See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
Task()
           
 
Method Summary
 int getDrainID()
          Gets the drainID which specifies where the result is intended to go.
 int getInputCount()
          Tells the number of inputs still pending in the for the Task.
 int getTaskID()
          Gets the taskID which specifies the id of this task.
abstract  Result run(Shared shared)
          Empty function.
 void setComputer(Computer computer)
          Tells the task what machine it is executing on.
abstract  void setInput(Result r)
          Empty function.
 void setShared(Shared proposedShared)
          Sets the task's shared object, then update the computer with the new shared object
 void setTaskID(int tID)
          Sets the ID of the task.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Task

public Task()
Method Detail

getTaskID

public int getTaskID()
Gets the taskID which specifies the id of this task. A unique Identifier for this task itself.

Specified by:
getTaskID in interface TaskInterface
Returns:
The ID of this Task.

getDrainID

public int getDrainID()
Gets the drainID which specifies where the result is intended to go. The value of -1 indicates that it is supposed to go back to the client.

Specified by:
getDrainID in interface TaskInterface
Returns:
The ID of the task that the data is supposed to be delivered to.

getInputCount

public int getInputCount()
Tells the number of inputs still pending in the for the Task.

Specified by:
getInputCount in interface TaskInterface
Returns:
The number of pending inputs.

setComputer

public void setComputer(Computer computer)
Tells the task what machine it is executing on. Necessary in order to do spawns for a new task.

Specified by:
setComputer in interface TaskInterface
Parameters:
computer - The computer that the task is executing on.

setTaskID

public void setTaskID(int tID)
Sets the ID of the task. It is its ID.

Parameters:
tID -

setShared

public void setShared(Shared proposedShared)
Sets the task's shared object, then update the computer with the new shared object

Parameters:
proposedShared -

setInput

public abstract void setInput(Result r)
Empty function. SHOULD be overwritten by any classes that extend this class.

Specified by:
setInput in interface TaskInterface
Parameters:
r - The Result that is a partial solution.

run

public abstract Result run(Shared shared)
Empty function. It SHOULD be overwritten by any classes that extend this one.

Specified by:
run in interface TaskInterface