Changeset 3486 for trunk/sources
- Timestamp:
- 04/22/10 09:32:46 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
r3484 r3486 51 51 } 52 52 53 public SymbolicExpressionTreeNode() { } 53 public SymbolicExpressionTreeNode() { 54 // don't allocate subtrees list here! 55 // because we don't want to allocate it in terminal nodes 56 } 54 57 55 58 public SymbolicExpressionTreeNode(Symbol symbol) { … … 64 67 foreach (var subtree in original.SubTrees) { 65 68 AddSubTree((SymbolicExpressionTreeNode)subtree.Clone()); 69 } 70 } 71 72 [StorableHook(HookType.AfterDeserialization)] 73 private void AfterDeserializationHook() { 74 foreach (var subtree in SubTrees) { 75 subtree.Parent = this; 66 76 } 67 77 } … … 112 122 public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPrefix() { 113 123 yield return this; 114 foreach (var subtree in subTrees) { 115 foreach (var n in subtree.IterateNodesPrefix()) 116 yield return n; 124 if (SubTrees != null) { 125 foreach (var subtree in SubTrees) { 126 foreach (var n in subtree.IterateNodesPrefix()) 127 yield return n; 128 } 117 129 } 118 130 } 119 131 120 132 public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPostfix() { 121 foreach (var subtree in subTrees) { 122 foreach (var n in subtree.IterateNodesPrefix()) 123 yield return n; 133 if (SubTrees != null) { 134 foreach (var subtree in SubTrees) { 135 foreach (var n in subtree.IterateNodesPrefix()) 136 yield return n; 137 } 124 138 } 125 139 yield return this; … … 146 160 return Symbol.Name; 147 161 } 148 149 162 } 150 163 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeTopLevelNode.cs
r3462 r3486 44 44 } 45 45 46 [Storable] 46 47 private ISymbolicExpressionGrammar grammar; 47 48 48 internal override ISymbolicExpressionGrammar Grammar { 49 get { 50 return grammar; 51 } 52 set { 53 grammar = value; 54 } 49 get { return grammar; } 50 set { grammar = value; } 55 51 } 56 52 -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs
r3484 r3486 24 24 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols { 25 25 [StorableClass] 26 public sealed class ArgumentTreeNode : SymbolicExpressionTree Node {26 public sealed class ArgumentTreeNode : SymbolicExpressionTreeTerminalNode { 27 27 internal new Argument Symbol { 28 28 get { return (Argument)base.Symbol; }
Note: See TracChangeset
for help on using the changeset viewer.