edu.cuny.cat.market.matching
Class ShoutEngine

java.lang.Object
  extended by edu.cuny.cat.market.AuctioneerPolicy
      extended by edu.cuny.cat.market.matching.ShoutEngine
All Implemented Interfaces:
AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.obj.Resetable
Direct Known Subclasses:
FourHeapShoutEngine, LazyMaxVolumeShoutEngine

public abstract class ShoutEngine
extends AuctioneerPolicy

a framework of a shout processing unit for a specialist.

Version:
$Revision: 1.13 $
Author:
Steve Phelps

Field Summary
static AscendingShoutComparator AscendingOrder
          comparator for ascending shouts
static DescendingShoutComparator DescendingOrder
          comparator for descending shouts
 
Fields inherited from class edu.cuny.cat.market.AuctioneerPolicy
auctioneer
 
Constructor Summary
ShoutEngine()
           
 
Method Summary
abstract  java.util.Iterator<Shout> ascendingAskIterator()
           
abstract  java.util.Iterator<Shout> askIterator()
           
abstract  java.util.Iterator<Shout> bidIterator()
           
abstract  java.util.Iterator<Shout> descendingBidIterator()
           
abstract  Shout getHighestMatchedAsk()
          Get the highest matched ask.
abstract  Shout getHighestUnmatchedBid()
          Get the highest unmatched bid in the auction.
abstract  Shout getLowestMatchedBid()
          Get the lowest matched bid in the auction.
abstract  Shout getLowestUnmatchedAsk()
          Get the lowest unmatched ask.
abstract  org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedAsks()
           
abstract  org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedBids()
           
 java.util.List<Shout> getMatchedShouts()
          Deprecated. replaced by matchShouts().
abstract  int getMatchedVolume()
           
abstract  int getNumOfMatchedAsks()
           
abstract  int getNumOfMatchedBids()
           
abstract  int getNumOfUnmatchedAsks()
           
abstract  int getNumOfUnmatchedBids()
           
abstract  org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedAsks()
           
abstract  org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedBids()
           
abstract  int getUnmatchedDemand()
           
abstract  int getUnmatchedSupply()
           
abstract  java.util.Iterator<Shout> matchedAskIterator()
           
abstract  java.util.Iterator<Shout> matchedBidIterator()
           
abstract  java.util.List<Shout> matchShouts()
           Destructively fetch the list of matched bids and asks.
abstract  void newShout(Shout shout)
           
abstract  void printState()
          Log the current status of the auction.
abstract  void removeShout(Shout shout)
           
 
Methods inherited from class edu.cuny.cat.market.AuctioneerPolicy
eventOccurred, getAuctioneer, initialize, reset, setAuctioneer, setup, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AscendingOrder

public static AscendingShoutComparator AscendingOrder
comparator for ascending shouts


DescendingOrder

public static DescendingShoutComparator DescendingOrder
comparator for descending shouts

Constructor Detail

ShoutEngine

public ShoutEngine()
Method Detail

newShout

public abstract void newShout(Shout shout)
                       throws DuplicateShoutException
Throws:
DuplicateShoutException

removeShout

public abstract void removeShout(Shout shout)

printState

public abstract void printState()
Log the current status of the auction.


getMatchedShouts

@Deprecated
public java.util.List<Shout> getMatchedShouts()
Deprecated. replaced by matchShouts().


matchShouts

public abstract java.util.List<Shout> matchShouts()

Destructively fetch the list of matched bids and asks. The list is of the form


( b0, a0, b1, a1 .. bn, an )

where bi is the ith bid and a0 is the ith ask. A typical auctioneer would clear by matching bi with ai for all i at some price.

Note that the engine's set of matched shouts will become empty as a result of invoking this method.


getHighestUnmatchedBid

public abstract Shout getHighestUnmatchedBid()
Get the highest unmatched bid in the auction.


getLowestMatchedBid

public abstract Shout getLowestMatchedBid()
Get the lowest matched bid in the auction.


getLowestUnmatchedAsk

public abstract Shout getLowestUnmatchedAsk()
Get the lowest unmatched ask.


getHighestMatchedAsk

public abstract Shout getHighestMatchedAsk()
Get the highest matched ask.


askIterator

public abstract java.util.Iterator<Shout> askIterator()
Returns:
an iterator that non-destructively iterates over every ask in the auction (both matched and unmatched).

ascendingAskIterator

public abstract java.util.Iterator<Shout> ascendingAskIterator()
Returns:
an iterator that non-destructively iterates over every ask in the auction (both matched and unmatched) in ascending order

matchedAskIterator

public abstract java.util.Iterator<Shout> matchedAskIterator()
Returns:
an iterator that non-destructively iterates over every matched ask in the auction in ascending order.

bidIterator

public abstract java.util.Iterator<Shout> bidIterator()
Returns:
an iterator that non-destructively iterates over every bid in the auction (both matched and unmatched).

descendingBidIterator

public abstract java.util.Iterator<Shout> descendingBidIterator()
Returns:
an iterator that non-destructively iterates over every bid in the auction (both matched and unmatched) in descending order.

matchedBidIterator

public abstract java.util.Iterator<Shout> matchedBidIterator()
Returns:
an iterator that non-destructively iterates over every matched bid in the auction in descending order.

getMatchedVolume

public abstract int getMatchedVolume()

getUnmatchedSupply

public abstract int getUnmatchedSupply()

getUnmatchedDemand

public abstract int getUnmatchedDemand()

getNumOfUnmatchedBids

public abstract int getNumOfUnmatchedBids()

getNumOfUnmatchedAsks

public abstract int getNumOfUnmatchedAsks()

getNumOfMatchedBids

public abstract int getNumOfMatchedBids()

getNumOfMatchedAsks

public abstract int getNumOfMatchedAsks()

getMatchedBids

public abstract org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedBids()

getUnmatchedBids

public abstract org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedBids()

getMatchedAsks

public abstract org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getMatchedAsks()

getUnmatchedAsks

public abstract org.apache.commons.collections15.buffer.PriorityBuffer<Shout> getUnmatchedAsks()