| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.market.GenericDoubleAuctioneer
public class GenericDoubleAuctioneer
 A generic implementation of Auctioneer framework.
 
Parameters
| base.shoutengine class, inheriting ShoutEngine | 
 (the engine matching shouts) | 
| base.quoting class, implementing QuotingPolicy | 
 (the quoting policy) | 
| base.charging class, inheriting ChargingPolicy | 
 (the charging policy) | 
| base.clearing class, inheriting MarketClearingCondition | 
 (the clearing condition) | 
| base.accepting class, inheriting ShoutAcceptingPolicy | 
 (the shout accepting policy) | 
| base.pricing class, inheriting PricingPolicy | 
 (the pricing policy) | 
Default Base
| generic_double_auctioneer | 
| Field Summary | |
|---|---|
protected  ShoutAcceptingPolicy | 
acceptingPolicy
 | 
protected  ChargingPolicy | 
chargingPolicy
 | 
protected  MarketClearingCondition | 
clearingCondition
 | 
protected  MarketQuote | 
currentQuote
The current quote  | 
protected  java.util.Map<java.lang.String,Transaction> | 
executedTransactions
The set of transactions that have been made in the current round.  | 
protected  java.util.Map<java.lang.Class<? extends Helper>,Helper> | 
helpers
helper components that are required and shared by policies to provide additional capabilities.  | 
protected  java.lang.String | 
name
 | 
static java.lang.String | 
P_ACCEPTING
 | 
static java.lang.String | 
P_CHARGING
 | 
static java.lang.String | 
P_CLEARING
 | 
static java.lang.String | 
P_DEF_BASE
 | 
static java.lang.String | 
P_MATCHING
 | 
static java.lang.String | 
P_PRICING
 | 
static java.lang.String | 
P_QUOTING
 | 
static java.lang.String | 
P_SUBSCRIBING
 | 
protected  org.apache.commons.collections15.Buffer<Transaction> | 
pendingTransactions
 | 
protected  PricingPolicy | 
pricingPolicy
 | 
protected  QuotingPolicy | 
quotingPolicy
 | 
protected  MarketRegistry | 
registry
 | 
protected  ShoutEngine | 
shoutEngine
The shout engine for this auction.  | 
protected  java.util.Map<java.lang.String,Shout> | 
shouts
records all the shouts still standing at this auction, which may be in shoutEngine or involved in pendingTransactions.  | 
protected  SubscribingPolicy | 
subscribingPolicy
 | 
| Constructor Summary | |
|---|---|
GenericDoubleAuctioneer()
 | 
|
| Method Summary | ||
|---|---|---|
 java.util.Iterator<Shout> | 
askIterator()
 | 
|
 double | 
askQuote()
 | 
|
 java.util.Iterator<Shout> | 
bidIterator()
 | 
|
 double | 
bidQuote()
 | 
|
 void | 
clear()
Perform the clearing operation for the auction; match buyers with sellers and inform the auction of any deals.  | 
|
protected  void | 
clear(Shout ask,
      Shout bid,
      double price)
 | 
|
 double | 
determineClearingPrice(Shout bid,
                       Shout ask,
                       MarketQuote clearingQuote)
 | 
|
 void | 
eventOccurred(AuctionEvent event)
 | 
|
 ShoutAcceptingPolicy | 
getAcceptingPolicy()
 | 
|
 ChargingPolicy | 
getChargingPolicy()
 | 
|
 MarketClearingCondition | 
getClearingCondition()
 | 
|
 | 
getHelper(java.lang.Class<H> type)
 | 
|
 java.lang.String | 
getName()
 | 
|
 PricingPolicy | 
getPricingPolicy()
 | 
|
 MarketQuote | 
getQuote()
TODO: the quote returned may not be the latest quote for the market.  | 
|
 QuotingPolicy | 
getQuotingPolicy()
 | 
|
 MarketRegistry | 
getRegistry()
 | 
|
 Shout | 
getShout(java.lang.String shoutId)
retrieves the shout with the specified id, which may be still in shoutEngine, or in a pending transaction.  | 
|
 ShoutEngine | 
getShoutEngine()
 | 
|
 SubscribingPolicy | 
getSubscribingPolicy()
 | 
|
 void | 
newShout(Shout shout)
Code for handling a new shout in the auction.  | 
|
 void | 
printState()
Log the current status of the auction.  | 
|
protected  void | 
processDayClosed(DayClosedEvent event)
 | 
|
protected  void | 
processGameOver(GameOverEvent event)
 | 
|
protected  void | 
processShoutPlaced(ShoutPlacedEvent event)
caches all the successfully placed shout in shouts.  | 
|
protected  void | 
processTransactionExecuted(TransactionExecutedEvent event)
 | 
|
protected  void | 
processTransactionRejected(TransactionRejectedEvent event)
 | 
|
 java.lang.Object | 
protoClone()
 | 
|
 void | 
removeShout(Shout shout)
Handle a request to retract a shout.  | 
|
 void | 
reset()
 | 
|
 void | 
setAcceptingPolicy(ShoutAcceptingPolicy acceptingPolicy)
 | 
|
 void | 
setChargingPolicy(ChargingPolicy chargingPolicy)
 | 
|
 void | 
setClearingCondition(MarketClearingCondition clearingCondition)
 | 
|
 | 
setHelper(java.lang.Class<H> type,
          H helper)
register a Helper, which can be retrieved and used by
 AuctioneerPolicy to have additional capabilities that are shared
 with other policies. | 
|
 void | 
setName(java.lang.String name)
 | 
|
 void | 
