testcommands.java
来自「程序设计模式java入门源码大全」· Java 代码 · 共 41 行
JAVA
41 行
public class TestCommands
{
public static void main(String args[])
{
TestCommands t = new TestCommands();
}
public TestCommands()
{
Invoker invoker = new Invoker();
// Create the receivers
AsiaServer asiaServer = new AsiaServer();
EuroServer euroServer = new EuroServer();
USServer usServer = new USServer();
//Create the commands
ShutDownCommand shutDownAsia = new ShutDownCommand(asiaServer);
RunDiagnosticsCommand runDiagnosticsAsia = new
RunDiagnosticsCommand(asiaServer);
RebootCommand rebootAsia = new RebootCommand(asiaServer);
ShutDownCommand shutDownEuro = new ShutDownCommand(euroServer);
RunDiagnosticsCommand runDiagnosticsEuro = new
RunDiagnosticsCommand(euroServer);
RebootCommand rebootEuro = new RebootCommand(euroServer);
ShutDownCommand shutDownUS = new ShutDownCommand(usServer);
RunDiagnosticsCommand runDiagnosticsUS = new
RunDiagnosticsCommand(usServer);
RebootCommand rebootUS = new RebootCommand(usServer);
invoker.setCommand(shutDownAsia);
invoker.run();
invoker.setCommand(rebootAsia);
invoker.run();
invoker.undo();
invoker.undo();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?