Class Consumer

java.lang.Object
  |
  +--Process
        |
        +--BoundedBufferProcess
              |
              +--Consumer
All Implemented Interfaces:
java.lang.Runnable

public class Consumer
extends BoundedBufferProcess

A Consumer is a bounded buffer process that removes buffers from its full buffer queue, processes them, and places them onto its empty buffer queue. The average amount of time spent processing a buffer is the twiddle time of the consumer.


Fields inherited from class BoundedBufferProcess
empty, full
 
Constructor Summary
Consumer(java.lang.String nm, double t, BufferQueue f, BufferQueue e)
          new Consumer(nm, t, f, e) returns a new consumer and starts executing its run method in a new thread.
 
Method Summary
 void step()
          cons.step() simulates processing a single buffer.
 
Methods inherited from class Process
run, setSimulationTime, toString, twiddle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Consumer

public Consumer(java.lang.String nm,
                double t,
                BufferQueue f,
                BufferQueue e)
new Consumer(nm, t, f, e) returns a new consumer and starts executing its run method in a new thread. The name of the new consumer is formed by concatenating its class name with nm. The average twiddle time of the new consumer is t. The new consumer uses f as a queue for full buffers and e as a queue for empty buffers.
Method Detail

step

public void step()
cons.step() simulates processing a single buffer.
Overrides:
step in class Process