|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object TraderImpl
public class TraderImpl
Implementation of a trader. CS 537, Spring 2007, Project 2.
Constructor Summary | |
---|---|
TraderImpl(Grain specialty)
Creates a new Trader. |
Method Summary | |
---|---|
void |
deliver(int bushels)
Accepts more grain from the supplier. |
void |
get(Order order)
A purchase request from a Brewer. |
Order |
getAmountOnHand()
Reports on the total amount of resources held by this Trader. |
void |
swap(Grain what,
int bushels)
Responds to a swap request from another trader. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TraderImpl(Grain specialty)
specialty
- the grain type for which this Trader is the supplier.Method Detail |
---|
public Order getAmountOnHand()
getAmountOnHand
in interface Trader
public void get(Order order) throws InterruptedException
get
in interface Trader
order
- the amount needed of each type of grain.
InterruptedException
- if the current thread is interrupted while
waiting for the order to be filled.public void swap(Grain what, int bushels) throws InterruptedException
swap
in interface Trader
what
- the type of grain the other trader wants to swap.bushels
- the number of bushels to swap.
InterruptedException
- if the current thread is interrupted while
waiting for the swap to succeed.public void deliver(int bushels)
deliver
in interface Trader
bushels
- the number of bushels of this Trader's specialty grain
type being delivered.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |