Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/03/09 12:26:42 (15 years ago)
Author:
gkronber
Message:

Merged changes from GP-refactoring branch back into the trunk #713.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs

    r1529 r2222  
    2020#endregion
    2121
     22using System.Text;
     23using HeuristicLab.GP.Interfaces;
    2224using System;
    2325using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
    26 using HeuristicLab.Data;
    2726
    2827namespace HeuristicLab.GP.StructureIdentification {
    29   public class SymbolicExpressionExporter : IFunctionTreeExporter, IFunctionTreeNameGenerator {
     28  public class SymbolicExpressionExporter : IFunctionTreeSerializer, IFunctionTreeNameGenerator {
    3029    private StringBuilder builder;
    3130    private string currentIndent;
     
    125124
    126125    public static string ExportToScheme(this Constant constant, IFunctionTree tree) {
    127       return tree.GetLocalVariable(Constant.VALUE).Value.ToString();
     126      return ((ConstantFunctionTree)tree).Value.ToString("r");
    128127    }
    129128
     
    173172
    174173    public static string ExportToScheme(this Variable variable, IFunctionTree tree) {
    175       return "(variable " + tree.GetLocalVariable(Variable.WEIGHT).Value + " " +
    176         tree.GetLocalVariable(Variable.INDEX).Value + " " + tree.GetLocalVariable(Variable.OFFSET).Value + ")";
     174      var varTree = (VariableFunctionTree)tree;
     175      return "(variable " + varTree.Weight.ToString("r") + " " +
     176        varTree.VariableName + " " + varTree.SampleOffset + ")";
    177177    }
    178178    public static string ExportToScheme(this Differential differential, IFunctionTree tree) {
    179       return "(differential " + tree.GetLocalVariable(Differential.WEIGHT).Value + " " +
    180         tree.GetLocalVariable(Differential.INDEX).Value + " " + tree.GetLocalVariable(Differential.OFFSET).Value + ")";
     179      var varTree = (VariableFunctionTree)tree;
     180      return "(differential " + varTree.Weight.ToString("r") + " " +
     181        varTree.VariableName + " " + varTree.SampleOffset + ")";
    181182    }
    182183
Note: See TracChangeset for help on using the changeset viewer.