Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/10 11:38:04 (14 years ago)
Author:
mkommend
Message:

changed symbols and grammars to be more efficient in respect to cloning, construction and deserialization (ticket #1073)

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs

    r3824 r3993  
    2828  /// </summary>
    2929  [StorableClass]
    30   [Item("Argument", "Symbol that represents a function argument.")]
     30  [Item(Argument.ArgumentName, Argument.ArgumentDescription)]
    3131  public sealed class Argument : ReadOnlySymbol {
     32    public const string ArgumentName = "Argument";
     33    public const string ArgumentDescription = "Symbol that represents a function argument.";
    3234    [Storable]
    3335    private int argumentIndex;
     
    3638    }
    3739
     40    public override bool CanChangeDescription {
     41      get { return false; }
     42    }
     43
     44    [StorableConstructor]
    3845    private Argument() : base() { }
    3946
    4047    public Argument(int argumentIndex)
    41       : base() {
     48      : base("ARG" + argumentIndex, Argument.ArgumentDescription) {
    4249      this.argumentIndex = argumentIndex;
    4350      this.name = "ARG" + argumentIndex;
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Defun.cs

    r3983 r3993  
    2828  /// </summary>
    2929  [StorableClass]
    30   [Item("Defun", "Symbol that represents a function defining node.")]
     30  [Item(Defun.DefunName, Defun.DefunDescription)]
    3131  public sealed class Defun : ReadOnlySymbol {
    32     public Defun() : base() { }
     32    public const string DefunName = "Defun";
     33    public const string DefunDescription = "Symbol that represents a function defining node.";
     34
     35    public Defun() : base(Defun.DefunName, Defun.DefunDescription) { }
     36    [StorableConstructor]
     37    protected Defun(bool deserializing) : base(deserializing) { }
    3338
    3439    public override SymbolicExpressionTreeNode CreateTreeNode() {
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs

    r3824 r3993  
    2929  /// </summary>
    3030  [StorableClass]
    31   [Item("InvokeFunction", "Symbol that the invokation of another function.")]
     31  [Item(InvokeFunction.InvokeFunctionName, InvokeFunction.InvokeFunctionDescription)]
    3232  public sealed class InvokeFunction : ReadOnlySymbol {
     33    public const string InvokeFunctionName = "InvokeFunction";
     34    public const string InvokeFunctionDescription = "Symbol that the invokation of another function.";
    3335    public override bool CanChangeName {
    3436      get {
     
    4648    }
    4749
    48     private InvokeFunction() : base() { }
    49 
     50    [StorableConstructor]
     51    private InvokeFunction(bool deserializing) : base(deserializing) { }
    5052    public InvokeFunction(string functionName)
    51       : base() {
     53      : base("Invoke: " + functionName, InvokeFunction.InvokeFunctionDescription) {
    5254      this.FunctionName = functionName;
    53       this.name = "Invoke: " + functionName;
    5455    }
    5556
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ProgramRootSymbol.cs

    r3824 r3993  
    2525namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols {
    2626  [StorableClass]
    27   [Item("ProgramRootSymbol", "Special symbol that represents the program root node of a symbolic expression tree.")]
     27  [Item(ProgramRootSymbol.ProgramRootSymbolName, ProgramRootSymbol.ProgramRootSymbolDescription)]
    2828  public sealed class ProgramRootSymbol : ReadOnlySymbol {
     29    public const string ProgramRootSymbolName = "ProgramRootSymbol";
     30    public const string ProgramRootSymbolDescription = "Special symbol that represents the program root node of a symbolic expression tree.";
     31
     32    public ProgramRootSymbol() : base(ProgramRootSymbol.ProgramRootSymbolName, ProgramRootSymbol.ProgramRootSymbolDescription) { }
     33    [StorableConstructor]
     34    private ProgramRootSymbol(bool deserializing) : base(deserializing) { }
     35
    2936    public override SymbolicExpressionTreeNode CreateTreeNode() {
    3037      return new SymbolicExpressionTreeTopLevelNode(this);
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ReadOnlySymbol.cs

    r3824 r3993  
    5050    }
    5151
    52     protected ReadOnlySymbol()
    53       : base() {
    54       this.name = ItemName;
    55       this.description = ItemDescription;
    56       initialFrequency = 1.0;
    57     }
     52    protected ReadOnlySymbol() : base() { }
     53    protected ReadOnlySymbol(string name, string description) : base(name, description) { }
     54    [StorableConstructor]
     55    protected ReadOnlySymbol(bool deserializing) : base(deserializing) { }
    5856  }
    5957}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs

    r3824 r3993  
    5454    protected Symbol()
    5555      : base() {
    56       this.name = ItemName;
    57       this.description = ItemDescription;
    5856      initialFrequency = 1.0;
    5957    }
     58
     59    protected Symbol(string name, string description)
     60      : base(name, description) {
     61      initialFrequency = 1.0;
     62    }
     63
     64    [StorableConstructor]
     65    protected Symbol(bool deserializing) : base(deserializing) { }
    6066
    6167    public virtual SymbolicExpressionTreeNode CreateTreeNode() {
Note: See TracChangeset for help on using the changeset viewer.