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
RevLine 
[18158]1using System.Collections.Generic;
[18065]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")]
[18158]9  public sealed class SubFunctionTreeNode : SymbolicExpressionTreeNode {
[18065]10
11    #region Properties
12    public new SubFunctionSymbol Symbol => (SubFunctionSymbol)base.Symbol;
13
[18069]14    [Storable]
[18067]15    public IEnumerable<string> Arguments { get; set; } = Enumerable.Empty<string>();
[18066]16   
[18069]17    [Storable]
[18067]18    public string Name { get; set; }
[18065]19    #endregion
20
21    #region Constructors
22    public SubFunctionTreeNode(SubFunctionSymbol symbol) : base(symbol) { }
23
24    [StorableConstructor]
[18158]25    private SubFunctionTreeNode(StorableConstructorFlag _) : base(_) { }
[18065]26
[18158]27    private SubFunctionTreeNode(SubFunctionTreeNode original, Cloner cloner) : base(original, cloner) {
[18069]28      Arguments = original.Arguments;
29      Name = (string)original.Name.Clone();
30    }
[18065]31    #endregion
32
33    #region Cloning
34    public override IDeepCloneable Clone(Cloner cloner) => new SubFunctionTreeNode(this, cloner);
35    #endregion
[18067]36
37    public override string ToString() {
38      if (string.IsNullOrEmpty(Name))
39        return base.ToString();
[18068]40      return $"{Name}({string.Join(",", Arguments)})";
[18067]41    }
[18065]42  }
43}
Note: See TracBrowser for help on using the repository browser.