Changeset 3484
- Timestamp:
- 04/22/10 08:51:33 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/GlobalSymbolicExpressionGrammar.cs
r3462 r3484 83 83 } 84 84 85 [StorableHook(HookType.AfterDeserialization)] 86 private void AfterDeserializationHook() { 87 Reset(); 88 } 89 85 90 private new void Reset() { 86 91 base.Reset(); -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
r3462 r3484 39 39 [Storable] 40 40 private Symbol symbol; 41 public Symbol Symbol { 42 get { return symbol; } 43 protected set { symbol = value; } 44 } 41 45 42 46 // parent relation is not persisted or cloned (will be set on AddSubtree or RemoveSubtree) 43 47 private SymbolicExpressionTreeNode parent; 44 45 public SymbolicExpressionTreeNode() {46 s ubTrees = new List<SymbolicExpressionTreeNode>();48 internal SymbolicExpressionTreeNode Parent { 49 get { return parent; } 50 set { parent = value; } 47 51 } 48 52 49 public SymbolicExpressionTreeNode(Symbol symbol) 50 : this() { 53 public SymbolicExpressionTreeNode() { } 54 55 public SymbolicExpressionTreeNode(Symbol symbol) { 56 subTrees = new List<SymbolicExpressionTreeNode>(); 51 57 this.symbol = symbol; 52 58 } … … 67 73 public virtual IList<SymbolicExpressionTreeNode> SubTrees { 68 74 get { return subTrees; } 69 }70 71 public Symbol Symbol {72 get { return symbol; }73 protected set { symbol = value; }74 }75 76 internal SymbolicExpressionTreeNode Parent {77 get { return parent; }78 set { parent = value; }79 75 } 80 76 -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTerminalNode.cs
r3462 r3484 31 31 32 32 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding { 33 [StorableClass] 33 34 public abstract class SymbolicExpressionTreeTerminalNode : SymbolicExpressionTreeNode { 34 35 private static List<SymbolicExpressionTreeNode> emptyList = new List<SymbolicExpressionTreeNode>(); 35 36 36 protected SymbolicExpressionTreeTerminalNode(Symbol symbol) : base(symbol) { } 37 protected SymbolicExpressionTreeTerminalNode(SymbolicExpressionTreeTerminalNode original) 38 : base(original) { 37 protected SymbolicExpressionTreeTerminalNode() : base() { } 38 // don't call base constructors to prevent allocation of sub-trees list in base! 39 protected SymbolicExpressionTreeTerminalNode(Symbol symbol) { 40 this.Symbol = symbol; 41 } 42 // don't call base constructors to prevent allocation of sub-trees list in base! 43 protected SymbolicExpressionTreeTerminalNode(SymbolicExpressionTreeTerminalNode original) { 44 this.Symbol = original.Symbol; 39 45 } 40 46 -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Argument.cs
r3462 r3484 35 35 } 36 36 } 37 37 [Storable] 38 38 private int argumentIndex; 39 39 public int ArgumentIndex { 40 40 get { return argumentIndex; } 41 41 } 42 43 private Argument() : base() { } 42 44 43 45 public Argument(int argumentIndex) … … 50 52 return new ArgumentTreeNode(this); 51 53 } 54 55 public override IDeepCloneable Clone(Cloner cloner) { 56 Argument clone = (Argument)base.Clone(cloner); 57 clone.argumentIndex = argumentIndex; 58 clone.name = "ARG" + argumentIndex; 59 return clone; 60 } 52 61 } 53 62 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs
r3462 r3484 29 29 set { 30 30 if (value == null) throw new ArgumentNullException(); 31 if (!(value is Argument)) throw new ArgumentException();32 base.Symbol = value; 31 if (!(value is Argument)) throw new ArgumentException(); 32 base.Symbol = value; 33 33 } 34 34 } 35 35 36 private ArgumentTreeNode() : base() { } 37 36 38 // copy constructor 37 39 private ArgumentTreeNode(ArgumentTreeNode original) -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs
r3462 r3484 40 40 } 41 41 42 private DefunTreeNode() : base() { } 43 42 44 // copy constructor 43 45 private DefunTreeNode(DefunTreeNode original) -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunction.cs
r3462 r3484 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using System; 25 26 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols { 26 27 /// <summary> … … 35 36 } 36 37 } 37 public string FunctionName { get; set; } 38 [Storable] 39 private string functionName; 40 public string FunctionName { 41 get { return functionName; } 42 set { 43 if (value == null) throw new ArgumentNullException(); 44 functionName = value; 45 } 46 } 47 48 private InvokeFunction() : base() { } 38 49 39 50 public InvokeFunction(string functionName) … … 46 57 return new InvokeFunctionTreeNode(this); 47 58 } 59 60 public override IDeepCloneable Clone(Cloner cloner) { 61 InvokeFunction clone = (InvokeFunction)base.Clone(cloner); 62 clone.functionName = functionName; 63 clone.name = "Invoke: " + functionName; 64 return clone; 65 } 48 66 } 49 67 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs
r3462 r3484 34 34 } 35 35 36 private InvokeFunctionTreeNode() : base() { } 37 36 38 // copy constructor 37 39 private InvokeFunctionTreeNode(InvokeFunctionTreeNode original) -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs
r3462 r3484 35 35 public abstract class Symbol : NamedItem { 36 36 #region Properties 37 [Storable] 37 38 private double initialFrequency; 38 39 public double InitialFrequency { … … 55 56 return new SymbolicExpressionTreeNode(this); 56 57 } 58 59 public override IDeepCloneable Clone(Cloner cloner) { 60 Symbol clone = (Symbol) base.Clone(cloner); 61 clone.initialFrequency = initialFrequency; 62 return clone; 63 } 57 64 } 58 65 }
Note: See TracChangeset
for help on using the changeset viewer.