Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4900


Ignore:
Timestamp:
11/22/10 11:09:28 (14 years ago)
Author:
gkronber
Message:

Added string formatters for GraphViz and LaTex formats.
Set svn:ignore properties. #1270

Location:
branches/DataAnalysis.Extensions
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis.Extensions/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.3

    • Property svn:ignore
      •  

        old new  
        11HeuristicLabEncodingsSymbolicExpressionTreeEncodingViewsPlugin.cs
         2bin
         3obj
  • branches/DataAnalysis.Extensions/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3

    • Property svn:ignore
      •  

        old new  
        11HeuristicLabEncodingsSymbolicExpressionTreeEncodingPlugin.cs
         2bin
         3obj
  • branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3

    • Property svn:ignore
      •  

        old new  
        11HeuristicLabProblemsDataAnalysisPlugin.cs
         2bin
         3*.user
         4obj
  • branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj

    r4864 r4900  
    1 <?xml version="1.0" encoding="utf-8"?>
     1<?xml version="1.0" encoding="utf-8"?>
    22<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    33  <PropertyGroup>
     
    198198    <Compile Include="SupportVectorMachine\SupportVectorMachineUtil.cs" />
    199199    <Compile Include="Symbolic\ArithmeticExpressionGrammar.cs" />
     200    <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeGraphvizFormatter.cs" />
     201    <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeLatexFormatter.cs" />
    200202    <Compile Include="Symbolic\Formatters\SymbolicExpressionTreeSmalltalkStringFormatter.cs" />
    201203    <Compile Include="Symbolic\FullFunctionalExpressionGrammar.cs" />
  • branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeGraphvizFormatter.cs

    r4878 r4900  
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using System.Collections.Generic;
     26using HeuristicLab.Core;
     27using HeuristicLab.Common;
    2628
    27 namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic {
     29namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Formatters {
    2830  [StorableClass]
    29   public class SymbolicExpressionTreeGraphvizFormatter {
     31  [Item("SymbolicExpressionTreeGraphvizFormatter", "Formatter for symbolic expression trees for import into GraphViz documents.")]
     32  public sealed class SymbolicExpressionTreeGraphvizFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
    3033    [Storable]
    3134    public bool Indent { get; set; }
     
    5558
    5659
     60    [StorableConstructor]
     61    private SymbolicExpressionTreeGraphvizFormatter(bool deserializing) : base(deserializing) { }
    5762    public SymbolicExpressionTreeGraphvizFormatter()
    58       : base() {
     63      : base("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.") {
    5964      Indent = true;
     65    }
     66    private SymbolicExpressionTreeGraphvizFormatter(SymbolicExpressionTreeGraphvizFormatter original, Cloner cloner)
     67      : base(original, cloner) {
     68      this.Indent = original.Indent;
     69    }
     70
     71    public override IDeepCloneable Clone(Cloner cloner) {
     72      return new SymbolicExpressionTreeGraphvizFormatter(this, cloner);
    6073    }
    6174
  • branches/DataAnalysis.Extensions/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Formatters/SymbolicExpressionTreeLatexFormatter.cs

    r4878 r4900  
    2828using System;
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     30using HeuristicLab.Core;
     31using HeuristicLab.Common;
    3032
    31 namespace HeuristicLab.Problems.DataAnalysis.Views.Symbolic {
    32   public class SymbolicExpressionTreeLatexFormatter {
     33namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Formatters {
     34  [Item("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.")]
     35  public sealed class SymbolicExpressionTreeLatexFormatter : NamedItem, ISymbolicExpressionTreeStringFormatter {
     36    [StorableConstructor]
     37    private SymbolicExpressionTreeLatexFormatter(bool deserializing) : base(deserializing) { }
    3338    public SymbolicExpressionTreeLatexFormatter()
    34       : base() { }
     39      : base("SymbolicExpressionTreeLatexFormatter", "Formatter for symbolic expression trees for import into LaTeX documents.") { }
     40    private SymbolicExpressionTreeLatexFormatter(SymbolicExpressionTreeLatexFormatter original, Cloner cloner) : base(original, cloner) { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SymbolicExpressionTreeLatexFormatter(this, cloner);
     44    }
    3545
    3646    public string Format(SymbolicExpressionTree symbolicExpressionTree) {
     
    7787      } else if (node.Symbol is Constant) {
    7888        strBuilder.Append(" c ");
    79       } else if (node.Symbol is Variable) {
     89      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable) {
    8090        var varNode = node as VariableTreeNode;
    81         strBuilder.Append(" " + varNode.ToString()+ " ");
     91        strBuilder.Append(" " + varNode.ToString() + " ");
    8292      } else if (node.Symbol is ProgramRootSymbol) {
    8393      } else if (node.Symbol is Defun) {
     
    8999      } else if (node.Symbol is StartSymbol) {
    90100        strBuilder.Append("Result & = & ");
    91       } else if(node.Symbol is Argument) {
     101      } else if (node.Symbol is Argument) {
    92102        var argSym = node.Symbol as Argument;
    93         strBuilder.Append(" ARG+"+argSym.ArgumentIndex+" ");
     103        strBuilder.Append(" ARG+" + argSym.ArgumentIndex + " ");
    94104      } else {
    95105        throw new NotImplementedException("Export of " + node.Symbol + " is not implemented.");
     
    126136        strBuilder.Append(" } ");
    127137      } else if (node.Symbol is Constant) {
    128       } else if (node.Symbol is Variable) {
     138      } else if (node.Symbol is HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable) {
    129139      } else if (node.Symbol is ProgramRootSymbol) {
    130140      } else if (node.Symbol is Defun) {
Note: See TracChangeset for help on using the changeset viewer.