using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Signal_Generator { public class MultiSignal : IAnalogSignal { private static MultiSignal instance; internal ObservableCollection signals { get; set; } private MultiSignal() { signals = new ObservableCollection(); } public static MultiSignal getInstance() { if (instance == null) instance = new MultiSignal(); return instance; } internal void Add(IAnalogSignal signal) { signals.Add(signal); } internal void Remove(IAnalogSignal signal) { signals.Remove(signal); } internal int Count() { return signals.Count(); } public double currentAmplitude(double t) { double summaryAmplitude = 0; foreach (IAnalogSignal item in signals) summaryAmplitude += item.currentAmplitude(t); return summaryAmplitude; } // Неиспользуемые поля и методы public string typeToString => throw new NotImplementedException(); string IAnalogSignal.paramsToString => throw new NotImplementedException(); string IAnalogSignal.typeToString => throw new NotImplementedException(); Collection IAnalogSignal.paramsCollection { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } double IAnalogSignal.currentAmplitude(double t) { throw new NotImplementedException(); } } }