Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Linq;
|
---|
3 | using HEAL.Attic;
|
---|
4 | using HeuristicLab.Common;
|
---|
5 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
6 |
|
---|
7 | namespace 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.