Interface CommandEncoder

All Known Implementing Classes:
BasicCommandEncoder, BasicLogger, BasicModule, BoardPicker, BshCommandEncoder, ChangePropertyCommandEncoder, Chatter, ChessClock, ChessClockControl, EventLog, ExtensionsLoader, Flare, GameModule, GameRefresher, GameState, GlobalProperty, InternetDiceButton, InviteEncoder, LOS_Thread, NewGameIndicator, NotesWindow, ObscurableOptions, PlayerRoster, PluginsLoader, PrivateChatEncoder, PrivateChatter, PrivateNotesController, SecretNotesController, SoundEncoder, SpecialDiceButton, SynchEncoder, TextClient.Encoder, TurnTracker, ZoneProperty

public interface CommandEncoder
Translates a Command to and from a string. A Command represents an action that needs to be transmitted from one client to another -- any action that could change the game state in a multiplayer game needs to be encapsulated into a Command so that other players' clients will reflect it. The CommandEncoders serialise (encode(VASSAL.command.Command)) and deserialise (decode(java.lang.String)) those Java classes to and from an ascii based representation. Commands are encoded by the generated client prior to being sent across network or saved in a log or save file. Commands are decoded by the receiving client on receipt from the network or on reading from a log or save file. Save game creation is a special case where every GameComponent is asked to generate a Command that when executed will cause itself to be recreated. The Command.execute() method implements the execution of the command and is called by the receiving client after building the Command using decode. The execute() method is sometimes called on the generating client but does not need to be if the Command is being created to encapsulate something that has already happened on the generating client. Although Commands can be linked into compound commands, each CommandEncoder need only handle single (not compound) commands.