Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 18067 was 18067, checked in by dpiringe, 3 years ago

#3136

  • changed the StructureTemplateView -> nodes of type SubFunctionTreeNode are now clickable
    • still need to overhaul the UI elements
  • added a way to parse SubFunctionTreeNode with a unique name in InfixExpressionParser
File size: 1.4 KB
Line 
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")]
12  public class SubFunctionTreeNode : SymbolicExpressionTreeNode { //TODO: as TerminalNode? -> but has children in a fully builded tree
13
14    #region Properties
15    public new SubFunctionSymbol Symbol => (SubFunctionSymbol)base.Symbol;
16
17    public IEnumerable<string> Arguments { get; set; } = Enumerable.Empty<string>();
18   
19    public SubFunction SubFunction { get; set; }
20
21    public string Name { get; set; }
22    #endregion
23
24    #region Constructors
25    public SubFunctionTreeNode(SubFunctionSymbol symbol) : base(symbol) { }
26
27    [StorableConstructor]
28    protected SubFunctionTreeNode(StorableConstructorFlag _) : base(_) { }
29
30    protected SubFunctionTreeNode(SubFunctionTreeNode original, Cloner cloner) : base(original, cloner) {
31      this.SubFunction = original.SubFunction;
32    }
33    #endregion
34
35    #region Cloning
36    public override IDeepCloneable Clone(Cloner cloner) => new SubFunctionTreeNode(this, cloner);
37    #endregion
38
39    public override string ToString() {
40      if (string.IsNullOrEmpty(Name))
41        return base.ToString();
42      return Name;
43    }
44   
45  }
46}
Note: See TracBrowser for help on using the repository browser.