Package sw_digitalworks.Model

Examples of sw_digitalworks.Model.AndGate


        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();
View Full Code Here


        String regularExp = "\\d{1,4}";
        CharSequence charSeq = param1;

        if (param1.equals("")){
            inputCount = 2;
            AndGate ag = new AndGate(inputCount);
            Main.controller.getDisplayView().addComponentView(new AndGateView(0, 0, ag));
            System.out.println(ag.getName() + " CREATED with " + inputCount + " inports.");
            output += ag.getName() + " CREATED with " + inputCount + " inports.\n";
        } else if ((param2.equals(""))) {
            if (Pattern.matches(regularExp, param1)){
                inputCount = Integer.parseInt(param1);
                AndGate ag = new AndGate(inputCount);
                Main.controller.getDisplayView().addComponentView(new AndGateView(100, 0, ag));
                System.out.println(ag.getName() + " CREATED with " + inputCount + " inports.");
                output += ag.getName() + " CREATED with " + inputCount + " inports.\n";
                //Prototype.PrintStateAfterUpdate(ag);
            } else if (Pattern.matches("\\(\\d{1,4}\\,\\d{1,4}\\)", param1)){
                inputCount = 2;
                AndGate ag = new AndGate(inputCount);
                Main.controller.getDisplayView().addComponentView(new AndGateView(getPosX(param1),getPosY(param1), ag));
                System.out.println(ag.getName() + " CREATED with " + inputCount + " inports.");
                output += ag.getName() + " CREATED with " + inputCount + " inports.\n";
                //Prototype.PrintStateAfterUpdate(ag);
            }
        } else if (Pattern.matches("\\(\\d{1,4}\\,\\d{1,4}\\)", param2)) {
                if (Pattern.matches(regularExp, param1)) {
                    inputCount = Integer.parseInt(param1);
                    if (inputCount >= 2) {
                        AndGate ag = new AndGate(inputCount);
                        //Main.controller.getDisplayView().addComponentView(new AndGateView(100, 100, ag));
                        //AndGateView felülethez adása
                        Main.controller.getDisplayView().addComponentView(new AndGateView(getPosX(param2), getPosY(param2), ag));
                        System.out.println(ag.getName() + " CREATED with " + inputCount + " inports.");
                        output += ag.getName() + " CREATED with " + inputCount + " inports.\n";
                        //Prototype.PrintStateAfterUpdate(ag);
                    } else {
                        output += "A gate needs at least 2 inports\n";
                    }
                }
View Full Code Here

TOP

Related Classes of sw_digitalworks.Model.AndGate

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.