コード例 #1
0
ファイル: Oscillator.cs プロジェクト: jxw00100/LearnComputer
        public Oscillator(Int32 interval = 100)
        {
            _interval      = interval;
            _andGate       = new ANDGate();
            _delayInvertor = new Relay(_interval, true);
            _asyncNexus    = new TShapedNexus(_delayInvertor.Output, _andGate.Input2)
            {
                AsyncDispatch = true
            };

            _andGate.Output.ConnectTo(_delayInvertor.Input);

            Start  = _andGate.Input1;
            Output = _asyncNexus.GetEndpointAt(2);
        }
コード例 #2
0
        public MultiORGate(Int32 inputCount)
        {
            if (inputCount < 2)
            {
                throw  new ArgumentException("Input ports must be 2 or more.");
            }

            _relays = new Relay[inputCount];
            _nexus  = new Nexus(inputCount + 1);
            Inputs  = new IInputEndpoint[inputCount];

            for (var i = 0; i < inputCount; i++)
            {
                _relays[i] = new Relay();
                Inputs[i]  = _relays[i].Input;
                _nexus.ConnectAt(_relays[i].Output, i);
            }
            Output = _nexus.GetEndpointAt(inputCount);
        }
コード例 #3
0
        public MultiANDGate(Int32 inputCount)
        {
            if (inputCount < 2)
            {
                throw new ArgumentException("Input ports must be 2 or more.");
            }

            _relays = new Relay[inputCount];
            Inputs  = new IInputEndpoint[inputCount];

            for (var i = 0; i < inputCount; i++)
            {
                _relays[i] = new Relay();
                Inputs[i]  = _relays[i].Input;
                if (i > 0)
                {
                    _relays[i].InputOfContact.ConnectTo(_relays[i - 1].Output);
                }
            }
            Output = _relays[inputCount - 1].Output;
        }