soc.message
Class SOCMessageMulti
java.lang.Object
soc.message.SOCMessage
soc.message.SOCMessageMulti
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- SOCMessageTemplateMi, SOCMessageTemplateMs
public abstract class SOCMessageMulti
- extends SOCMessage
Message containing multiple parameters, each of which may have sub-fields.
Format: MESSAGETYPE sep param1 sep param2 sep param3 sep ...
Example format of a param: field1 SEP2 field2 SEP2 field3
MessageMultis are treated specially in SOCMessage.toMsg(String)
.
Multiple SOCMessage.sep_char
are allowed, separating each parameter.
This allows use of SOCMessage.sep2_char
within the parameter to
separate its sub-fields.
The required static parseDataStr method is given a List of one or more Strings,
each of which is a parameter:
public static SOCMessageType parseDataStr(List<String> s)
If no parameters were seen, s will be null.
The section you add to SOCMessage.toMsg(String)
will depend on whether
a message with exactly 1 parameter is valid: If so, multiData
will be null;
pass data
to your parseDataStr too.
If your message never needs to handle exactly 1 parameter:
case GAMESWITHOPTIONS:
return SOCGamesWithOptions.parseDataStr(multiData);
If your message might be valid with 1 parameter:
case GAMESWITHOPTIONS:
return SOCGamesWithOptions.parseDataStr(data, multiData);
Note that if, on the sending end of the network connection, you passed a
non-null gamename to the SOCMessageTemplateMs
or SOCMessageTemplateMi
constructor, then on this end within the toMsg code,
multiData[0] is the gamename, and multiData[1] == param[0] from the sending end.
Your parseDataStr will need to separate out the gamename again, so it doesn't
become param[0] at this end.
- Since:
- 1.1.00
- Author:
- Jeremy D Monin <jeremy@nand.net>
- See Also:
SOCMessageTemplateMi
,
SOCMessageTemplateMs
,
Serialized Form
Fields inherited from class soc.message.SOCMessage |
ACCEPTOFFER, ADMINPING, ADMINRESET, AUTHREQUEST, BANKTRADE, BCASTTEXTMSG, BOARDLAYOUT, BOARDLAYOUT2, BOARDSPECIALEDGE, BUILDREQUEST, BUYCARDREQUEST, CANCELBUILDREQUEST, CHANGEFACE, CHANNELS, CHOOSEPLAYER, CHOOSEPLAYERREQUEST, CLEAROFFER, CLEARTRADEMSG, CREATEACCOUNT, DEBUGFREEPLACE, DELETECHANNEL, DELETEGAME, DEVCARDACTION, DEVCARDCOUNT, DICERESULT, DICERESULTRESOURCES, DISCARD, DISCARDREQUEST, DISCOVERYPICK, ENDTURN, FIRSTPLAYER, GAME_NONE, GAMEMEMBERS, GAMEOPTIONGETDEFAULTS, GAMEOPTIONGETINFOS, GAMEOPTIONINFO, GAMES, GAMESERVERTEXT, GAMESTATE, GAMESTATS, GAMESWITHOPTIONS, GAMETEXTMSG, IMAROBOT, INVENTORYITEMACTION, JOIN, JOINAUTH, JOINGAME, JOINGAMEAUTH, LARGESTARMY, LASTSETTLEMENT, LEAVE, LEAVEALL, LEAVEGAME, LEGALEDGES, LOCALIZEDSTRINGS, LONGESTROAD, MAKEOFFER, MEMBERS, messageType, MONOPOLYPICK, MOVEPIECE, MOVEPIECEREQUEST, MOVEROBBER, NEWCHANNEL, NEWGAME, NEWGAMEWITHOPTIONS, NEWGAMEWITHOPTIONSREQUEST, NULLMESSAGE, PICKRESOURCES, PICKRESOURCESREQUEST, PIECEVALUE, PLAYDEVCARDREQUEST, PLAYERELEMENT, PLAYERELEMENTS, PLAYERSTATS, POTENTIALSETTLEMENTS, PUTPIECE, REJECTCONNECTION, REJECTOFFER, REMOVEPIECE, RESETBOARDAUTH, RESETBOARDREJECT, RESETBOARDREQUEST, RESETBOARDVOTE, RESETBOARDVOTEREQUEST, RESOURCECOUNT, REVEALFOGHEX, ROBOTDISMISS, ROBOTJOINGAMEREQUEST, ROLLDICE, ROLLDICEPROMPT, ROLLDICEREQUEST, SCENARIOINFO, sep, sep_char, sep2, sep2_char, SERVERPING, SETPLAYEDDEVCARD, SETSEATLOCK, SETSPECIALITEM, SETTURN, SETUPDONE, SIMPLEACTION, SIMPLEREQUEST, SITDOWN, STARTGAME, STATUSMESSAGE, SVPTEXTMSG, TEXTMSG, TIMINGPING, TURN, UPDATEROBOTPARAMS, VERSION |
Methods inherited from class soc.message.SOCMessage |
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, getMinimumVersion, getType, isSingleLineAndSafe, isSingleLineAndSafe, toCmd, toMsg, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
SOCMessageMulti
public SOCMessageMulti()