// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using System.Linq; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Properties; namespace Ringtoets.Integration.Data { public class RingtoetsProject : Observable, IProject { /// /// Constructs a new . /// public RingtoetsProject() : this(Resources.Project_Constructor_Default_name) {} /// /// Constructs a new . /// /// The name of the . public RingtoetsProject(string name) { Name = name; Description = ""; Items = new List(); } /// /// Gets or sets the items of the . /// public IList Items { get; private set; } /// /// Gets or sets the name of the . /// public string Name { get; set; } /// /// Gets or sets the description of the . /// public string Description { get; set; } /// /// Gets or sets the unique identifier for the storage of the . /// public long StorageId { get; set; } public bool Equals(IProject other) { var otherProject = other as RingtoetsProject; if (otherProject == null) { return false; } return string.Equals(Name, otherProject.Name) && string.Equals(Description, otherProject.Description) && StorageId == otherProject.StorageId && Items.SequenceEqual(otherProject.Items); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != GetType()) { return false; } return Equals((RingtoetsProject) obj); } public override int GetHashCode() { return StorageId.GetHashCode() ^ Name.GetHashCode() ^ Description.GetHashCode(); } } }