Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/10 15:55:45 (14 years ago)
Author:
gkronber
Message:

Implemented view for symbolic expression grammars and symbols. #1014

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3.csproj

    r3817 r3824  
    128128    <Compile Include="Symbols\Argument.cs" />
    129129    <Compile Include="Symbols\ArgumentTreeNode.cs" />
     130    <Compile Include="Symbols\ReadOnlySymbol.cs" />
    130131    <Compile Include="Symbols\StartSymbol.cs" />
    131132    <Compile Include="Symbols\InvokeFunction.cs" />
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs

    r3484 r3824  
    2929  [StorableClass]
    3030  [Item("Argument", "Symbol that represents a function argument.")]
    31   public sealed class Argument : Symbol {
    32     public override bool CanChangeName {
    33       get {
    34         return false;
    35       }
    36     }
     31  public sealed class Argument : ReadOnlySymbol {
    3732    [Storable]
    3833    private int argumentIndex;
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Defun.cs

    r3462 r3824  
    2929  [StorableClass]
    3030  [Item("Defun", "Symbol that represents a function defining node.")]
    31   public sealed class Defun : Symbol {
    32     public override bool CanChangeName {
    33       get {
    34         return false;
    35       }
    36     }
    37 
     31  public sealed class Defun : ReadOnlySymbol {
    3832    public override SymbolicExpressionTreeNode CreateTreeNode() {
    3933      return new DefunTreeNode(this);
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs

    r3484 r3824  
    3030  [StorableClass]
    3131  [Item("InvokeFunction", "Symbol that the invokation of another function.")]
    32   public sealed class InvokeFunction : Symbol {
     32  public sealed class InvokeFunction : ReadOnlySymbol {
    3333    public override bool CanChangeName {
    3434      get {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ProgramRootSymbol.cs

    r3462 r3824  
    2626  [StorableClass]
    2727  [Item("ProgramRootSymbol", "Special symbol that represents the program root node of a symbolic expression tree.")]
    28   public sealed class ProgramRootSymbol : Symbol {
    29     public override bool CanChangeName {
    30       get {
    31         return false;
    32       }
    33     }
    34 
     28  public sealed class ProgramRootSymbol : ReadOnlySymbol {
    3529    public override SymbolicExpressionTreeNode CreateTreeNode() {
    3630      return new SymbolicExpressionTreeTopLevelNode(this);
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/StartSymbol.cs

    r3462 r3824  
    2626  [StorableClass]
    2727  [Item("StartSymbol", "Special symbol that represents the starting node of the result producing branch of a symbolic expression tree.")]
    28   public sealed class StartSymbol : Symbol {
    29     public override bool CanChangeName {
    30       get {
    31         return false;
    32       }
    33     }
     28  public sealed class StartSymbol : ReadOnlySymbol {
    3429
    3530    public override SymbolicExpressionTreeNode CreateTreeNode() {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs

    r3742 r3824  
    4141      set {
    4242        if (value < 0.0) throw new ArgumentException("InitialFrequency must be positive");
    43         initialFrequency = value;
     43        if (value != initialFrequency) {
     44          initialFrequency = value;
     45          OnChanged(EventArgs.Empty);
     46        }
    4447      }
     48    }
     49    public override bool CanChangeName {
     50      get { return false; }
    4551    }
    4652    #endregion
     
    5864
    5965    public override IDeepCloneable Clone(Cloner cloner) {
    60       Symbol clone = (Symbol) base.Clone(cloner);
     66      Symbol clone = (Symbol)base.Clone(cloner);
    6167      clone.initialFrequency = initialFrequency;
    6268      return clone;
    6369    }
     70
     71    #region events
     72    public event EventHandler Changed;
     73    protected void OnChanged(EventArgs e) {
     74      EventHandler handlers = Changed;
     75      if (handlers != null)
     76        handlers(this, e);
     77    }
     78    #endregion
    6479  }
    6580}
Note: See TracChangeset for help on using the changeset viewer.