martin.common.compthreads
Class Worker<E>

java.lang.Object
  extended by martin.common.compthreads.Worker<E>
Type Parameters:
E - the class of the result from the computations.
All Implemented Interfaces:
java.lang.Runnable

 class Worker<E>
extends java.lang.Object
implements java.lang.Runnable

Worker thread class for performing concurrent computations.

Author:
Martin

Field Summary
private  int id
           
private  Master<E> master
           
private  Problem<E> problem
           
 
Constructor Summary
Worker(Problem<E> problem, Master<E> master, int id)
           
 
Method Summary
 void run()
          runs the compute() function of the problem, and then reports back to the master object with the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

problem

private Problem<E> problem

master

private Master<E> master

id

private int id
Constructor Detail

Worker

Worker(Problem<E> problem,
       Master<E> master,
       int id)
Parameters:
problem - the problem which is to be computed
master - master object to report back to when finished
id - the id of the problem
Method Detail

run

public void run()
runs the compute() function of the problem, and then reports back to the master object with the result.

Specified by:
run in interface java.lang.Runnable