Changeset 6377 for branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols
- Timestamp:
- 06/07/11 12:49:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols/GroupSymbol.cs
r6337 r6377 22 22 using System.Collections.Generic; 23 23 using System.Linq; 24 using HeuristicLab.Collections; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 27 28 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 28 public sealed class GroupSymbol : Symbol, IReadOnlySymbol { 29 internal List<ISymbol> symbols; 30 29 public sealed class GroupSymbol : Symbol { 30 private ObservableSet<ISymbol> symbols; 31 public IObservableSet<ISymbol> SymbolsCollection { 32 get { return symbols; } 33 } 31 34 [Storable] 32 35 public IEnumerable<ISymbol> Symbols { … … 39 42 if (value != Enabled) { 40 43 base.Enabled = value; 41 symbols.ForEach(s => s.Enabled = value); 44 foreach (ISymbol symbol in symbols) 45 symbol.Enabled = value; 42 46 } 43 47 } … … 48 52 private GroupSymbol(GroupSymbol original, Cloner cloner) 49 53 : base(original, cloner) { 50 symbols = original.Symbols.Select(s => cloner.Clone(s)).ToList();54 symbols = new ObservableSet<ISymbol>(original.Symbols.Select(s => cloner.Clone(s))); 51 55 } 52 56 public override IDeepCloneable Clone(Cloner cloner) { … … 54 58 } 55 59 60 public GroupSymbol() : this("Group Symbol", Enumerable.Empty<ISymbol>()) { } 56 61 public GroupSymbol(string name, IEnumerable<ISymbol> symbols) 57 62 : base(name, "A symbol which groups other symbols") { 58 this.symbols = new List<ISymbol>(symbols);63 this.symbols = new ObservableSet<ISymbol>(symbols); 59 64 InitialFrequency = 0.0; 60 65 }
Note: See TracChangeset
for help on using the changeset viewer.