private void createGateDueToType(PaintEventArgs e)
        {
            //switch can be replaced by a one line of code using runtime Creation ((gotta GOOGLE it))
            Gate g;
            switch (gateType)
            {
                case "OR":
                    g = new OR();
                    break;
                case "NOT":
                    g = new NOT();
                    break;
                case "AND":
                    g = new AND();
                    break;
                case "NAND":
                    g = new NAND();
                    break;
                case "NOR":
                    g = new NOR();
                    break;
                case "XOR":
                    g = new XOR();
                    break;
                case "XNOR":
                    g = new XNOR();
                    break;

                default:
                    g = null;
                    break;
            }
            g.Draw(e);
        }
示例#2
0
 public override short? calculateMinInputs(short? x , short? y)
 {
     //Node tempOut = new Node();
     short? result = null;
     XOR xor = new XOR(x,y, result);
     NOT not = new NOT(result,result);
     return result;
 }