Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs @ 4193

Last change on this file since 4193 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 3.0 KB
RevLine 
[3253]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
[4068]22using System;
[3376]23using HeuristicLab.Common;
[3269]24using HeuristicLab.Core;
[4068]25using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
[3269]27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
[3373]28namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
[3269]29  [StorableClass]
30  [Item("Constant", "Represents a constant value.")]
[3253]31  public sealed class Constant : Symbol {
[3269]32    #region Propeties
[3485]33    [Storable]
[3294]34    private double minValue;
35    public double MinValue {
36      get { return minValue; }
[3824]37      set {
38        if (value != minValue) {
39          minValue = value;
40          OnChanged(EventArgs.Empty);
41        }
42      }
[3269]43    }
[3485]44    [Storable]
[3294]45    private double maxValue;
46    public double MaxValue {
47      get { return maxValue; }
[3824]48      set {
49        if (value != maxValue) {
50          maxValue = value;
51          OnChanged(EventArgs.Empty);
52        }
53      }
[3269]54    }
[3512]55    [Storable]
56    private double manipulatorNu;
57    public double ManipulatorNu {
58      get { return manipulatorNu; }
[3824]59      set {
60        if (value != manipulatorNu) {
61          manipulatorNu = value;
62          OnChanged(EventArgs.Empty);
63        }
64      }
[3512]65    }
66    [Storable]
67    private double manipulatorSigma;
68    public double ManipulatorSigma {
69      get { return manipulatorSigma; }
70      set {
71        if (value < 0) throw new ArgumentException();
[3824]72        if (value != manipulatorSigma) {
73          manipulatorSigma = value;
74          OnChanged(EventArgs.Empty);
75        }
[3512]76      }
77    }
[3269]78    #endregion
79    public Constant()
[3993]80      : base("Constant", "Represents a constant value.") {
[3512]81      manipulatorNu = 0.0;
82      manipulatorSigma = 1.0;
83      minValue = -20.0;
84      maxValue = 20.0;
[3269]85    }
86
[3253]87    public override SymbolicExpressionTreeNode CreateTreeNode() {
88      return new ConstantTreeNode(this);
89    }
[3485]90
91    public override IDeepCloneable Clone(Cloner cloner) {
[3512]92      Constant clone = (Constant)base.Clone(cloner);
[3485]93      clone.minValue = minValue;
94      clone.maxValue = maxValue;
[3512]95      clone.manipulatorNu = manipulatorNu;
96      clone.manipulatorSigma = manipulatorSigma;
[3485]97      return clone;
98    }
[3253]99  }
100}
Note: See TracBrowser for help on using the repository browser.