[18112] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 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 |
|
---|
[18093] | 22 | using HEAL.Attic;
|
---|
| 23 | using HeuristicLab.Common;
|
---|
| 24 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
| 25 |
|
---|
| 26 | namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
|
---|
| 27 | [StorableType("F91000E6-B041-4648-A9E8-595228F957FA")]
|
---|
[18114] | 28 | public sealed class ConstantTreeNode : SymbolicExpressionTreeTerminalNode, INumericTreeNode {
|
---|
[18093] | 29 |
|
---|
[18112] | 30 | public new Constant Symbol => (Constant) base.Symbol;
|
---|
[18093] | 31 |
|
---|
[18143] | 32 | public double Value => Symbol.Value;
|
---|
[18093] | 33 |
|
---|
| 34 | [StorableConstructor]
|
---|
[18112] | 35 | private ConstantTreeNode(StorableConstructorFlag _) : base(_) { }
|
---|
[18093] | 36 |
|
---|
[18112] | 37 | private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
|
---|
[18093] | 38 | : base(original, cloner) {
|
---|
| 39 | }
|
---|
| 40 |
|
---|
[18112] | 41 | private ConstantTreeNode() : base() { }
|
---|
| 42 | public ConstantTreeNode(Constant constantSymbol) : base(constantSymbol) { }
|
---|
[18093] | 43 |
|
---|
| 44 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[18112] | 45 | return new ConstantTreeNode(this, cloner);
|
---|
[18093] | 46 | }
|
---|
| 47 |
|
---|
| 48 | public override string ToString() {
|
---|
| 49 | return $"{Value:E4}";
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 | } |
---|