- Timestamp:
- 06/07/11 09:55:49 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs
r5956 r6375 24 24 using System.Drawing; 25 25 using System.Drawing.Imaging; 26 using System.Linq;27 26 using System.Windows.Forms; 28 27 … … 263 262 264 263 //draw terminal node 265 if (node.Subtrees .Count()== 0) {264 if (node.SubtreesCount == 0) { 266 265 graphics.FillRectangle(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); 267 266 graphics.DrawRectangle(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height); … … 281 280 //calculate areas for the subtrees according to their tree size and call drawFunctionTree 282 281 Point connectFrom = new Point(visualTreeNode.X + visualTreeNode.Width / 2, visualTreeNode.Y + visualTreeNode.Height); 283 int[] xBoundaries = new int[node.Subtrees .Count()+ 1];282 int[] xBoundaries = new int[node.SubtreesCount + 1]; 284 283 xBoundaries[0] = x; 285 for (int i = 0; i < node.Subtrees .Count(); i++) {286 xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node. Subtrees.ElementAt(i).GetLength()) / (node.GetLength() - 1));287 DrawFunctionTree(node. Subtrees.ElementAt(i), graphics, xBoundaries[i], y + height,284 for (int i = 0; i < node.SubtreesCount; i++) { 285 xBoundaries[i + 1] = (int)(xBoundaries[i] + (width * (double)node.GetSubtree(i).GetLength()) / (node.GetLength() - 1)); 286 DrawFunctionTree(node.GetSubtree(i), graphics, xBoundaries[i], y + height, 288 287 xBoundaries[i + 1] - xBoundaries[i], height, connectFrom); 289 288 } -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs
r5809 r6375 186 186 187 187 public override string ToString() { 188 return Symbol.Name; 188 if (Symbol != null) return Symbol.Name; 189 return "SymbolicExpressionTreeNode"; 189 190 } 190 191 -
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs
r5809 r6375 27 27 namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests { 28 28 public static class Grammars { 29 30 [StorableClass] 29 31 private class Addition : Symbol { 32 [StorableConstructor] 33 protected Addition(bool deserializing) : base(deserializing) { } 30 34 protected Addition(Addition original, Cloner cloner) : base(original, cloner) { } 31 35 public Addition() : base("Addition", "") { } … … 34 38 } 35 39 } 40 41 [StorableClass] 36 42 private class Subtraction : Symbol { 43 [StorableConstructor] 44 protected Subtraction(bool deserializing) : base(deserializing) { } 37 45 protected Subtraction(Subtraction original, Cloner cloner) : base(original, cloner) { } 38 46 public Subtraction() : base("Subtraction", "") { } … … 41 49 } 42 50 } 51 52 [StorableClass] 43 53 private class Multiplication : Symbol { 54 [StorableConstructor] 55 protected Multiplication(bool deserializing) : base(deserializing) { } 44 56 protected Multiplication(Multiplication original, Cloner cloner) : base(original, cloner) { } 45 57 public Multiplication() : base("Multiplication", "") { } … … 48 60 } 49 61 } 62 63 [StorableClass] 50 64 private class Division : Symbol { 65 [StorableConstructor] 66 protected Division(bool deserializing) : base(deserializing) { } 51 67 protected Division(Division original, Cloner cloner) : base(original, cloner) { } 52 68 public Division() : base("Division", "") { } … … 55 71 } 56 72 } 73 74 [StorableClass] 57 75 private class Terminal : Symbol { 76 [StorableConstructor] 77 protected Terminal(bool deserializing) : base(deserializing) { } 58 78 protected Terminal(Terminal original, Cloner cloner) : base(original, cloner) { } 59 79 public Terminal() : base("Terminal", "") { } … … 67 87 } 68 88 89 [StorableClass] 69 90 private class TerminalNode : SymbolicExpressionTreeTerminalNode { 70 91 public override bool HasLocalParameters { get { return true; } } … … 94 115 } 95 116 117 [StorableClass] 96 118 private class SimpleArithmeticGrammar : SymbolicExpressionGrammar { 119 [StorableConstructor] 120 protected SimpleArithmeticGrammar(bool deserializing) : base(deserializing) { } 97 121 protected SimpleArithmeticGrammar(SimpleArithmeticGrammar original, Cloner cloner) : base(original, cloner) { } 98 122 public SimpleArithmeticGrammar()
Note: See TracChangeset
for help on using the changeset viewer.