Пример #1
0
        public NOT(LogicGate input)
        {
            previous_1 = input;
            previous_2 = null;

            previous_1.StatusChange += OutputChange;

            Output = !previous_1.Output;
        }
Пример #2
0
        public NAND(LogicGate input1, LogicGate input2)
        {
            previous_1 = input1;
            previous_2 = input2;

            previous_1.StatusChange += OutputChange;
            previous_2.StatusChange += OutputChange;

            Output = !(previous_1.Output && previous_2.Output);
        }
Пример #3
0
        public OR(LogicGate input1, LogicGate input2)
        {
            previous_1 = input1;
            previous_2 = input2;

            previous_1.StatusChange += OutputChange;
            previous_2.StatusChange += OutputChange;

            Output = previous_1.Output || previous_2.Output;
        }
Пример #4
0
        public static LogicGate CreateGate(LogicGate input1, LogicGate input2, Type name)
        {
            switch (name)
            {
            case Type.OR:
                return(new OR(input1, input2));

            case Type.NOR:
                return(new NOR(input1, input2));

            case Type.AND:
                return(new AND(input1, input2));

            case Type.NAND:
                return(new NAND(input1, input2));

            default:
                throw new ArgumentException();
            }
        }
Пример #5
0
 public static LogicGate CreateGate(LogicGate input)
 {
     return(new NOT(input));
 }