• 大小: 7KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: 其他
  • 标签: 命令模式  

资源简介

考虑一个计算器功能,只能实现加法和减法运算。但是,这个计算器支持撤销操作。

资源截图

代码片段和文件信息

package Command;

public class AddCommandImpl implements CommandInterface{
private OperationsInterface operation = null;
private int number;

public AddCommandImpl(OperationsInterface operationint number) {
// TODO Auto-generated constructor stub
this.operation = operation;
this.number = number;
}
@Override
public void Execute() {
// TODO Auto-generated method stub
this.operation.add(number);
}

@Override
public void Undo() {
// TODO Auto-generated method stub
this.operation.sub(number);
}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        301  2017-12-21 15:26  CommandImpl\.classpath

     文件        387  2017-12-21 15:26  CommandImpl\.project

     文件        598  2017-12-21 15:26  CommandImpl\.settings\org.eclipse.jdt.core.prefs

     文件        732  2017-12-21 15:40  CommandImpl\bin\Command\AddCommandImpl.class

     文件       1699  2017-12-21 17:24  CommandImpl\bin\Command\Calculator.class

     文件        160  2017-12-21 15:36  CommandImpl\bin\Command\CommandInterface.class

     文件       1690  2017-12-21 17:26  CommandImpl\bin\Command\CommandTest.class

     文件        706  2017-12-21 15:34  CommandImpl\bin\Command\OperationsImpl.class

     文件        208  2017-12-21 15:32  CommandImpl\bin\Command\OperationsInterface.class

     文件        732  2017-12-21 17:26  CommandImpl\bin\Command\SubCommandImpl.class

     文件        548  2017-12-21 15:40  CommandImpl\src\Command\AddCommandImpl.java

     文件       1024  2017-12-21 17:24  CommandImpl\src\Command\Calculator.java

     文件         95  2017-12-21 15:36  CommandImpl\src\Command\CommandInterface.java

     文件        885  2017-12-21 17:25  CommandImpl\src\Command\CommandTest.java

     文件        544  2017-12-21 15:34  CommandImpl\src\Command\OperationsImpl.java

     文件        162  2017-12-21 15:32  CommandImpl\src\Command\OperationsInterface.java

     文件        547  2017-12-21 17:26  CommandImpl\src\Command\SubCommandImpl.java

     目录          0  2017-12-21 17:29  CommandImpl\bin\Command

     目录          0  2017-12-21 17:29  CommandImpl\src\Command

     目录          0  2017-12-21 17:29  CommandImpl\.settings

     目录          0  2017-12-21 17:29  CommandImpl\bin

     目录          0  2017-12-21 17:29  CommandImpl\src

     目录          0  2017-12-21 17:29  CommandImpl

----------- ---------  ---------- -----  ----

                11018                    23


评论

共有 条评论

相关资源