player
Class Player

java.lang.Object
  extended by player.Player
Direct Known Subclasses:
EchoPlayer, ZIPlayer

public abstract class Player
extends java.lang.Object

Represents the basic functions of an economic player

Author:
tratch

Constructor Summary
Player(java.lang.String name)
          Constructor
 
Method Summary
 void addToInventory(Commodity comm, double qty)
          Adds a given quantity of a specified commodity to the players inventory
 double browseInventory(Commodity comm)
          Returns the player's value for the specified commodity
 double clearFromInventory(Commodity comm)
          Clears the given commodity from this player's inventory
 void clearInventory()
          Clears the player's entire inventory
 void clearValueFunction()
          Clears the player's entire value function
 java.util.HashMap<Commodity,java.lang.Double> getInventory()
           
 java.lang.String getPlayerName()
           
 double getValue(Commodity comm)
          Given a commodity, the value (cost) of this commodity for this player is returned
abstract  Ask makeAsk(Ask theAsk, Market theMarket)
           
abstract  Bid makeBid(Bid theBid, Market theMarket)
           
 void printInventory()
          Prints to screen the contents of this player's inventory
 void removeFromInventory(Commodity comm, double qty)
          Removes the specified amount of a given commodity from this players inventory.
 void setBudget(java.util.HashMap<Commodity,java.lang.Double> budget)
           
 void setPlayerName(java.lang.String playerName)
          Renames this player under a new name given
 void setValue(Commodity comm, double value)
          Given a commodity, sets the value (cost) of this commodity for this player
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player(java.lang.String name)
Constructor

Parameters:
name -
Method Detail

addToInventory

public void addToInventory(Commodity comm,
                           double qty)
Adds a given quantity of a specified commodity to the players inventory

Parameters:
comm -
qty -

browseInventory

public double browseInventory(Commodity comm)
Returns the player's value for the specified commodity

Parameters:
comm -
Returns:
the value of the commodity for this player

clearInventory

public void clearInventory()
Clears the player's entire inventory


clearValueFunction

public void clearValueFunction()
Clears the player's entire value function


getInventory

public java.util.HashMap<Commodity,java.lang.Double> getInventory()
Returns:
this player's inventory

getPlayerName

public java.lang.String getPlayerName()
Returns:
this player's name

getValue

public double getValue(Commodity comm)
Given a commodity, the value (cost) of this commodity for this player is returned

Parameters:
comm -
Returns:
Returns

makeAsk

public abstract Ask makeAsk(Ask theAsk,
                            Market theMarket)
Parameters:
theAsk -
theMarket -
Returns:
An Ask under the given market conditions

makeBid

public abstract Bid makeBid(Bid theBid,
                            Market theMarket)
Parameters:
theBid -
theMarket -
Returns:
A bid under the given market conditions

clearFromInventory

public double clearFromInventory(Commodity comm)
Clears the given commodity from this player's inventory

Parameters:
comm -

removeFromInventory

public void removeFromInventory(Commodity comm,
                                double qty)
Removes the specified amount of a given commodity from this players inventory.

Parameters:
comm -
qty -

setBudget

public void setBudget(java.util.HashMap<Commodity,java.lang.Double> budget)
Parameters:
budget -

setPlayerName

public void setPlayerName(java.lang.String playerName)
Renames this player under a new name given

Parameters:
playerName -

setValue

public void setValue(Commodity comm,
                     double value)
Given a commodity, sets the value (cost) of this commodity for this player

Parameters:
comm -
value -

printInventory

public void printInventory()
Prints to screen the contents of this player's inventory