Changeset 2222 for trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs
- Timestamp:
- 08/03/09 12:26:42 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs
r1529 r2222 20 20 #endregion 21 21 22 using System.Text; 23 using HeuristicLab.GP.Interfaces; 22 24 using System; 23 25 using System.Collections.Generic; 24 using System.Linq;25 using System.Text;26 using HeuristicLab.Data;27 26 28 27 namespace HeuristicLab.GP.StructureIdentification { 29 public class SymbolicExpressionExporter : IFunctionTree Exporter, IFunctionTreeNameGenerator {28 public class SymbolicExpressionExporter : IFunctionTreeSerializer, IFunctionTreeNameGenerator { 30 29 private StringBuilder builder; 31 30 private string currentIndent; … … 125 124 126 125 public static string ExportToScheme(this Constant constant, IFunctionTree tree) { 127 return tree.GetLocalVariable(Constant.VALUE).Value.ToString();126 return ((ConstantFunctionTree)tree).Value.ToString("r"); 128 127 } 129 128 … … 173 172 174 173 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 + ")"; 177 177 } 178 178 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 + ")"; 181 182 } 182 183
Note: See TracChangeset
for help on using the changeset viewer.