using System.Collections.Generic; using DelftTools.Shell.Core; using DelftTools.Utils; namespace Wti.Data { /// /// Container for all the data that has been imported and calculated by the user when performing an assessment. /// public class WtiProject : INameable, IObservable { private readonly IList observers = new List(); /// /// Creates a new instance of with a default name set. /// public WtiProject() { Name = "WTI project"; } /// /// Gets or sets the . /// public PipingFailureMechanism PipingFailureMechanism { get; private set; } /// /// The name of the . /// public string Name { get; set; } /// /// Removes the assigned to the . /// public void ClearPipingFailureMechanism() { PipingFailureMechanism = null; } /// /// Creates a new and assign it to the . /// public void InitializePipingFailureMechanism() { PipingFailureMechanism = new PipingFailureMechanism(); } /// /// Determines whether a new can be added to the . /// /// True if a new can be assigned. False otherwise. public bool CanAddPipingFailureMechanism() { return PipingFailureMechanism == null; } #region IObservable 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(); } } #endregion } }