Пример #1
0
        public override void BindInputSignals(IEnumerable <MathNet.Symbolics.Signal> inputSignals)
        {
            for (int i = 0; i < _inputSignalSet.Count; i++)
            {
                if (_inputSignalSet[i] != null)
                {
                    Service <IMediator> .Instance.NotifySignalDrivesPortNoLonger(_inputSignalSet[i], this, i);

                    _inputSignalSet[i].ValueChanged -= Port_SignalValueChanged;
                    for (int j = 0; j < _outputSignalSet.Count; j++)
                    {
                        ((ISignal_CycleAnalysis)_inputSignalSet[i]).RemoveCycles(_outputSignalSet[j], Config.Random.Next());
                    }
                }
            }

            _inputSignalSet.ReplaceRange(inputSignals);

            for (int i = 0; i < _inputSignalSet.Count; i++)
            {
                OnInputTreeChanged(i);
                if (_inputSignalSet[i] != null)
                {
                    _inputSignalSet[i].ValueChanged += Port_SignalValueChanged;
                    for (int j = 0; j < _outputSignalSet.Count; j++)
                    {
                        ((ISignal_CycleAnalysis)_inputSignalSet[i]).AddCycles(_outputSignalSet[j], Config.Random.Next());
                    }

                    Service <IMediator> .Instance.NotifySignalDrivesPort(_inputSignalSet[i], this, i);
                }
            }

            if (UpdateIsCompletelyConnected() && _currentArchitecture != null && !_currentArchitecture.RebindToPortIfSupported(this))
            {
                LookupAndLinkNewArchitecture();
            }
        }
Пример #2
0
        public void BindInputSignals(IEnumerable <Signal> inputSignals)
        {
            for (int i = 0; i < _inputSignalSet.Count; i++)
            {
                if (_inputSignalSet[i] != null)
                {
                    _context.NotifySignalNoLongerDrivesPort(_inputSignalSet[i], this, i);

                    _inputSignalSet[i].SignalValueChanged -= Port_SignalValueChanged;
                    for (int j = 0; j < _outputSignalSet.Count; j++)
                    {
                        _inputSignalSet[i].RemoveCycles(_outputSignalSet[j], _context.GenerateTag());
                    }
                }
            }

            _inputSignalSet.ReplaceRange(inputSignals);

            for (int i = 0; i < _inputSignalSet.Count; i++)
            {
                if (_inputSignalSet[i] != null)
                {
                    _inputSignalSet[i].SignalValueChanged += Port_SignalValueChanged;
                    for (int j = 0; j < _outputSignalSet.Count; j++)
                    {
                        _inputSignalSet[i].AddCycles(_outputSignalSet[j], _context.GenerateTag());
                    }

                    _context.NotifySignalDrivesPort(_inputSignalSet[i], this, i);
                }
            }

            if (UpdateIsCompletelyConnected() && _currentArchitecture != null && !_currentArchitecture.RebindToPortIfSupported(this))
            {
                LookupAndLinkNewArchitecture();
            }
        }