private void createGateDueToType(object sender, 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;

                default:
                    g = null;
                    break;
            }
            g.Draw(sender, e);
        }
예제 #2
0
 public override void calculate()
 {
     Node tempOut = new Node();
        OR or = new OR(InputNodesList[0], InputNodesList[1], tempOut);
        or.validate();
        NOT not = new NOT(tempOut, Output);
        not.validate();
 }
예제 #3
0
 public override short? calculateMinInputs(short? x , short? y)
 {
     //Node tempOut = new Node();
        short? result = null;
        OR or = new OR(x, y, result);
        NOT not = new NOT(result, result);
        return result;
 }