Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ParameterBinding/HeuristicLab.Analysis/3.3/AlleleFrequency.cs @ 12467

Last change on this file since 12467 was 4722, checked in by swagner, 14 years ago

Merged cloning refactoring branch back into trunk (#922)

File size: 4.5 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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
22using HeuristicLab.Common;
23using HeuristicLab.Core;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
26namespace HeuristicLab.Analysis {
27  /// <summary>
28  /// Represents the frequency of an allele.
29  /// </summary>
30  [Item("AlleleFrequency", "Represents the frequency of an allele.")]
31  [StorableClass]
32  public class AlleleFrequency : Item {
33    private string id;
34    public string Id {
35      get { return id; }
36    }
37    private double frequency;
38    public double Frequency {
39      get { return frequency; }
40    }
41    private double averageImpact;
42    public double AverageImpact {
43      get { return averageImpact; }
44    }
45    private double averageSolutionQuality;
46    public double AverageSolutionQuality {
47      get { return averageSolutionQuality; }
48    }
49    private bool containedInBestKnownSolution;
50    public bool ContainedInBestKnownSolution {
51      get { return containedInBestKnownSolution; }
52    }
53    private bool containedInBestSolution;
54    public bool ContainedInBestSolution {
55      get { return containedInBestSolution; }
56    }
57
58    #region Storable Properties
59    [Storable(Name = "Id")]
60    private string StorableId {
61      get { return id; }
62      set { id = value; }
63    }
64    [Storable(Name = "Frequency")]
65    private double StorableFrequency {
66      get { return frequency; }
67      set { frequency = value; }
68    }
69    [Storable(Name = "AverageImpact")]
70    private double StorableAverageImpact {
71      get { return averageImpact; }
72      set { averageImpact = value; }
73    }
74    [Storable(Name = "AverageSolutionQuality")]
75    private double StorableAverageSolutionQuality {
76      get { return averageSolutionQuality; }
77      set { averageSolutionQuality = value; }
78    }
79    [Storable(Name = "ContainedInBestKnownSolution")]
80    private bool StorableContainedInBestKnownSolution {
81      get { return containedInBestKnownSolution; }
82      set { containedInBestKnownSolution = value; }
83    }
84    [Storable(Name = "ContainedInBestSolution")]
85    private bool StorableContainedInBestSolution {
86      get { return containedInBestSolution; }
87      set { containedInBestSolution = value; }
88    }
89    #endregion
90
91    #region Storing & Cloning
92    [StorableConstructor]
93    protected AlleleFrequency(bool deserializing) : base(deserializing) { }
94    protected AlleleFrequency(AlleleFrequency original, Cloner cloner)
95      : base(original, cloner) {
96      this.id = original.id;
97      this.frequency = original.frequency;
98      this.averageImpact = original.averageImpact;
99      this.averageSolutionQuality = original.averageSolutionQuality;
100      this.containedInBestKnownSolution = original.containedInBestKnownSolution;
101      this.containedInBestSolution = original.containedInBestSolution;
102    }
103    public override IDeepCloneable Clone(Cloner cloner) {
104      return new AlleleFrequency(this, cloner);
105    }
106    #endregion
107    public AlleleFrequency()
108      : base() {
109      id = string.Empty;
110      frequency = 0;
111      averageImpact = 0;
112      averageSolutionQuality = 0;
113      containedInBestKnownSolution = false;
114      containedInBestSolution = false;
115    }
116    public AlleleFrequency(string id, double frequency, double averageImpact, double averageSolutionQuality, bool containedInBestKnownSolution, bool containedInBestSolution)
117      : base() {
118      this.id = id;
119      this.frequency = frequency;
120      this.averageImpact = averageImpact;
121      this.averageSolutionQuality = averageSolutionQuality;
122      this.containedInBestKnownSolution = containedInBestKnownSolution;
123      this.containedInBestSolution = containedInBestSolution;
124    }
125
126    public override string ToString() {
127      return id;
128    }
129  }
130}
Note: See TracBrowser for help on using the repository browser.