setPricingPolicy(PricingPolicy pricingPolicy)
 | 
|
 void | 
setQuotingPolicy(QuotingPolicy quotingPolicy)
 | 
|
 void | 
setRegistry(MarketRegistry registry)
 | 
|
 void | 
setShoutEngine(ShoutEngine shoutEngine)
 | 
|
 void | 
setSubscribingPolicy(SubscribingPolicy subscribingPolicy)
 | 
|
 void | 
setup(edu.cuny.config.param.ParameterDatabase parameters,
      edu.cuny.config.param.Parameter base)
 | 
|
 java.lang.String | 
toString()
 | 
|
protected  void | 
updateQuote()
 | 
|
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String P_MATCHING
public static final java.lang.String P_QUOTING
public static final java.lang.String P_PRICING
public static final java.lang.String P_CLEARING
public static final java.lang.String P_ACCEPTING
public static final java.lang.String P_CHARGING
public static final java.lang.String P_SUBSCRIBING
public static final java.lang.String P_DEF_BASE
protected ShoutEngine shoutEngine
protected java.util.Map<java.lang.String,Transaction> executedTransactions
protected org.apache.commons.collections15.Buffer<Transaction> pendingTransactions
protected java.util.Map<java.lang.String,Shout> shouts
protected MarketQuote currentQuote
protected java.lang.String name
protected QuotingPolicy quotingPolicy
protected PricingPolicy pricingPolicy
protected ChargingPolicy chargingPolicy
protected MarketClearingCondition clearingCondition
protected ShoutAcceptingPolicy acceptingPolicy
protected SubscribingPolicy subscribingPolicy
protected MarketRegistry registry
protected java.util.Map<java.lang.Class<? extends Helper>,Helper> helpers
| Constructor Detail | 
|---|
public GenericDoubleAuctioneer()
| Method Detail | 
|---|
public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
setup in interface edu.cuny.config.param.Parameterizablepublic void reset()
reset in interface edu.cuny.obj.Resetablepublic java.lang.Object protoClone()
protoClone in interface edu.cuny.obj.Prototypeablepublic java.lang.String getName()
getName in interface Auctioneerpublic void setName(java.lang.String name)
setName in interface Auctioneername - the name for the auction.public QuotingPolicy getQuotingPolicy()
getQuotingPolicy in interface Auctioneerpublic void setQuotingPolicy(QuotingPolicy quotingPolicy)
public PricingPolicy getPricingPolicy()
getPricingPolicy in interface Auctioneerpublic void setPricingPolicy(PricingPolicy pricingPolicy)
public void setClearingCondition(MarketClearingCondition clearingCondition)
public MarketClearingCondition getClearingCondition()
getClearingCondition in interface Auctioneerpublic void setChargingPolicy(ChargingPolicy chargingPolicy)
public ChargingPolicy getChargingPolicy()
getChargingPolicy in interface Auctioneerpublic void setAcceptingPolicy(ShoutAcceptingPolicy acceptingPolicy)
public ShoutAcceptingPolicy getAcceptingPolicy()
getAcceptingPolicy in interface Auctioneerpublic SubscribingPolicy getSubscribingPolicy()
getSubscribingPolicy in interface Auctioneerpublic void setSubscribingPolicy(SubscribingPolicy subscribingPolicy)
public void setShoutEngine(ShoutEngine shoutEngine)
public ShoutEngine getShoutEngine()
getShoutEngine in interface Auctioneerpublic MarketRegistry getRegistry()
getRegistry in interface Auctioneerpublic void setRegistry(MarketRegistry registry)
public <H extends Helper> H getHelper(java.lang.Class<H> type)
getHelper in interface Auctioneertype - the class of the requested Helper
public <H extends Helper> void setHelper(java.lang.Class<H> type,
                                         H helper)
AuctioneerHelper, which can be retrieved and used by
 AuctioneerPolicy to have additional capabilities that are shared
 with other policies.
setHelper in interface Auctioneertype - the class of the Helperhelper - 
public void newShout(Shout shout)
              throws IllegalShoutException,
                     DuplicateShoutException
newShout in interface Auctioneershout - The new shout to be processed
IllegalShoutException - Thrown if the shout is invalid in some way.
DuplicateShoutExceptionpublic void removeShout(Shout shout)
removeShout in interface Auctioneerpublic Shout getShout(java.lang.String shoutId)
getShout in interface AuctioneershoutId - the id of desired shout.
public void printState()
printState in interface Auctioneerpublic java.util.Iterator<Shout> askIterator()
askIterator in interface Auctioneerpublic java.util.Iterator<Shout> bidIterator()
bidIterator in interface Auctioneerpublic MarketQuote getQuote()
getQuote in interface QuoteProviderprotected void updateQuote()
public double askQuote()
askQuote in interface Auctioneerpublic double bidQuote()
bidQuote in interface Auctioneerpublic void clear()
Auctioneer
clear in interface Auctioneer
protected void clear(Shout ask,
                     Shout bid,
                     double price)
public double determineClearingPrice(Shout bid,
                                     Shout ask,
                                     MarketQuote clearingQuote)
public void eventOccurred(AuctionEvent event)
eventOccurred in interface AuctionEventListenerprotected void processGameOver(GameOverEvent event)
protected void processDayClosed(DayClosedEvent event)
protected void processShoutPlaced(ShoutPlacedEvent event)
event - protected void processTransactionExecuted(TransactionExecutedEvent event)
protected void processTransactionRejected(TransactionRejectedEvent event)
public java.lang.String toString()
toString in class java.lang.Object
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||