edu.cuny.cat.registry
Class SimpleRegistry
java.lang.Object
edu.cuny.cat.registry.SimpleRegistry
- All Implemented Interfaces:
- AuctionEventListener, Registry
public class SimpleRegistry
- extends java.lang.Object
- implements Registry
Implements Registry by logging game information simply into internal
data structures, in contrast to some external permanent storage.
- Version:
- $Revision: 1.72 $
- Author:
- Jinzhong Niu
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
workingTraders
protected java.util.Map<java.lang.String,Trader> workingTraders
workingSpecialists
protected java.util.Map<java.lang.String,Specialist> workingSpecialists
failedTraders
protected java.util.Map<java.lang.String,Trader> failedTraders
failedSpecialists
protected java.util.Map<java.lang.String,Specialist> failedSpecialists
expectedSpecialists
protected java.util.Map<java.lang.String,Specialist> expectedSpecialists
activeSpecialists
protected java.util.Map<java.lang.String,Specialist> activeSpecialists
shouts
protected java.util.Map<java.lang.String,Shout> shouts
transactions
protected java.util.Map<java.lang.String,Transaction> transactions
subscriptions
protected java.util.Map<java.lang.String,java.util.Set<java.lang.String>> subscriptions
controller
protected GameController controller
clock
protected GameClock clock
SimpleRegistry
public SimpleRegistry()
addExpectedSpecialist
public void addExpectedSpecialist(Specialist specialist)
- Specified by:
addExpectedSpecialist in interface Registry
welcomeExpectedSpecialist
protected void welcomeExpectedSpecialist(Specialist specialist)
addFailedClient
protected void addFailedClient(AccountHolder client)
restoreFailedClient
protected void restoreFailedClient(AccountHolder client)
transferFund
protected void transferFund(AccountHolder payer,
AccountHolder payee,
java.lang.String type,
double amount,
int quantity)
- Parameters:
payer - the party to pay money for buying goods or servicepayee - the party to receive money for selling goods or servicetype - the type of the monetary transactionamount - the amount to be paid for one unit of goods or servicequantity - units of goods or times of service
eventOccurred
public void eventOccurred(AuctionEvent event)
- Specified by:
eventOccurred in interface AuctionEventListener
processFundTransfer
protected void processFundTransfer(FundTransferEvent event)
processRoundClosing
protected void processRoundClosing(RoundClosingEvent event)
processRoundClosed
protected void processRoundClosed(RoundClosedEvent event)
processDayClosed
protected void processDayClosed(DayClosedEvent event)
processRoundOpened
protected void processRoundOpened(RoundOpenedEvent event)
processDayOpening
protected void processDayOpening(DayOpeningEvent event)
processDayOpened
protected void processDayOpened(DayOpenedEvent event)
processGameOver
protected void processGameOver(GameOverEvent event)
processGameStarting
protected void processGameStarting(GameStartingEvent event)
processGameStarted
protected void processGameStarted(GameStartedEvent event)
processPrivateValueAssigned
protected void processPrivateValueAssigned(PrivateValueAssignedEvent event)
processSubscription
protected void processSubscription(SubscriptionEvent event)
processTraderCheckIn
protected void processTraderCheckIn(TraderCheckInEvent event)
processSpecialistCheckIn
protected void processSpecialistCheckIn(SpecialistCheckInEvent event)
processShoutPlaced
protected void processShoutPlaced(ShoutPlacedEvent event)
- TODO: shout related event processing changes shout directly, which however
may have negative effects on processing in game reports etc. as Kai pointed
out
processShoutRejected
protected void processShoutRejected(ShoutRejectedEvent event)
processShoutReceived
protected void processShoutReceived(ShoutReceivedEvent event)
processTransactionExecuted
protected void processTransactionExecuted(TransactionExecutedEvent event)
processFeesAnnounced
protected void processFeesAnnounced(FeesAnnouncedEvent event)
processRegistration
protected void processRegistration(RegistrationEvent event)
processSimulationStarted
protected void processSimulationStarted(SimulationStartedEvent event)
processSimulationOver
protected void processSimulationOver(SimulationOverEvent event)
processClientStatusUpdated
protected void processClientStatusUpdated(ClientStateUpdatedEvent event)
getWorkingTraderIds
public java.lang.String[] getWorkingTraderIds()
- Specified by:
getWorkingTraderIds in interface Registry
getWorkingSpecialistIds
public java.lang.String[] getWorkingSpecialistIds()
- Specified by:
getWorkingSpecialistIds in interface Registry
getWorkingSpecialist
public Specialist getWorkingSpecialist(java.lang.String specialistId)
- Specified by:
getWorkingSpecialist in interface Registry
getWorkingTrader
public Trader getWorkingTrader(java.lang.String traderId)
- Specified by:
getWorkingTrader in interface Registry
getWorkingSpecialists
public Specialist[] getWorkingSpecialists()
- Specified by:
getWorkingSpecialists in interface Registry
getActiveSpecialists
public Specialist[] getActiveSpecialists()
- Specified by:
getActiveSpecialists in interface Registry
- Returns:
- a list of specialists that are available for traders to do business
with
getActiveSpecialist
public Specialist getActiveSpecialist(java.lang.String specialistId)
- Specified by:
getActiveSpecialist in interface Registry
getWorkingTraders
public Trader[] getWorkingTraders()
- Specified by:
getWorkingTraders in interface Registry
getFailedClient
public AccountHolder getFailedClient(java.lang.String id)
- Specified by:
getFailedClient in interface Registry
getExpectedSpecialist
public Specialist getExpectedSpecialist(java.lang.String id)
- Specified by:
getExpectedSpecialist in interface Registry
getShout
public Shout getShout(java.lang.String shoutId)
- Specified by:
getShout in interface Registry
getShouts
public Shout[] getShouts()
- Specified by:
getShouts in interface Registry
getTransaction
public Transaction getTransaction(java.lang.String transactionId)
- Specified by:
getTransaction in interface Registry
getTransactions
public Transaction[] getTransactions()
- Specified by:
getTransactions in interface Registry
getBrokerId
public java.lang.String getBrokerId(java.lang.String traderId)
- Specified by:
getBrokerId in interface Registry
containsWorkingSpecialist
public boolean containsWorkingSpecialist(java.lang.String specialistId)
containsWorkingTrader
public boolean containsWorkingTrader(java.lang.String traderId)
getSubscriberIds
public java.lang.String[] getSubscriberIds(java.lang.String specialistId)
- Specified by:
getSubscriberIds in interface Registry
start
public void start()
- Specified by:
start in interface Registry
stop
public void stop()
- Specified by:
stop in interface Registry
getNumOfClients
public int getNumOfClients()
- Specified by:
getNumOfClients in interface Registry
getNumOfSpecialists
public int getNumOfSpecialists()
- Specified by:
getNumOfSpecialists in interface Registry
getNumOfActiveSpecialists
public int getNumOfActiveSpecialists()
- Specified by:
getNumOfActiveSpecialists in interface Registry
getNumOfTraders
public int getNumOfTraders()
- Specified by:
getNumOfTraders in interface Registry
getTrader
public Trader getTrader(java.lang.String traderId)
- Specified by:
getTrader in interface Registry
getTraders
public Trader[] getTraders()
- Specified by:
getTraders in interface Registry
getNumOfWorkingTraders
public int getNumOfWorkingTraders()
- Specified by:
getNumOfWorkingTraders in interface Registry
getNumOfWorkingSpecialists
public int getNumOfWorkingSpecialists()
- Specified by:
getNumOfWorkingSpecialists in interface Registry
getSpecialist
public Specialist getSpecialist(java.lang.String specialistId)
- Specified by:
getSpecialist in interface Registry
getSpecialistIds
public java.lang.String[] getSpecialistIds()
- Specified by:
getSpecialistIds in interface Registry
getSpecialists
public Specialist[] getSpecialists()
- Specified by:
getSpecialists in interface Registry
getTraderIds
public java.lang.String[] getTraderIds()
- Specified by:
getTraderIds in interface Registry
containsSpecialist
public boolean containsSpecialist(java.lang.String specialistId)
- Specified by:
containsSpecialist in interface Registry
containsTrader
public boolean containsTrader(java.lang.String traderId)
- Specified by:
containsTrader in interface Registry
getNumOfWorkingClients
public int getNumOfWorkingClients()
- Specified by:
getNumOfWorkingClients in interface Registry
getClientStatInfo
public java.lang.String getClientStatInfo()
- Specified by:
getClientStatInfo in interface Registry
- Returns:
- a String including numbers of clients dead and alive.
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object