Package VASSAL.command
Class Command
java.lang.Object
VASSAL.command.Command
- Direct Known Subclasses:
AddPiece,AddSecretNoteCommand,AlertCommand,BasicLogger.LogCommand,BoardPicker.SetBoards,ChangePiece,ChangePropertyCommand,Chatter.DisplayText,ConditionalCommand,Deck.LoadDeckCommand,EventLog.StoreEvents,GameState.SetupCommand,GlobalProperty.SetGlobalProperty,InviteCommand,LOS_Thread.LOSCommand,ModuleExtension.RegCmd,MovePiece,NewGameIndicator.MarkGameNotNew,NotesWindow.SetPublicNote,NotesWindow.SetScenarioNote,NullCommand,ObscurableOptions.SetAllowed,PlayAudioClipCommand,PlayerRoster.Add,PrivMsgCommand,RemovePiece,SetPersistentPropertyCommand,SetPrivateTextCommand,SoundEncoder.Cmd,SpecialDiceButton.ShowResults,SynchCommand,TextClient.ShowText,TurnTracker.SetTurn
public abstract class Command extends Object
Command is an abstract class that does something. Any action that takes
place during a game should be encapsulated in a Command object. When
performing actions during a game, corresponding Commands will be logged
in the current logfile and/or sent to other players on the server.
Commands can be strung together into compound commands with the
append(VASSAL.command.Command) method.- See Also:
CommandEncoder
-
Constructor Summary
Constructors Constructor Description Command() -
Method Summary
Modifier and Type Method Description Commandappend(Command c)Append a subcommand to this Command.voidexecute()Execute this command by first invokingexecuteCommand(), then invokingexecute()recursively on all subcommands.protected abstract voidexecuteCommand()Perform the action which this Command representsStringgetDetails()Detailed information for toString()Command[]getSubCommands()CommandgetUndoCommand()protected booleanhasNullSubcommands()Deprecated.UseisAtomic()protected booleanisAtomic()Return true if this command has no sub-commands attached to it (other than null commands).booleanisLoggable()booleanisNull()protected abstract CommandmyUndoCommand()If the action can be undone, return a Command that performs the inverse action.voidstripSubCommands()Remove all subcommands.StringtoString()
-
Constructor Details
-
Command
public Command()
-
-
Method Details
-
getSubCommands
-
execute
public void execute()Execute this command by first invokingexecuteCommand(), then invokingexecute()recursively on all subcommands. -
executeCommand
protected abstract void executeCommand()Perform the action which this Command represents -
myUndoCommand
If the action can be undone, return a Command that performs the inverse action. The Command returned should only undoexecuteCommand(), not the actions of subcommands -
stripSubCommands
public void stripSubCommands()Remove all subcommands. -
isNull
public boolean isNull()- Returns:
- true if this command does nothing
-
isLoggable
public boolean isLoggable()- Returns:
- true if this command should be stored in a logfile
-
hasNullSubcommands
Deprecated.UseisAtomic() -
isAtomic
protected boolean isAtomic()Return true if this command has no sub-commands attached to it (other than null commands).- Returns:
-
toString
-
getDetails
Detailed information for toString() -
append
Append a subcommand to this Command. -
getUndoCommand
- Returns:
- a Command that undoes not only this Command's action, but also the actions of all its subcommands.
-