VASSAL.command
Class Command
java.lang.Object
|
+--VASSAL.command.Command
- Direct Known Subclasses:
- AddPiece, AddSecretNoteCommand, BoardPicker.SetBoards, ChangePiece, Chatter.DisplayText, EventLog.StoreEvents, GameState.SetupCommand, ModuleExtension.RegCmd, MovePiece, NewGameIndicator.MarkGameNotNew, NullCommand, ObscurableOptions.SetAllowed, PlayerRoster.Add, RemovePiece, SetPrivateTextCommand, SpecialDiceButton.ShowResults
- public abstract class Command
- extends java.lang.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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Command
public Command()
getSubCommands
public Command[] getSubCommands()
execute
public void execute()
- Execute this command by first invoking
executeCommand(),
then invoking execute() recursively on all subcommands.
executeCommand
protected abstract void executeCommand()
- Perform the action which this Command represents
myUndoCommand
protected abstract Command myUndoCommand()
- If the action can be undone, return a Command that performs the
inverse action. The Command returned should only undo
executeCommand(), 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
protected boolean hasNullSubcommands()
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
append
public Command append(Command c)
- Append a subcommand to this Command.
getUndoCommand
public Command getUndoCommand()
- Returns:
- a Command that undoes not only this Command's action,
but also the actions of all its subcommands.