Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SubFunctionTreeNode.cs

Last change on this file was 18220, checked in by gkronber, 3 years ago

#3136: reintegrated structure-template GP branch into trunk

File size: 1.4 KB
Line 
1using System.Collections.Generic;
2using System.Linq;
3using HEAL.Attic;
4using HeuristicLab.Common;
5using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
6
7namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
8  [StorableType("05130B5F-0125-4367-A4E9-C42D1085024E")]
9  public sealed class SubFunctionTreeNode : SymbolicExpressionTreeNode {
10
11    #region Properties
12    public new SubFunctionSymbol Symbol => (SubFunctionSymbol)base.Symbol;
13
14    [Storable]
15    public IEnumerable<string> Arguments { get; set; } = Enumerable.Empty<string>();
16   
17    [Storable]
18    public string Name { get; set; }
19    #endregion
20
21    #region Constructors
22    public SubFunctionTreeNode(SubFunctionSymbol symbol) : base(symbol) { }
23
24    [StorableConstructor]
25    private SubFunctionTreeNode(StorableConstructorFlag _) : base(_) { }
26
27    private SubFunctionTreeNode(SubFunctionTreeNode original, Cloner cloner) : base(original, cloner) {
28      Arguments = original.Arguments;
29      Name = (string)original.Name.Clone();
30    }
31    #endregion
32
33    #region Cloning
34    public override IDeepCloneable Clone(Cloner cloner) => new SubFunctionTreeNode(this, cloner);
35    #endregion
36
37    public override string ToString() {
38      if (string.IsNullOrEmpty(Name))
39        return base.ToString();
40      return $"{Name}({string.Join(",", Arguments)})";
41    }
42  }
43}
Note: See TracBrowser for help on using the repository browser.