source: branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/SubFunctionTreeNode.cs @ 18068

Last change on this file since 18068 was 18068, checked in by dpiringe, 10 months ago

#3136

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