Interface Broker

All Known Implementing Classes:
BrokerImplementation

public interface Broker

CS 537, Spring 2004, Project 2. Interface to be implmented by BrokerImplementation.


Method Summary
 void deliver(int ounces)
          Accepts more metal from the refiner.
 void get(int[] order)
          A request from a consumer.
 void getAmountOnHand(int[] result)
          Reports on the total amount of resources held by this Broker.
 void swap(int what, int ounces)
          Responds to a swap request from another broker.
 

Method Detail

getAmountOnHand

public void getAmountOnHand(int[] result)
Reports on the total amount of resources held by this Broker.

Parameters:
result - a vector of amounts, one for each metal, allocated by the caller and filled in by this Broker.

get

public void get(int[] order)
A request from a consumer. The caller is blocked until the request can be completely filled.

Parameters:
order - the number of ounces needed of each metal.

swap

public void swap(int what,
                 int ounces)
Responds to a swap request from another broker. Delay the caller until this Broker can complete the swap.

Parameters:
what - the metal the other broker wants to swap.
ounces - the number of ounces to swap.

deliver

public void deliver(int ounces)
Accepts more metal from the refiner.

Parameters:
ounces - the number of ounces of this Broker's "special" metal being delivered.