/// <summary> /// Default constructor /// </summary> /// <param name="signal"></param> /// <param name="unit">The unit of values</param> /// <exception cref="ArgumentNullException"></exception> public TimeDomainSignalViewModel(ITimeDomainSignal signal, string unit) { if (signal == null) { throw new ArgumentNullException(nameof(signal)); } Data = signal.FinalWaveform. Select((value, counter) => new KeyValuePair <double, double>(signal.StartTime + counter * signal.TimeStep, value)); YUnit = unit ?? throw new ArgumentNullException(nameof(unit)); }
/// <summary> /// Copies internal state of <paramref name="obj"/> to this instance /// </summary> /// <param name="obj"></param> /// <exception cref="ArgumentNullException"></exception> public void Copy(ITimeDomainSignal obj) { if (obj == null) { throw new ArgumentNullException(nameof(obj)); } // Clear old waveforms Clear(); // Copy properties StartTime = obj.StartTime; TimeStep = obj.TimeStep; Samples = obj.Samples; // Add new data points to _FinalWaveform for (int i = 0; i < Samples; ++i) { _FinalWaveform.Add(0); } // Copy composing waveforms and constant offsets obj.Waveforms.ForEach((x) => AddWaveformHelper(x.Key, x.Value)); }
/// <summary> /// Copy constructor /// </summary> /// <exception cref="ArgumentNullException"></exception> public TimeDomainSignal(ITimeDomainSignal signal) : this() { Copy(signal ?? throw new ArgumentNullException(nameof(signal))); }
/// <summary> /// Copy constructor /// </summary> /// <exception cref="ArgumentNullException"></exception> public TimeDomainSignalMutable(ITimeDomainSignal signal) : base(signal) { }
/// <summary> /// Default constructor /// </summary> /// <param name="Signal"></param> public TimeDomainSignalInterpreter(ITimeDomainSignal Signal) { _Signal = Signal ?? throw new ArgumentNullException(nameof(Signal)); }