コード例 #1
0
 public static bool SimplifySummands(SignalSet signals)
 {
     if(signals == null) throw new ArgumentNullException("signals");
     bool altered = false;
     for(int i = signals.Count - 1; i > 0; i--) //don't touch first item!
         if(Std.IsConstantAdditiveIdentity(signals[i]))
         {
             altered = true;
             signals.RemoveAt(i);
         }
     return altered;
 }
コード例 #2
0
ファイル: MathSystem.cs プロジェクト: Shine6Z/GenXSource
        private void InternalRemoveOutput(Signal signal)
        {
            int idx = _outputs.IndexOf(signal);

            _outputs.RemoveAt(idx);
            if (_mediator != null)
            {
                _mediator.OnOutputRemoved(signal, idx);
                for (int i = idx; i < _outputs.Count; i++)
                {
                    _mediator.OnOutputMoved(_outputs[i], idx + 1, idx);
                }
            }
        }
コード例 #3
0
        private void InternalRemoveInput(Signal signal)
        {
            int idx = _inputs.IndexOf(signal);

            _inputs.RemoveAt(idx);
            if (_systemMediator != null)
            {
                _systemMediator.NotifyInputRemoved(signal, idx);
                for (int i = idx; i < _inputs.Count; i++)
                {
                    _systemMediator.NotifyInputMoved(_inputs[i], idx + 1, idx);
                }
            }
        }
コード例 #4
0
        public static bool SimplifySummands(SignalSet signals)
        {
            if (signals == null)
            {
                throw new ArgumentNullException("signals");
            }
            bool altered = false;

            for (int i = signals.Count - 1; i > 0; i--) //don't touch first item!
            {
                if (Std.IsConstantAdditiveIdentity(signals[i]))
                {
                    altered = true;
                    signals.RemoveAt(i);
                }
            }
            return(altered);
        }
コード例 #5
0
ファイル: MathSystem.cs プロジェクト: Shine6Z/GenXSource
        private void InternalRemoveSignal(Signal signal)
        {
            if (_inputs.Contains(signal))
            {
                InternalRemoveInput(signal);
            }
            if (_outputs.Contains(signal))
            {
                InternalRemoveOutput(signal);
            }
            int idx = _allSignals.IndexOf(signal);

            _allSignals.RemoveAt(idx);
            if (_mediator != null)
            {
                _mediator.OnSignalRemoved(signal, idx);
                for (int i = idx; i < _allSignals.Count; i++)
                {
                    _mediator.OnSignalMoved(_allSignals[i], idx + 1, idx);
                }
            }
        }
コード例 #6
0
 public static bool SimplifyFactors(SignalSet signals)
 {
     if(signals == null) throw new ArgumentNullException("signals");
     if(Std.IsConstantAdditiveIdentity(signals[0]))
     {
         signals.Clear();
         signals.Add(signals[0]);
         return true;
     }
     bool altered = false;
     for(int i = signals.Count - 1; i > 0; i--) //don't touch first item!
         if(Std.IsConstantMultiplicativeIdentity(signals[i]))
         {
             altered = true;
             signals.RemoveAt(i);
         }
     return altered;
 }