Package

Source Code of HardwareSimulatorMain

/**
* ******************************************************************************
* 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.Controller.HackController;
import Hack.HardwareSimulator.HardwareSimulator;
import Hack.HardwareSimulator.HardwareSimulatorApplication;
import Hack.HardwareSimulator.HardwareSimulatorControllerGUI;
import Hack.HardwareSimulator.HardwareSimulatorGUI;
import SimulatorsGUI.HardwareSimulatorComponent;
import SimulatorsGUI.HardwareSimulatorControllerComponent;
import java.net.URISyntaxException;

/**
* The Hardware Simulator.
*/
public class HardwareSimulatorMain {

    /**
     * The command line Hardware Simulator program.
     */
    private static final String DEFAULT_HW = "resources/defaultHW.txt";
    private static final String HW_USAGE = "resources/hwUsage.html";
    private static final String HW_ABOUT = "resources/hwAbout.html";

    private static void CreateAndShowGui() {
        HardwareSimulatorGUI simulatorGUI = new HardwareSimulatorComponent();
        HardwareSimulatorControllerGUI controllerGUI = new HardwareSimulatorControllerComponent();
        HardwareSimulatorApplication application =
                new HardwareSimulatorApplication(controllerGUI, simulatorGUI,
                HardwareSimulatorMain.class.getResource(DEFAULT_HW),
                HardwareSimulatorMain.class.getResource(HW_USAGE),
                HardwareSimulatorMain.class.getResource(HW_ABOUT));
    }

    public static void main(String[] args) throws URISyntaxException {
        if (args.length > 1) {
            System.err.println("Usage: java HardwareSimulatorMain [script name]");
        } else if (args.length == 0) {
          
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    CreateAndShowGui();
                }
            });

        } else {
            HackController hackController = new HackController(new HardwareSimulator(), args[0]);
        }
    }
}
TOP

Related Classes of HardwareSimulatorMain

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.