VASSAL.command
Class ChangePiece
java.lang.Object
|
+--VASSAL.command.Command
|
+--VASSAL.command.ChangePiece
- Direct Known Subclasses:
- TrackPiece
- 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 |
protected java.lang.String |
newState
|
protected java.lang.String |
oldState
|
|
Constructor Summary |
ChangePiece(java.lang.String id,
java.lang.String newState)
Deprecated. |
ChangePiece(java.lang.String id,
java.lang.String oldState,
java.lang.String newState)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
newState
protected java.lang.String newState
oldState
protected java.lang.String oldState
ChangePiece
public ChangePiece(java.lang.String id,
java.lang.String oldState,
java.lang.String newState)
- Parameters:
id - the id of the GamePiece to changeoldState - the previous state of the piecenewState - the new state of the piece
ChangePiece
public ChangePiece(java.lang.String id,
java.lang.String newState)
- Deprecated.
- When using this constructor, the previous state will be set
to that of the piece when this Command is executed.
executeCommand
protected void executeCommand()
- Changes the state of a
GamePiece by invoking GamePiece.setState(java.lang.String)
- Overrides:
executeCommand in class Command
append
public Command append(Command c)
- Description copied from class:
Command
- Append a subcommand to this Command.
- Overrides:
append in class Command
myUndoCommand
protected 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 undo
Command.executeCommand(), not the actions of subcommands
- Overrides:
myUndoCommand in class Command
getId
public java.lang.String getId()
getNewState
public java.lang.String getNewState()
getOldState
public java.lang.String getOldState()
isNull
public boolean isNull()
- Overrides:
isNull in class Command
- Following copied from class:
VASSAL.command.Command
- Returns:
- true if this command does nothing