- Timestamp:
- 05/13/10 20:30:30 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
r3742 r3803 121 121 122 122 public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPrefix() { 123 yield return this; 124 if (SubTrees != null) { 125 foreach (var subtree in SubTrees) { 126 foreach (var n in subtree.IterateNodesPrefix()) 127 yield return n; 128 } 129 } 123 return (new SymbolicExpressionTreeNode[] { this }) 124 .Concat(SubTrees.SelectMany(tree => tree.IterateNodesPrefix())); 130 125 } 131 126 132 127 public IEnumerable<SymbolicExpressionTreeNode> IterateNodesPostfix() { 133 if (SubTrees != null) { 134 foreach (var subtree in SubTrees) { 135 foreach (var n in subtree.IterateNodesPrefix()) 136 yield return n; 137 } 138 } 139 yield return this; 128 return SubTrees.SelectMany(tree => tree.IterateNodesPrefix()) 129 .Concat(new SymbolicExpressionTreeNode[] { this }); 140 130 } 141 131 public IEnumerable<Symbol> GetAllowedSymbols(int argumentIndex) {
Note: See TracChangeset
for help on using the changeset viewer.