Package sw_digitalworks.Model

Examples of sw_digitalworks.Model.InteractiveInput


        ComponentModel.leds.add(new LED("LED 1"));
       ComponentModel.leds.add(new LED("LED 2"));
//        inports.add(leds.getByName("LED 1").getInPort());
//        inports.add(leds.getByName("LED 1").getInPort());
//        ComponentModel.add(leds.getByName("LED 2"));
        InteractiveInput ip1 = new InteractiveInput("IP 1");
        InteractiveInput ip2 = new InteractiveInput("IP 2");
//        ComponentModel.add(ip1);
//        ComponentModel.add(ip2);

        Gate cp1 = new AndGate("AND G",2);
        Gate cp2 = new NandGate("NAND G",2);
        //Kapuk összekötése
        cp1.Connect(cp2.getInPorts()[0]);
        cp2.Connect(cp1.getInPorts()[1]);
        //LEDEK bekötése
        cp1.Connect(ComponentModel.leds.getByName("LED 1"));
        cp2.Connect(ComponentModel.leds.getByName("LED 2"));
        //Inputok bekötése
        ip1.Connect(cp1.getInPorts()[0]);
        ip2.Connect(cp2.getInPorts()[1]);
         try {
            //Set the values of InPorts
            ComponentModel.leds.ShowLEDs();
            ip1.On();
            ComponentModel.leds.ShowLEDs();

            ip2.On();
            ComponentModel.leds.ShowLEDs();

//            cp1.Reset();
//            cp2.Reset();


            ip2.Off();
            ComponentModel.leds.ShowLEDs();

            ip1.On();
            ComponentModel.leds.ShowLEDs();

            ip1.Off();
            ComponentModel.leds.ShowLEDs();

            ip2.Off();
           ComponentModel.leds.ShowLEDs();

            ip2.On();
            ComponentModel.leds.ShowLEDs();

        } catch (Exception e) {
            System.out.println(e.getClass());
        } finally {
View Full Code Here


    /**
     * InteractiveInput(kapcsoló) létrehozása az sw parancs hatására ezzel a függvénnyel történik
     */
    public void createInteractiveInput() {
        if (param1.equals("") && param2.equals("")) {
            InteractiveInput ip = new InteractiveInput();
            Main.controller.getDisplayView().addComponentView(new InteractiveInputView(getPosX(param1), getPosY(param1), ip));
            System.out.println(ip.getName() + " CREATED.");
            output += ip.getName() + " CREATED.\n";
            //Prototype.PrintStateAfterUpdate(ip);
        } else if (!(param1.equals(""))) {
            InteractiveInput ip = new InteractiveInput();
            Main.controller.getDisplayView().addComponentView(new InteractiveInputView(getPosX(param1), getPosY(param1), ip));
            System.out.println(ip.getName() + " CREATED.");
            output += ip.getName() + " CREATED.\n";
        } else {
            System.out.println("Bad command for creating switch. Try sw");
            output += "Bad command for creating switch. Try sw\n";
        }
    }
View Full Code Here

TOP

Related Classes of sw_digitalworks.Model.InteractiveInput

Copyright © 2018 www.massapicom. 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.