Changeset 6409 for branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols
- Timestamp:
- 06/14/11 10:57:27 (13 years ago)
- Location:
- branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols/GroupSymbol.cs
r6387 r6409 27 27 28 28 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 29 [StorableClass] 29 30 public sealed class GroupSymbol : Symbol { 30 31 private const int minimumArity = 0; … … 45 46 public IEnumerable<ISymbol> Symbols { 46 47 get { return symbols; } 48 private set { symbols = new ObservableSet<ISymbol>(value); } 47 49 } 48 50 … … 75 77 } 76 78 77 public IEnumerable<ISymbol> Flatten() {78 return symbols.Union(symbols.OfType<GroupSymbol>().SelectMany(g => g.Flatten()));79 public override IEnumerable<ISymbol> Flatten() { 80 return base.Flatten().Union(symbols.SelectMany(s => s.Flatten())); 79 81 } 80 82 } -
branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols/Symbol.cs
r6387 r6409 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 96 97 [StorableHook(HookType.AfterDeserialization)] 97 98 private void AfterDeserialization() { 98 if (initialFrequency.IsAlmost(0.0)) enabled = false; 99 // BackwardsCompatibility3.3 100 #region Backwards compatible code, remove with 3.4 101 if (initialFrequency.IsAlmost(0.0) && !(this is GroupSymbol)) enabled = false; 102 #endregion 103 99 104 } 100 105 101 106 public virtual ISymbolicExpressionTreeNode CreateTreeNode() { 102 107 return new SymbolicExpressionTreeNode(this); 108 } 109 110 public virtual IEnumerable<ISymbol> Flatten() { 111 return new List<ISymbol>() { this }; 103 112 } 104 113
Note: See TracChangeset
for help on using the changeset viewer.