类 MoveShapeCommand

java.lang.Object
com.example.graphics.command.MoveShapeCommand
所有已实现的接口:
Command

public class MoveShapeCommand extends Object implements Command
Command for moving a shape to a new position. This is an implementation of the Command pattern.
  • 字段详细资料

    • shape

      private final Shape shape
    • newX

      private final int newX
    • newY

      private final int newY
    • oldX

      private final int oldX
    • oldY

      private final int oldY
  • 构造器详细资料

    • MoveShapeCommand

      public MoveShapeCommand(Shape shape, int newX, int newY)
      Constructor for the MoveShapeCommand
      参数:
      shape - the shape to move
      newX - the new x coordinate
      newY - the new y coordinate
  • 方法详细资料

    • execute

      public void execute()
      从接口复制的说明: Command
      Execute the command
      指定者:
      execute 在接口中 Command
    • undo

      public void undo()
      从接口复制的说明: Command
      Undo the command
      指定者:
      undo 在接口中 Command