Package VASSAL.command
Class ChangePiece
java.lang.Object
VASSAL.command.Command
VASSAL.command.ChangePiece
public class ChangePiece extends Command
This Command changes the state of a
GamePiece
. Its undo
Command is another ChangePiece with the new and old states
reversed.-
Field Summary
-
Constructor Summary
Constructors Constructor Description ChangePiece(String id, String newState)
Deprecated, for removal: This API element is subject to removal in a future version.ChangePiece(String id, String oldState, String newState)
-
Method Summary
Modifier and Type Method Description Command
append(Command c)
Append a subcommand to this Command.protected void
executeCommand()
Changes the state of aGamePiece
by invokingGamePiece.setState(java.lang.String)
String
getDetails()
Detailed information for toString()String
getId()
String
getNewState()
String
getOldState()
boolean
isNull()
protected Command
myUndoCommand()
If the action can be undone, return a Command that performs the inverse action.Methods inherited from class VASSAL.command.Command
execute, getSubCommands, getUndoCommand, hasNullSubcommands, isAtomic, isLoggable, stripSubCommands, toString
-
Field Details
-
newState
-
oldState
-
-
Constructor Details
-
ChangePiece
- Parameters:
id
- the id of theGamePiece
to changeoldState
- the previous state of the piecenewState
- the new state of the piece
-
ChangePiece
Deprecated, for removal: This API element is subject to removal in a future version.When using this constructor, the previous state will be set to that of the piece when this Command is executed.
-
-
Method Details
-
executeCommand
protected void executeCommand()Changes the state of aGamePiece
by invokingGamePiece.setState(java.lang.String)
- Specified by:
executeCommand
in classCommand
-
append
Description copied from class:Command
Append a subcommand to this Command. -
myUndoCommand
Description copied from class:Command
If the action can be undone, return a Command that performs the inverse action. The Command returned should only undoCommand.executeCommand()
, not the actions of subcommands- Specified by:
myUndoCommand
in classCommand
-
getId
-
getNewState
-
getOldState
-
isNull
public boolean isNull() -
getDetails
Description copied from class:Command
Detailed information for toString()- Overrides:
getDetails
in classCommand
-