using System.Collections.Generic; using System.Linq; using DelftTools.Shell.Core; namespace Wti.Data { /// /// Model for performing piping calculations. /// public class PipingFailureMechanism : IObservable { private readonly IList observers = new List(); /// /// Initializes a new instance of the class. /// public PipingFailureMechanism() { SurfaceLines = Enumerable.Empty(); PipingData = new PipingData(); } /// /// Gets the available surface lines within the scope of the piping failure mechanism. /// public IEnumerable SurfaceLines { get; private set; } /// /// Gets the input data which contains input and output of a piping calculation /// public PipingData PipingData { get; set; } public void Attach(IObserver observer) { observers.Add(observer); } public void Detach(IObserver observer) { observers.Remove(observer); } public void NotifyObservers() { foreach (var observer in observers) { observer.UpdateObserver(); } } } }