⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcommands.java

📁 程序设计模式java入门源码大全
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -