cz.zcu.fav.kiv.ppr
Class Farmer

java.lang.Object
  extended by cz.zcu.fav.kiv.ppr.Farmer

public class Farmer
extends java.lang.Object

PPR1 cz.zcu.fav.kiv.ppr Farmer.java

Author:
kablazka

Constructor Summary
Farmer(int p_threads, int p_lines)
          Constructor of the class Farmer.java
 
Method Summary
 java.util.ArrayList<Occurence> getStatistics(java.util.List<java.lang.String> data, java.lang.String findString)
          getStatistics Method wait until all works done, then return results.
 IPieceOfWork getWork()
          getWork Create new piece of work
 void submitWork(IPieceOfWork results, int threadId)
          submitWork This method is called from Worker, when work is done
 boolean waitForWork(int threadNumber)
          waitForWork If is not work, thread waits and if all work is done, return false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Farmer

public Farmer(int p_threads,
              int p_lines)
Constructor of the class Farmer.java

Parameters:
p_threads -
p_lines -
Method Detail

waitForWork

public boolean waitForWork(int threadNumber)
waitForWork If is not work, thread waits and if all work is done, return false

Parameters:
threadNumber -
Returns:

getWork

public IPieceOfWork getWork()
getWork Create new piece of work

Returns:
IPieceOfWork

submitWork

public void submitWork(IPieceOfWork results,
                       int threadId)
submitWork This method is called from Worker, when work is done

Parameters:
results -
threadId - - ID of thread

getStatistics

public java.util.ArrayList<Occurence> getStatistics(java.util.List<java.lang.String> data,
                                                    java.lang.String findString)
getStatistics Method wait until all works done, then return results.

Parameters:
data -
findString -
Returns:
results