|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Brewer
public class Brewer
A consumer of grain.
CS 537, Spring 2007, Project 3.
Field Summary | |
---|---|
private Order |
consumed
Total consumed thus far. |
private int |
id
Id of this Brewer. |
private Order |
maxRequest
Maximum amount of each grain to ask for on each request. |
private int |
meanSleepTime
Mean sleep time (in milliseconds) between purchase requests. |
private int |
numberOfRequests
Number of requests completed so far. |
private int |
totalServiceTime
Sum of service times for all requests. |
private static int |
VERSION
Source version number. |
Constructor Summary | |
---|---|
Brewer(int id)
Creates a new Brewer object. |
Method Summary | |
---|---|
private void |
consume(Order amount)
Consumes the indicated amounts of resources. |
Order |
getConsumption()
Reports on the total amount consumed thus far. |
int |
requestsCompleted()
Returns the number of requests to the Warehouse successfully completed by this Brewer. |
void |
run()
Main loop. |
int |
waitingTime()
Returns the time in milliseconds this Brewer has spent waiting. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int VERSION
private int id
private int meanSleepTime
private Order maxRequest
private Order consumed
private int numberOfRequests
private int totalServiceTime
Constructor Detail |
---|
public Brewer(int id)
id
- the unique id of this brewer.Method Detail |
---|
public Order getConsumption()
public int requestsCompleted()
public int waitingTime()
private void consume(Order amount)
amount
- a vector of amounts, one for each grain.public void run()
run
in interface Runnable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |