tasks
Class Sum

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

public class Sum
extends Successor

Sum class. This is a successor class for fibonacci results.

See Also:
Serialized Form

Constructor Summary
Sum(TaskId taskId, TaskId successorId, int successorInputIndex, int n)
          Constructor for Sum class
 
Method Summary
 Result execute()
          Computes the sum of its input objects
 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.Successor
getInput, getInputSize, hasAllInput, setInput
 
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

Sum

public Sum(TaskId taskId,
           TaskId successorId,
           int successorInputIndex,
           int n)
Constructor for Sum class

Parameters:
n - the fibonacci input
taskId - task id of this Sum task
successorId - id of the successor task
successorInputIndex - input index of the successor
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()
Computes the sum of its input objects

Specified by:
execute in class Task
Returns:
a Container with a Result storing the sum of the inputs

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