nl.tudelft.ewi.alg.distsim.example
Class MyProc

java.lang.Object
  extended by nl.tudelft.ewi.alg.distsim.DProcess<ChainLetter>
      extended by nl.tudelft.ewi.alg.distsim.example.MyProc

public class MyProc
extends DProcess<ChainLetter>

These distributed processes each start off with a message of their own. This message is a "chain letter" of sorts and must be passed around randomly a couple of times, until it eventually winds up again with the originator.

Author:
L@eacute;on Planken

Field Summary
static java.lang.String[] MESSAGES
           
static int TWIDDLE_TIME
           
 
Fields inherited from class nl.tudelft.ewi.alg.distsim.DProcess
id, masterProc
 
Constructor Summary
MyProc(MasterProcess<ChainLetter> master, int id, int processcount)
           
 
Method Summary
 boolean isDone()
          Whether or not this process is done.
protected  void receiveMessage(int senderID, ChainLetter msg)
          Subclasses need to implement this.
 void setProcs(int[] processIDs)
           
 
Methods inherited from class nl.tudelft.ewi.alg.distsim.DProcess
equals, getClock, getIdle, getMasterProcess, hashCode, log, sendMessage, setClock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGES

public static final java.lang.String[] MESSAGES

TWIDDLE_TIME

public static final int TWIDDLE_TIME
See Also:
Constant Field Values
Constructor Detail

MyProc

public MyProc(MasterProcess<ChainLetter> master,
              int id,
              int processcount)
Method Detail

isDone

public boolean isDone()
Description copied from class: DProcess
Whether or not this process is done.

Specified by:
isDone in class DProcess<ChainLetter>
Returns:
false if there is work to do yet even if no message is available; if so, receiveMessage(null,null) is called.

receiveMessage

protected void receiveMessage(int senderID,
                              ChainLetter msg)
Description copied from class: DProcess
Subclasses need to implement this.

Specified by:
receiveMessage in class DProcess<ChainLetter>
Parameters:
senderID - the sender of the message
msg - the message received.

setProcs

public void setProcs(int[] processIDs)