tasks
Class Fib

java.lang.Object
  extended by api.Task
      extended by tasks.Fib
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Task>

public class Fib
extends Task

Fibonacci task class.

See Also:
Serialized Form

Constructor Summary
Fib(int n)
          Fibonacci task of n
Fib(TaskId taskId, int n)
          Constructor for Fib object without a successor task
Fib(TaskId taskId, TaskId successorId, int successorInputIndex, int n)
          Constructor for Fib object with a successor task
 
Method Summary
 Result execute()
          Executes the Fib task
 boolean executeOnServer()
          Method for checking whether this task should execute on the server
 int getN()
          Gets the fibonacci input value
 java.lang.String toString()
          Returns a string representation of this fibonacci
 
Methods inherited from class api.Task
compareTo, getShared, getSuccessorId, getSuccessorInputIndex, getTaskId, sendEvent, setComputer, updateShared
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fib

public Fib(int n)
Fibonacci task of n

Parameters:
n - the fibonacci number to compute

Fib

public Fib(TaskId taskId,
           int n)
Constructor for Fib object without a successor task

Parameters:
taskId - the id of the Fib task
n - the fibonacci index

Fib

public Fib(TaskId taskId,
           TaskId successorId,
           int successorInputIndex,
           int n)
Constructor for Fib object with a successor task

Parameters:
taskId - the Fib task id
successorId - the successor task id
successorInputIndex - the successor task input index
n - the fibonacci index
Method Detail

getN

public int getN()
Gets the fibonacci input value

Returns:
the fibonacci input value

executeOnServer

public boolean executeOnServer()
Method for checking whether this task should execute on the server

Specified by:
executeOnServer in class Task
Returns:
true if this task should execute on the server, false otherwise

execute

public Result execute()
Executes the Fib task

Specified by:
execute in class Task
Returns:
a Container of Fib Results, Tasks, and/or Successors

toString

public java.lang.String toString()
Returns a string representation of this fibonacci

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this fibonacci