edu.cuny.cat
Class MarketClient

java.lang.Object
  extended by edu.cuny.cat.GameClient
      extended by edu.cuny.cat.MarketClient
All Implemented Interfaces:
ConnectionListener<CatpMessage>, AuctionEventListener, edu.cuny.config.param.Parameterizable, edu.cuny.event.RichEventListener, java.lang.Runnable, java.util.EventListener, java.util.Observer

public class MarketClient
extends GameClient
implements edu.cuny.event.RichEventListener

Main class of a market (specialist) client, used to launch a single such client. To start a jcat competition simulation with game server and multiple clients, the Game class should be used and in this case, MarketClient is involved but not as a main class.

Parameters

base.auctioneer
class, inherits Auctioneer
the auctioneer regulating the market

Default Base

market_client

Version:
$Revision: 1.86 $
Author:
Jinzhong Niu

Nested Class Summary
protected  class MarketClient.AskSession
           
protected  class MarketClient.BidSession
           
protected  class MarketClient.DayOpenedSession
           
protected  class MarketClient.DayOpeningSession
           
protected  class MarketClient.RegisterSession
           
protected  class MarketClient.ShoutSession
           
protected  class MarketClient.SubscribeFromClientSession
          TODO: currently always return OK, may reject in the future
protected  class MarketClient.TransactionProactiveSession
           
 
Nested classes/interfaces inherited from class edu.cuny.cat.GameClient
GameClient.CheckInSession, GameClient.DayClosedSession, GameClient.GameOverSession, GameClient.GameStartedSession, GameClient.GameStartingSession, GameClient.OracleSession, GameClient.PostAskSession, GameClient.PostBidSession, GameClient.PostClientListSession, GameClient.PostFeeSession, GameClient.PostProfitSession, GameClient.PostSession, GameClient.PostShoutSession, GameClient.PostSpecialistSession, GameClient.PostTraderSession, GameClient.PostTransactionSession, GameClient.RoundClosedSession, GameClient.RoundClosingSession, GameClient.RoundOpenedSession, GameClient.SubscribeToSpecialistSession, GameClient.SyncSession
 
Field Summary
protected  Auctioneer auctioneer
           
protected  boolean isPlayTime
           
static java.lang.String P_AUCTIONEER
           
static java.lang.String P_DEF_BASE
           
protected  Specialist specialist
          this client as Specialist
 
Fields inherited from class edu.cuny.cat.GameClient
clientConnector, clientId, connection, connTrialMax, dispatcher, eventEngine, eventListeners, infrast, logging, P_CONNECTION_TRIAL_MAX, P_ID, P_LOGGING, P_REPORT, P_TYPE, prng, proactiveSessions, reactiveSessions, registry, report, tag, type
 
Constructor Summary
MarketClient()
           
 
Method Summary
 ClientRegistry createRegistry()
           
 void eventOccurred(AuctionEvent event)
           
 void eventOccurred(edu.cuny.event.RichEvent event)
          The RichEvent-based dispatching mechanism is used for requesting a transaction and subscription for infomration from specialists.
 Auctioneer getAuctioneer()
           
protected  CatpReactiveSession getDayOpenedSessionInstance()
           
protected  CatpReactiveSession getDayOpeningSessionInstance()
           
static void main(java.lang.String[] args)
          for starting market clients alone, separating from trader clients and server
protected  void postTransactionReceived(Transaction transaction)
          This method should be implemented by TraderClient and MarketClient respectively to check the validity of the posted transaction.
 void setAuctioneer(Auctioneer auctioneer)
           
 void setup(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base)
           
 
Methods inherited from class edu.cuny.cat.GameClient
addAuctionEventListener, addEventDispatchingTask, addReport, checkAndUpdateMatchedShout, cleanUpDaily, cleanUpGamely, clearPendingProactiveSessions, close, connectToServer, createMatchedShoutSimple, dectedAndRunReactiveSessions, dispatchEvent, getId, getReport, getType, loginfo, messageArrived, printDayInfo, printGameInfo, printRoundInfo, processEventDispatchingTasks, removeAuctionEventListener, reportDynamics, reportDynamics, run, setExpectedReactiveSession, setExpectedReactiveSessions, setId, setReport, setType, showSessions, startProactiveSession, testMarketTimeout, testTimeout, testTraderTimeout, toString, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

auctioneer

protected Auctioneer auctioneer

P_DEF_BASE

public static final java.lang.String P_DEF_BASE
See Also:
Constant Field Values

P_AUCTIONEER

public static final java.lang.String P_AUCTIONEER
See Also:
Constant Field Values

isPlayTime

protected boolean isPlayTime

specialist

protected Specialist specialist
this client as Specialist

Constructor Detail

MarketClient

public MarketClient()
Method Detail

createRegistry

public ClientRegistry createRegistry()
Specified by:
createRegistry in class GameClient

setup

public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
Specified by:
setup in interface edu.cuny.config.param.Parameterizable
Overrides:
setup in class GameClient

getAuctioneer

public Auctioneer getAuctioneer()

setAuctioneer

public void setAuctioneer(Auctioneer auctioneer)

getDayOpeningSessionInstance

protected CatpReactiveSession getDayOpeningSessionInstance()
Specified by:
getDayOpeningSessionInstance in class GameClient

getDayOpenedSessionInstance

protected CatpReactiveSession getDayOpenedSessionInstance()
Specified by:
getDayOpenedSessionInstance in class GameClient

postTransactionReceived

protected void postTransactionReceived(Transaction transaction)
Description copied from class: GameClient
This method should be implemented by TraderClient and MarketClient respectively to check the validity of the posted transaction.

Specified by:
postTransactionReceived in class GameClient
Parameters:
transaction - the posted transaction

main

public static void main(java.lang.String[] args)
for starting market clients alone, separating from trader clients and server

Parameters:
args -

eventOccurred

public void eventOccurred(edu.cuny.event.RichEvent event)
The RichEvent-based dispatching mechanism is used for requesting a transaction and subscription for infomration from specialists.

Specified by:
eventOccurred in interface edu.cuny.event.RichEventListener
Parameters:
event -

eventOccurred

public void eventOccurred(AuctionEvent event)
Specified by:
eventOccurred in interface AuctionEventListener