VASSAL.command
Class MovePiece

java.lang.Object
  |
  +--VASSAL.command.Command
        |
        +--VASSAL.command.MovePiece

public class MovePiece
extends Command

Command that moves a piece to a new location and position within a stack. While this can be accomplished with a ChangePiece command, this command is safer in terms of recovering from changes to the game state that may have occurred since the command was created. For instance, A ChangePiece command that adds a piece to a Stack will cause the piece to disappear if the stack has been deleted. This Command will recover more gracefully.


Constructor Summary
MovePiece(java.lang.String id, java.lang.String newMapId, java.awt.Point newPosition, java.lang.String newUnderneathId, java.lang.String oldMapId, java.awt.Point oldPosition, java.lang.String oldUnderneathId)
           
 
Method Summary
protected  void executeCommand()
          Perform the action which this Command represents
 java.lang.String getId()
           
 java.lang.String getNewMapId()
           
 java.awt.Point getNewPosition()
           
 java.lang.String getNewUnderneathId()
           
 java.lang.String getOldMapId()
           
 java.awt.Point getOldPosition()
           
 java.lang.String getOldUnderneathId()
           
protected  Command myUndoCommand()
          If the action can be undone, return a Command that performs the inverse action.
 
Methods inherited from class VASSAL.command.Command
append, execute, getSubCommands, getUndoCommand, hasNullSubcommands, isLoggable, isNull, stripSubCommands, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MovePiece

public MovePiece(java.lang.String id,
                 java.lang.String newMapId,
                 java.awt.Point newPosition,
                 java.lang.String newUnderneathId,
                 java.lang.String oldMapId,
                 java.awt.Point oldPosition,
                 java.lang.String oldUnderneathId)
Parameters:
id - The id of the piece being moved
newMapId - The id of the map being moved to
newPosition - the new position
newUnderneathId - The id of the piece which will be immediately beneath this piece in any containing Stack. May be null
oldMapId - The id of the map being moved from
oldPosition - the old position
oldUnderneathId - The id of the piece which was immediately beneath this piece in its original containing Stack.
Method Detail

getId

public java.lang.String getId()

getNewMapId

public java.lang.String getNewMapId()

getOldMapId

public java.lang.String getOldMapId()

getNewPosition

public java.awt.Point getNewPosition()

getOldPosition

public java.awt.Point getOldPosition()

getNewUnderneathId

public java.lang.String getNewUnderneathId()

getOldUnderneathId

public java.lang.String getOldUnderneathId()

executeCommand

protected void executeCommand()
Description copied from class: Command
Perform the action which this Command represents
Overrides:
executeCommand 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