You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

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; 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();
}
}
}