|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectaigames.soccer.application.MessageSender
This is a helper class used to send messages to users. It maintains confirmation mechanism and unique message ids.
| Constructor Summary | |
MessageSender(Server server)
Constructo which sets server that will be used to send messages. |
|
| Method Summary | |
boolean |
areUnconfirmedMessages()
Checks if there are unconfirmed messages. |
void |
checkConfirmationTimeouts()
Checks message confirmation timeouts, and resend messages if needed. |
void |
clearUnconfirmedMessages()
Clears all unconfirmed messages. |
void |
forwardIncoming(org.dom4j.Document message,
UserId userId)
Forwards incoming message to other user. |
int |
getCounter()
Returns message id counter. |
void |
sendAccepted(Message message)
Sends accepted message. |
void |
sendGameOver(java.lang.String winner,
UserId userId)
Sends game over message. |
void |
sendGameParameters(UserId userId,
int width,
int height,
int goal,
int side,
boolean begin)
Sends game parameters to given user. |
void |
sendLogGameOver(java.lang.String winner,
UserId id)
Sends game over message as log message. |
void |
sendLogMove(Move move,
UserId id,
java.util.Date date)
Sends move message as log message. |
void |
sendRefused(Message message,
java.lang.String reason)
Sends refused message to given user. |
void |
sendWithConfirmation(UserId userId,
org.dom4j.Document messageToSend)
Sends message and recods it to await for its confirmation. |
void |
setMessageConfirmation(Message confirmationMessage)
Confirms message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MessageSender(Server server)
server - Server to set.| Method Detail |
public int getCounter()
public void sendGameParameters(UserId userId,
int width,
int height,
int goal,
int side,
boolean begin)
userId - User id.width - Field width.height - Field height.goal - Goal height.side - Attack side.begin - True if user starts the game.
public void sendRefused(Message message,
java.lang.String reason)
message - Message that is refused.reason - Refuesd reason.public void sendAccepted(Message message)
message - Message that is accepted.
public void sendGameOver(java.lang.String winner,
UserId userId)
winner - Name of the winner.userId - User that should receive this message.public void checkConfirmationTimeouts()
public void setMessageConfirmation(Message confirmationMessage)
confirmationMessage - Message confirmation.
public void forwardIncoming(org.dom4j.Document message,
UserId userId)
message - Message that should be forwarded.userId - User that shoud recieve the message.
public void sendWithConfirmation(UserId userId,
org.dom4j.Document messageToSend)
userId - User that shoud recieve the message.messageToSend - Message that should be sent.public boolean areUnconfirmedMessages()
public void clearUnconfirmedMessages()
public void sendLogGameOver(java.lang.String winner,
UserId id)
winner - Winner name.id - User that shoud recieve the message.
public void sendLogMove(Move move,
UserId id,
java.util.Date date)
move - Move to be sent.id - User that shoud recieve the message.date - Date at which move was made.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||