Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3133_ProblemModifiers/HeuristicLab.Problems.Modifiers/Hive/ProjectResourcesValue.cs @ 18029

Last change on this file since 18029 was 18029, checked in by bwerth, 3 years ago

#3133 added implementation of problem modifiers

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using HEAL.Attic;
5using HeuristicLab.Common;
6using HeuristicLab.Core;
7
8namespace HeuristicLab.Problems.Modifiers {
9  [Item("ProjectResourcesValue", "Represents a project and selected project resources.")]
10  [StorableType("897D2065-5C7D-448B-B9DB-4D612BF1844E")]
11  public class ProjectResourcesValue : Item {
12    [Storable]
13    private Guid projectId;
14    public Guid ProjectId {
15      get => projectId;
16      set {
17        if (projectId == value) return;
18        projectId = value;
19        OnToStringChanged();
20      }
21    }
22
23    [Storable]
24    private List<Guid> resourceIds;
25    public List<Guid> ResourceIds {
26      get => resourceIds;
27      set {
28        if (resourceIds == value) return;
29        resourceIds = value;
30        OnToStringChanged();
31      }
32    }
33
34    [StorableConstructor]
35    protected ProjectResourcesValue(StorableConstructorFlag _) : base(_) { }
36    protected ProjectResourcesValue(ProjectResourcesValue original, Cloner cloner) : base(original, cloner) {
37      ProjectId = original.ProjectId;
38      ResourceIds = original.ResourceIds.Select(x => x).ToList();
39    }
40    public ProjectResourcesValue() {
41      ProjectId = Guid.Empty;
42      ResourceIds = new List<Guid>();
43    }
44
45    public override IDeepCloneable Clone(Cloner cloner) {
46      return new ProjectResourcesValue(this, cloner);
47    }
48
49    public override string ToString() {
50      return $"ProjectId: {ProjectId}, NrOfResources: {ResourceIds.Count}";
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.