java.lang.Object
org.zazof.jteg.Message
- Direct Known Subclasses:
- AttaqueMessage, ChatMessage, ClientPlayerMessage, CountryMessage, DiceMessage, ErrorMessage, ExchangeCardMessage, ExitMessage, GameBusyMessage, InformationMessage, LoserMessage, MissionMessage, NewPlayerMessage, PlaceArmiesMessage, PlayerColorMessage, PlayerStatusMessage, ReceiveCardMessage, RegroupAfterAttackMessage, RegroupArmiesMessage, StartMessage, StatusMessage, TurnMessage, WinnerMessage
- public abstract class Message
- extends java.lang.Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
$nextMessage
private Message $nextMessage
Message
public Message()
getMessageName
public abstract java.lang.String getMessageName()
- This method returns the name of the message (e.g. 'attaque' or 'loser', ...).
getNextMessage
protected Message getNextMessage()
- This method returns the next message in the messagechain
If no message is next in the chain, null is returned
decodeMessage
public Message decodeMessage(java.lang.String messageDescription)
throws UnknownMessageException
- This method will return a Message that correctly processed the string
according the active protocol. If no message was found that could
process the inputstring, an exception is thrown.
The default implementation by message just passes the request on to the next message in the chain.
If other behaviour is desired, this method needs to be overridden.
constructMessageString
public java.lang.String constructMessageString(java.lang.String[] messageParts)
throws UnknownMessageException
- This method will return a Stringrepresentation of a servermessage that corresponds to the
different messageParts given as a parameter. If no correct message could be constructed from the
parts, an exception is thrown.
The default implementation by message just passes the request on to the next message in the chain.
If other behaviour is desired, this method needs to be overridden.
setNextMessage
protected void setNextMessage(Message next)
- Sets the next message in the chain.
Only to be called by constructor of a message.
hasNextMessage
public boolean hasNextMessage()