|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bolinfest.prisonerbot.DefaultManager
public class DefaultManager
DefaultManager
is an implementation of the Manager
interface.
Field Summary | |
---|---|
protected Map |
buddies
Each entry represents a Buddy with which this Manager is maintaining a conversation. |
protected Map |
games
Maps names of players to the games in which they are involved |
protected GameLogger |
logger
|
protected MessageProxy |
proxy
|
protected Set |
waitingToPlay
These are the buddies who are waiting to play a game. |
Constructor Summary | |
---|---|
DefaultManager(MessageProxy proxy)
|
Method Summary | |
---|---|
protected Buddy |
addBuddy(String name)
|
protected static String |
createGameOverMessage(Buddy buddy,
SimpleIterativeGame game)
|
protected static String |
createLastRoundSummary(Buddy buddy,
SimpleIterativeGame game)
|
protected static String |
createRoundMessage(Buddy buddy,
SimpleIterativeGame game)
This should return a message telling the player: what round it is what his score is what his opponent's score is |
protected static String |
createScoreSummary(Buddy buddy,
SimpleIterativeGame game)
|
protected void |
gameOver(SimpleIterativeGame game)
|
int |
getBuddyCount()
|
int |
getBuddyStatus(String buddyName)
|
UnmodifiableGame |
getGame(String buddyName)
Get an unmodifiable view of the game in which the buddy with this name is involved. |
GameLogger |
getLogger()
|
protected void |
goToNextRound(SimpleIterativeGame game)
|
protected void |
handleActivePlayerMessage(Buddy buddy,
String message)
|
void |
handleMessage(String sender,
String message)
|
protected void |
handleNegotiatingRoundsResponse(Buddy buddy,
String message)
|
protected void |
handleWantsToPlayResponse(Buddy buddy,
String message)
|
boolean |
hasBuddy(String buddyName)
|
boolean |
isOpponentAvailable()
|
protected void |
pairUp(Buddy player1,
Buddy player2)
Pair up the two buddies to play a game |
void |
removeAllBuddies()
|
protected void |
removeBuddy(String name)
|
protected void |
sendMessage(Buddy buddy,
String message)
sends the message to the buddy |
void |
setLogger(GameLogger logger)
|
static String |
stripTags(String s)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map buddies
protected Set waitingToPlay
protected Map games
protected MessageProxy proxy
protected GameLogger logger
Constructor Detail |
---|
public DefaultManager(MessageProxy proxy)
Method Detail |
---|
public static String stripTags(String s)
public void handleMessage(String sender, String message)
handleMessage
in interface Manager
sender
- message
- protected void handleWantsToPlayResponse(Buddy buddy, String message)
protected void handleNegotiatingRoundsResponse(Buddy buddy, String message)
protected static String createRoundMessage(Buddy buddy, SimpleIterativeGame game)
protected static String createGameOverMessage(Buddy buddy, SimpleIterativeGame game)
protected static String createScoreSummary(Buddy buddy, SimpleIterativeGame game)
protected static String createLastRoundSummary(Buddy buddy, SimpleIterativeGame game)
protected void pairUp(Buddy player1, Buddy player2)
player1
- player2
- protected void goToNextRound(SimpleIterativeGame game)
protected void handleActivePlayerMessage(Buddy buddy, String message)
protected void gameOver(SimpleIterativeGame game)
protected Buddy addBuddy(String name)
protected void removeBuddy(String name)
protected void sendMessage(Buddy buddy, String message)
public int getBuddyCount()
getBuddyCount
in interface Manager
public boolean hasBuddy(String buddyName)
hasBuddy
in interface Manager
public int getBuddyStatus(String buddyName)
getBuddyStatus
in interface Manager
public boolean isOpponentAvailable()
isOpponentAvailable
in interface Manager
public UnmodifiableGame getGame(String buddyName)
Manager
getGame
in interface Manager
public void removeAllBuddies()
removeAllBuddies
in interface Manager
public GameLogger getLogger()
getLogger
in interface Manager
public void setLogger(GameLogger logger)
setLogger
in interface Manager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |