Rev | Line | |
---|
[18158] | 1 | using System.Collections.Generic;
|
---|
[18065] | 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")]
|
---|
[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.