1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2019 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using HeuristicLab.Common;
|
---|
23 | using HeuristicLab.Core;
|
---|
24 | using HEAL.Attic;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.Analysis {
|
---|
27 | /// <summary>
|
---|
28 | /// Represents an allele of a solution which is used for allele analysis.
|
---|
29 | /// </summary>
|
---|
30 | [Item("Allele", "Represents an allele of a solution which is used for allele analysis.")]
|
---|
31 | [StorableType("27AE2AD2-D4A3-4187-A773-CDA518B8B28A")]
|
---|
32 | public class Allele : Item {
|
---|
33 | private string id;
|
---|
34 | public string Id {
|
---|
35 | get { return id; }
|
---|
36 | }
|
---|
37 | private double impact;
|
---|
38 | public double Impact {
|
---|
39 | get { return impact; }
|
---|
40 | }
|
---|
41 |
|
---|
42 | #region Storable Properties
|
---|
43 | [Storable(Name = "Id")]
|
---|
44 | private string StorableId {
|
---|
45 | get { return id; }
|
---|
46 | set { id = value; }
|
---|
47 | }
|
---|
48 | [Storable(Name = "Impact")]
|
---|
49 | private double StorableImpact {
|
---|
50 | get { return impact; }
|
---|
51 | set { impact = value; }
|
---|
52 | }
|
---|
53 | #endregion
|
---|
54 |
|
---|
55 | #region Storing & Cloning
|
---|
56 | [StorableConstructor]
|
---|
57 | protected Allele(StorableConstructorFlag _) : base(_) { }
|
---|
58 | protected Allele(Allele original, Cloner cloner)
|
---|
59 | : base(original, cloner) {
|
---|
60 | this.id = original.id;
|
---|
61 | this.impact = original.impact;
|
---|
62 | }
|
---|
63 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
64 | return new Allele(this, cloner);
|
---|
65 | }
|
---|
66 | #endregion
|
---|
67 | public Allele()
|
---|
68 | : base() {
|
---|
69 | this.id = string.Empty;
|
---|
70 | this.impact = 0;
|
---|
71 | }
|
---|
72 | public Allele(string id)
|
---|
73 | : base() {
|
---|
74 | this.id = id;
|
---|
75 | this.impact = 0;
|
---|
76 | }
|
---|
77 | public Allele(string id, double impact)
|
---|
78 | : base() {
|
---|
79 | this.id = id;
|
---|
80 | this.impact = impact;
|
---|
81 | }
|
---|
82 |
|
---|
83 | public override string ToString() {
|
---|
84 | return id + " (" + impact + ")";
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|