|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectResource
Resource class -- manages agents requesting a resource
Field Summary | |
protected int |
amount
Amount of resource available |
protected Queue |
blocked
Queue of who's waiting for resource |
Constructor Summary | |
Resource()
Start out with no resource and an empty queue |
Method Summary | |
void |
add(int production)
Add more produced resource. |
void |
addToList(DEAgent agent)
addToList -- add this agent to this resource's waiting list. |
int |
amountAvailable()
Amount available |
void |
consume(int amtDesired)
Consume resource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int amount
protected Queue blocked
Constructor Detail |
public Resource()
Method Detail |
public int amountAvailable()
public void consume(int amtDesired)
public void add(int production)
public void addToList(DEAgent agent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |