net.sourceforge.jasa.agent
Class Inventory

java.lang.Object
  extended by net.sourceforge.jasa.agent.Inventory
All Implemented Interfaces:
java.io.Serializable

public class Inventory
extends java.lang.Object
implements java.io.Serializable

Class to track inventories of agents. The inventory will typically specify the number of shares currently held by the specified agent.

See Also:
Serialized Form
 

Field Summary
protected  TradingAgent owner
          The agent whose inventory we are tracking.
protected  int quantity
          The number of shares held by the agent.
 
Constructor Summary
Inventory()
           
Inventory(int quantity)
           
 
Method Summary
 void add(int quantity)
           
 TradingAgent getOwner()
           
 int getQuantity()
           
 void remove(int quantity)
           
 void setOwner(TradingAgent owner)
           
 void setQuantity(int quantity)
           
 java.lang.String toString()
           
 void transfer(Inventory other, int quantity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

quantity

protected int quantity
The number of shares held by the agent.


owner

protected TradingAgent owner
The agent whose inventory we are tracking.

Constructor Detail

Inventory

public Inventory()

Inventory

public Inventory(int quantity)
Method Detail

add

public void add(int quantity)

remove

public void remove(int quantity)

transfer

public void transfer(Inventory other,
                     int quantity)

getOwner

public TradingAgent getOwner()

setOwner

public void setOwner(TradingAgent owner)

getQuantity

public int getQuantity()

setQuantity

public void setQuantity(int quantity)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object