Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/14/11 10:57:27 (13 years ago)
Author:
mkommend
Message:

#1479: Updated grammar editor and changed related classes.

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  
    2727
    2828namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
     29  [StorableClass]
    2930  public sealed class GroupSymbol : Symbol {
    3031    private const int minimumArity = 0;
     
    4546    public IEnumerable<ISymbol> Symbols {
    4647      get { return symbols; }
     48      private set { symbols = new ObservableSet<ISymbol>(value); }
    4749    }
    4850
     
    7577    }
    7678
    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()));
    7981    }
    8082  }
  • branches/GP.Grammar.Editor/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Symbols/Symbol.cs

    r6387 r6409  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    9697    [StorableHook(HookType.AfterDeserialization)]
    9798    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
    99104    }
    100105
    101106    public virtual ISymbolicExpressionTreeNode CreateTreeNode() {
    102107      return new SymbolicExpressionTreeNode(this);
     108    }
     109
     110    public virtual IEnumerable<ISymbol> Flatten() {
     111      return new List<ISymbol>() { this };
    103112    }
    104113
Note: See TracChangeset for help on using the changeset viewer.