cs290b.project.api
Class Task

java.lang.Object
  extended by cs290b.project.api.Task
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Task>
Direct Known Subclasses:
BasicTask, ComposeTask, FibonacciTaskImpl, MandelbrotTaskImpl, SatTaskImpl, TspTaskImpl

public class Task
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Task>

Default implementation of a divide and conquer task. The child tasks are used by the Computer to add input tasks during for later processing. Note: This class has a natural ordering that is inconsistent with equals.

See Also:
Serialized Form

Constructor Summary
Task()
           
 
Method Summary
 int compareTo(Task task)
           
protected  void compute(Task task)
          Used to the execute method to mark child tasks for execution.
 java.lang.Object execute(java.lang.Object input)
          Default impelementation of the execute method.
 boolean executeOnServer()
           
 int getArgIndex()
          The index where the Result of this task will be located
 java.util.ArrayList<Task> getChildTasks()
          Child tasks added during execution.
 long getCriticalPath()
           
 long getRunTime()
           
protected  Shared getShared()
           
 Computer2Server getSourceServer()
           
 TaskId getSuccessorId()
           
 TaskId getTaskId()
          Return the associated TaskId
protected  void sendEvent(java.lang.Object event)
           
 void setArgIndex(int value)
          Set the index where the Result of this task will be located.
 void setCriticalPath(long cp)
           
 void setRunTime(long time)
           
protected  void setShared(Shared shared)
           
 void setSourceServer(Computer2Server sourceServer)
           
 void setSuccessorId(TaskId successorId)
           
 void setSupport(SupportManager support)
           
 void setTaskId(TaskId value)
          Assign the associated TaskId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Task

public Task()
Method Detail

getCriticalPath

public long getCriticalPath()

setCriticalPath

public void setCriticalPath(long cp)

setSupport

public void setSupport(SupportManager support)

setShared

protected void setShared(Shared shared)

setSourceServer

public void setSourceServer(Computer2Server sourceServer)

getSourceServer

public Computer2Server getSourceServer()

getShared

protected Shared getShared()

sendEvent

protected void sendEvent(java.lang.Object event)

executeOnServer

public boolean executeOnServer()

compareTo

public int compareTo(Task task)
Specified by:
compareTo in interface java.lang.Comparable<Task>

setSuccessorId

public void setSuccessorId(TaskId successorId)

getSuccessorId

public TaskId getSuccessorId()

setRunTime

public void setRunTime(long time)

getRunTime

public long getRunTime()

setArgIndex

public void setArgIndex(int value)
Set the index where the Result of this task will be located.

Parameters:
value - The index to set.

getArgIndex

public int getArgIndex()
The index where the Result of this task will be located

Returns:
The index where the Result will be located.

setTaskId

public void setTaskId(TaskId value)
Assign the associated TaskId.

Parameters:
value - The TaskId to set.

getTaskId

public TaskId getTaskId()
Return the associated TaskId

Returns:
The assigned TaskId.

getChildTasks

public java.util.ArrayList<Task> getChildTasks()
Child tasks added during execution. Assigned during the compute method.

Returns:
An ArrayList of child tasks.

compute

protected void compute(Task task)
Used to the execute method to mark child tasks for execution.

Parameters:
task - The child task to execute.

execute

public java.lang.Object execute(java.lang.Object input)
Default impelementation of the execute method. This should be overriden by child classes.

Parameters:
input - The shared input set by the client
Returns:
The computed result.


Anna Sibirtseva & Chris Ferguson, CS 290B