Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.zazof.jteg
Class Message  view Message download Message.java

java.lang.Object
  extended byorg.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


Field Summary
private  Message $nextMessage
           
 
Constructor Summary
Message()
           
 
Method Summary
 java.lang.String constructMessageString(java.lang.String[] messageParts)
          This method will return a Stringrepresentation of a servermessage that corresponds to the different messageParts given as a parameter.
 Message decodeMessage(java.lang.String messageDescription)
          This method will return a Message that correctly processed the string according the active protocol.
abstract  java.lang.String getMessageName()
          This method returns the name of the message (e.g.
protected  Message getNextMessage()
          This method returns the next message in the messagechain If no message is next in the chain, null is returned
 boolean hasNextMessage()
           
protected  void setNextMessage(Message next)
          Sets the next message in the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

$nextMessage

private Message $nextMessage
Constructor Detail

Message

public Message()
Method Detail

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()