Package sw_digitalworks.Model

Examples of sw_digitalworks.Model.NandGate


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




        if (param1.equals("")){
                inputCount = 2;
                NandGate ng = new NandGate(inputCount);
                //View hozzáadása a felülethez
                Main.controller.getDisplayView().addComponentView(new NandGateView(0, 0, ng));
                System.out.println(ng.getName() + " CREATED with " + inputCount + " inports.");
                output += ng.getName() + " CREATED with " + inputCount + " inports.\n";
        } else if(!(param1.equals(""))) {
            if ((param2.equals("")) && Pattern.matches(regularExp, charSeq)) {
                inputCount = Integer.parseInt(param1);
                NandGate ng = new NandGate(inputCount);
                //View hozzáadása a felülethez
                Main.controller.getDisplayView().addComponentView(new NandGateView(50, 0, ng));
                System.out.println(ng.getName() + " CREATED with " + inputCount + " inports.");
                output += ng.getName() + " CREATED with " + inputCount + " inports.\n";


            } else if ((param2.equals("")) && Pattern.matches("\\(\\d{1,4}\\,\\d{1,4}\\)", param1)){
                inputCount = 2;
                NandGate ng = new NandGate(inputCount);
                //View hozzáadása a felülethez
                Main.controller.getDisplayView().addComponentView(new NandGateView(getPosX(param1), getPosY(param1), ng));
                System.out.println(ng.getName() + " CREATED with " + inputCount + " inports.");
                output += ng.getName() + " CREATED with " + inputCount + " inports.\n";
            } else if(Pattern.matches(regularExp, param1) && Pattern.matches("\\(\\d{1,4}\\,\\d{1,4}\\)", param2)) {
                inputCount = Integer.parseInt(param1);
                inputCount = Integer.parseInt(param1);
                    NandGate ng = new NandGate(inputCount);
                    Main.controller.getDisplayView().addComponentView(new NandGateView(getPosX(param2), getPosY(param2), ng));
                    System.out.println(ng.getName() + " CREATED with " + inputCount + " inports.");
                    output += ng.getName() + " CREATED with " + inputCount + " inports.\n";


               
            } else {
                output += "A gate needs at least 2 inports\n";
View Full Code Here

TOP

Related Classes of sw_digitalworks.Model.NandGate

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.