Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6375


Ignore:
Timestamp:
06/07/11 09:55:49 (14 years ago)
Author:
mkommend
Message:

#1549: Minor changes in SymbolicExpressionTreeNode and the SymbolicExpressionTreeChart that are necessary for the debugger visualizer to work correctly.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolicExpressionTreeChart.cs

    r5956 r6375  
    2424using System.Drawing;
    2525using System.Drawing.Imaging;
    26 using System.Linq;
    2726using System.Windows.Forms;
    2827
     
    263262
    264263      //draw terminal node
    265       if (node.Subtrees.Count() == 0) {
     264      if (node.SubtreesCount == 0) {
    266265        graphics.FillRectangle(nodeFillBrush, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
    267266        graphics.DrawRectangle(nodeLinePen, visualTreeNode.X, visualTreeNode.Y, visualTreeNode.Width, visualTreeNode.Height);
     
    281280      //calculate areas for the subtrees according to their tree size and call drawFunctionTree
    282281      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];
    284283      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,
    288287          xBoundaries[i + 1] - xBoundaries[i], height, connectFrom);
    289288      }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeNode.cs

    r5809 r6375  
    186186
    187187    public override string ToString() {
    188       return Symbol.Name;
     188      if (Symbol != null) return Symbol.Name;
     189      return "SymbolicExpressionTreeNode";
    189190    }
    190191
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs

    r5809 r6375  
    2727namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
    2828  public static class Grammars {
     29
     30    [StorableClass]
    2931    private class Addition : Symbol {
     32      [StorableConstructor]
     33      protected Addition(bool deserializing) : base(deserializing) { }
    3034      protected Addition(Addition original, Cloner cloner) : base(original, cloner) { }
    3135      public Addition() : base("Addition", "") { }
     
    3438      }
    3539    }
     40
     41    [StorableClass]
    3642    private class Subtraction : Symbol {
     43      [StorableConstructor]
     44      protected Subtraction(bool deserializing) : base(deserializing) { }
    3745      protected Subtraction(Subtraction original, Cloner cloner) : base(original, cloner) { }
    3846      public Subtraction() : base("Subtraction", "") { }
     
    4149      }
    4250    }
     51
     52    [StorableClass]
    4353    private class Multiplication : Symbol {
     54      [StorableConstructor]
     55      protected Multiplication(bool deserializing) : base(deserializing) { }
    4456      protected Multiplication(Multiplication original, Cloner cloner) : base(original, cloner) { }
    4557      public Multiplication() : base("Multiplication", "") { }
     
    4860      }
    4961    }
     62
     63    [StorableClass]
    5064    private class Division : Symbol {
     65      [StorableConstructor]
     66      protected Division(bool deserializing) : base(deserializing) { }
    5167      protected Division(Division original, Cloner cloner) : base(original, cloner) { }
    5268      public Division() : base("Division", "") { }
     
    5571      }
    5672    }
     73
     74    [StorableClass]
    5775    private class Terminal : Symbol {
     76      [StorableConstructor]
     77      protected Terminal(bool deserializing) : base(deserializing) { }
    5878      protected Terminal(Terminal original, Cloner cloner) : base(original, cloner) { }
    5979      public Terminal() : base("Terminal", "") { }
     
    6787    }
    6888
     89    [StorableClass]
    6990    private class TerminalNode : SymbolicExpressionTreeTerminalNode {
    7091      public override bool HasLocalParameters { get { return true; } }
     
    94115    }
    95116
     117    [StorableClass]
    96118    private class SimpleArithmeticGrammar : SymbolicExpressionGrammar {
     119      [StorableConstructor]
     120      protected SimpleArithmeticGrammar(bool deserializing) : base(deserializing) { }
    97121      protected SimpleArithmeticGrammar(SimpleArithmeticGrammar original, Cloner cloner) : base(original, cloner) { }
    98122      public SimpleArithmeticGrammar()
Note: See TracChangeset for help on using the changeset viewer.