|
|||||||||
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.Parameterizable
public void reset()
reset
in interface edu.cuny.obj.Resetable
public java.lang.Object protoClone()
protoClone
in interface edu.cuny.obj.Prototypeable
public java.lang.String getName()
getName
in interface Auctioneer
public void setName(java.lang.String name)
setName
in interface Auctioneer
name
- the name for the auction.public QuotingPolicy getQuotingPolicy()
getQuotingPolicy
in interface Auctioneer
public void setQuotingPolicy(QuotingPolicy quotingPolicy)
public PricingPolicy getPricingPolicy()
getPricingPolicy
in interface Auctioneer
public void setPricingPolicy(PricingPolicy pricingPolicy)
public void setClearingCondition(MarketClearingCondition clearingCondition)
public MarketClearingCondition getClearingCondition()
getClearingCondition
in interface Auctioneer
public void setChargingPolicy(ChargingPolicy chargingPolicy)
public ChargingPolicy getChargingPolicy()
getChargingPolicy
in interface Auctioneer
public void setAcceptingPolicy(ShoutAcceptingPolicy acceptingPolicy)
public ShoutAcceptingPolicy getAcceptingPolicy()
getAcceptingPolicy
in interface Auctioneer
public SubscribingPolicy getSubscribingPolicy()
getSubscribingPolicy
in interface Auctioneer
public void setSubscribingPolicy(SubscribingPolicy subscribingPolicy)
public void setShoutEngine(ShoutEngine shoutEngine)
public ShoutEngine getShoutEngine()
getShoutEngine
in interface Auctioneer
public MarketRegistry getRegistry()
getRegistry
in interface Auctioneer
public void setRegistry(MarketRegistry registry)
public <H extends Helper> H getHelper(java.lang.Class<H> type)
getHelper
in interface Auctioneer
type
- the class of the requested Helper
public <H extends Helper> void setHelper(java.lang.Class<H> type, H helper)
Auctioneer
Helper
, which can be retrieved and used by
AuctioneerPolicy
to have additional capabilities that are shared
with other policies.
setHelper
in interface Auctioneer
type
- the class of the Helper
helper
- public void newShout(Shout shout) throws IllegalShoutException, DuplicateShoutException
newShout
in interface Auctioneer
shout
- The new shout to be processed
IllegalShoutException
- Thrown if the shout is invalid in some way.
DuplicateShoutException
public void removeShout(Shout shout)
removeShout
in interface Auctioneer
public Shout getShout(java.lang.String shoutId)
getShout
in interface Auctioneer
shoutId
- the id of desired shout.
public void printState()
printState
in interface Auctioneer
public java.util.Iterator<Shout> askIterator()
askIterator
in interface Auctioneer
public java.util.Iterator<Shout> bidIterator()
bidIterator
in interface Auctioneer
public MarketQuote getQuote()
getQuote
in interface QuoteProvider
protected void updateQuote()
public double askQuote()
askQuote
in interface Auctioneer
public double bidQuote()
bidQuote
in interface Auctioneer
public 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 AuctionEventListener
protected 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 |