|
|
|
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<IAnalogSignal> signals { get; private set; }
|
|
|
|
|
|
|
|
private MultiSignal()
|
|
|
|
{
|
|
|
|
signals = new ObservableCollection<IAnalogSignal>();
|
|
|
|
}
|
|
|
|
|
|
|
|
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<Parameter> IAnalogSignal.paramsCollection { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
|
|
|
double IAnalogSignal.currentAmplitude(double t)
|
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|