edu.cuny.cat.market.core
Class TraderInfo

java.lang.Object
  extended by edu.cuny.cat.core.AccountHolder
      extended by edu.cuny.cat.core.Trader
          extended by edu.cuny.cat.market.core.TraderInfo
All Implemented Interfaces:
edu.cuny.obj.Resetable, java.lang.Cloneable, java.lang.Comparable<AccountHolder>

public class TraderInfo
extends Trader

A class that extends Trader and includes additional information for a specialist to record detailed information about a trader.

Version:
$Revision: 1.88 $
Author:
Jinzhong Niu

Field Summary
static int EXTRA_MARGINAL
           
protected  int goodsTraded
          goods that are traded today
static int INTRA_MARGINAL
           
protected  boolean isTraced
          true if the trader placed a posted shout
protected  int lastDayTraced
           
protected  double lastShoutPrice
           
protected  int marginalStatus
          tells whether this trader is intra-marginal or extra-marginal in the global market
protected  int numOfDaysTraced
           
protected  java.lang.String prevSpecialistId
           
static int UNKNOWN_STATUS
           
 
Fields inherited from class edu.cuny.cat.core.Trader
entitlement, isSeller, privateValue, specialistId
 
Fields inherited from class edu.cuny.cat.core.AccountHolder
account, desc, id
 
Constructor Summary
TraderInfo(java.lang.String id, java.lang.String desc, boolean isSeller)
           
 
Method Summary
 void dayClosed()
           
 void dayOpening()
           
 int getGoodsTraded()
           
 int getLastDayTraced()
           
 double getLastShoutPrice()
           
 int getMarginalStatus()
           
 int getNumOfDaysTraced()
           
 java.lang.String getPrevSpecialistId()
           
 void increaseGoodsTraded(int goodsTraded)
           
 boolean isStationary()
           
 boolean isTraced()
           
 void setMarginalStatus(int marginalStatus)
           
 void shoutPlaced(double price)
           
 void updateEntitlement()
           
 void updateTrace(int day)
           
 
Methods inherited from class edu.cuny.cat.core.Trader
clone, getEntitlement, getPrivateValue, getPrivateValues, getSpecialistId, isSeller, setEntitlement, setIsSeller, setPrivateValue, setSpecialistId
 
Methods inherited from class edu.cuny.cat.core.AccountHolder
compareTo, getAccount, getDescription, getId, reset, setDescription, setId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTRA_MARGINAL

public static final int INTRA_MARGINAL
See Also:
Constant Field Values

EXTRA_MARGINAL

public static final int EXTRA_MARGINAL
See Also:
Constant Field Values

UNKNOWN_STATUS

public static final int UNKNOWN_STATUS
See Also:
Constant Field Values

marginalStatus

protected int marginalStatus
tells whether this trader is intra-marginal or extra-marginal in the global market


goodsTraded

protected int goodsTraded
goods that are traded today


lastShoutPrice

protected double lastShoutPrice

isTraced

protected boolean isTraced
true if the trader placed a posted shout


lastDayTraced

protected int lastDayTraced

numOfDaysTraced

protected int numOfDaysTraced

prevSpecialistId

protected java.lang.String prevSpecialistId
Constructor Detail

TraderInfo

public TraderInfo(java.lang.String id,
                  java.lang.String desc,
                  boolean isSeller)
Method Detail

dayOpening

public void dayOpening()

dayClosed

public void dayClosed()

shoutPlaced

public void shoutPlaced(double price)

getLastShoutPrice

public double getLastShoutPrice()

updateTrace

public void updateTrace(int day)

isTraced

public boolean isTraced()

getNumOfDaysTraced

public int getNumOfDaysTraced()

getLastDayTraced

public int getLastDayTraced()

increaseGoodsTraded

public void increaseGoodsTraded(int goodsTraded)

updateEntitlement

public void updateEntitlement()

getGoodsTraded

public int getGoodsTraded()

isStationary

public boolean isStationary()
Returns:
true if the trader registers with the same specialist consecutively for two days, and false otherwise.

getPrevSpecialistId

public java.lang.String getPrevSpecialistId()
Returns:
the id of the specialist this trader registered with on the previous day

setMarginalStatus

public void setMarginalStatus(int marginalStatus)
Parameters:
marginalStatus - one of the following values: INTRA_MARGINAL, EXTRA_MARGINAL, and UNKNOWN_STATUS

getMarginalStatus

public int getMarginalStatus()
Returns:
INTRA_MARGINAL if this trader is intra-marginal in the global market, EXTRA_MARGINAL if extra-marginal, and UNKNOWN_STATUS if the marginal status is not determined.