Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/07/11 12:49:03 (13 years ago)
Author:
mkommend
Message:

#1479: Merged trunk changes into branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols/GroupSymbol.cs

    r6337 r6377  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Collections;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2627
    2728namespace 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    }
    3134    [Storable]
    3235    public IEnumerable<ISymbol> Symbols {
     
    3942        if (value != Enabled) {
    4043          base.Enabled = value;
    41           symbols.ForEach(s => s.Enabled = value);
     44          foreach (ISymbol symbol in symbols)
     45            symbol.Enabled = value;
    4246        }
    4347      }
     
    4852    private GroupSymbol(GroupSymbol original, Cloner cloner)
    4953      : 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)));
    5155    }
    5256    public override IDeepCloneable Clone(Cloner cloner) {
     
    5458    }
    5559
     60    public GroupSymbol() : this("Group Symbol", Enumerable.Empty<ISymbol>()) { }
    5661    public GroupSymbol(string name, IEnumerable<ISymbol> symbols)
    5762      : base(name, "A symbol which groups other symbols") {
    58       this.symbols = new List<ISymbol>(symbols);
     63      this.symbols = new ObservableSet<ISymbol>(symbols);
    5964      InitialFrequency = 0.0;
    6065    }
Note: See TracChangeset for help on using the changeset viewer.