Package

Source Code of CPUEmulatorMain

/********************************************************************************
* The contents of this file are subject to the GNU General Public License      *
* (GPL) Version 2 or later (the "License"); you may not use this file except   *
* in compliance with the License. You may obtain a copy of the License at      *
* http://www.gnu.org/copyleft/gpl.html                                         *
*                                                                              *
* Software distributed under the License is distributed on an "AS IS" basis,   *
* without warranty of any kind, either expressed or implied. See the License   *
* for the specific language governing rights and limitations under the         *
* License.                                                                     *
*                                                                              *
* This file was originally developed as part of the software suite that        *
* supports the book "The Elements of Computing Systems" by Nisan and Schocken, *
* MIT Press 2005. If you modify the contents of this file, please document and *
* mark your changes clearly, for the benefit of others.                        *
********************************************************************************/

import Hack.CPUEmulator.CPUEmulator;
import Hack.CPUEmulator.CPUEmulatorApplication;
import Hack.CPUEmulator.CPUEmulatorGUI;
import Hack.Controller.ControllerGUI;
import Hack.Controller.HackController;
import HackGUI.ControllerComponent;
import SimulatorsGUI.CPUEmulatorComponent;
import javax.swing.UIManager;

/**
* The CPU Emulator.
*/
public class CPUEmulatorMain
{
  /**
   * The command line CPU Emulator program.
   */
    private static final String DEFAULT_CPU_RESOURCE = "resources/defaultCPU.txt";
    private static final String CPU_USAGE_RESOURCE = "resources/cpuUsage.html";
    private static final String CPU_ABOUT_RESOURCE = "resources/cpuAbout.html";
   
  public static void main(String[] args) {
        if (args.length > 1)
            System.err.println("Usage: java CPUEmulatorMain [script name]");
        else if (args.length == 0) {
            try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (Exception e) {
            }

            CPUEmulatorGUI simulatorGUI = new CPUEmulatorComponent();

            ControllerGUI controllerGUI = new ControllerComponent();
            CPUEmulatorApplication application =
                new CPUEmulatorApplication(controllerGUI, simulatorGUI,
                    CPUEmulatorMain.class.getResource(DEFAULT_CPU_RESOURCE),
                    CPUEmulatorMain.class.getResource(CPU_USAGE_RESOURCE),
                    CPUEmulatorMain.class.getResource(CPU_ABOUT_RESOURCE));
        }
        else
            new HackController(new CPUEmulator(), args[0]);
    }
}
TOP

Related Classes of CPUEmulatorMain

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.