Changeset 2220
- Timestamp:
- 08/03/09 10:35:04 (15 years ago)
- Location:
- branches/GP-Refactoring-713/sources
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP.Interfaces/3.3/IFunctionTreeSerializer.cs
r2218 r2220 30 30 string Export(IFunctionTree tree); 31 31 bool TryExport(IFunctionTree tree, out string exported); 32 //IFunctionTree Import(string tree);33 //bool TryImport(string tree, out IFunctionTree importedTree);34 32 } 35 33 } -
branches/GP-Refactoring-713/sources/HeuristicLab.GP.StructureIdentification/3.3/SymbolicExpressionExporter.cs
r2218 r2220 53 53 } 54 54 } 55 56 //public IFunctionTree Import(string tree) {57 // Queue<string> tokens = new Queue<string>(tree.Split(' ', '\n', '\t'));58 // return ParseTree(tokens);59 //}60 61 //private IFunctionTree ParseTree(Queue<string> tokens) {62 // Expect("(", tokens);63 // string funSymb = tokens.Peek();64 // double constValue;65 // if (double.TryParse(funSymb, out constValue)) {66 // throw new UnknownFunctionException(funSymb);67 // }68 // switch (funSymb) {69 // case "variable": return ParseVariable(tokens);70 // case "differential": return ParseDifferential(tokens);71 // default:72 // IFunctionTree fNode = ParseFunction(tokens);73 // Expect(")", tokens);74 // return fNode;75 // }76 77 //}78 79 //private IFunctionTree ParseFunction(Queue<string> tokens) {80 // string symb = tokens.Dequeue();81 // IFunctionTree funTree;82 // switch (symb) {83 // case "+": funTree = new Addition().GetTreeNode(); break;84 // case "-": funTree = new Subtraction().GetTreeNode(); break;85 // case "*": funTree = new Multiplication().GetTreeNode(); break;86 // }87 88 // while (tokens.Peek() == "(") {89 // funTree.AddSubTree(ParseTree(tokens));90 // }91 // return funTree;92 //}93 94 //private IFunctionTree ParseDifferential(Queue<string> tokens) {95 // string symb = tokens.Dequeue();96 // double weight = double.Parse(tokens.Dequeue());97 // string name = tokens.Dequeue();98 // int sampleOffset = int.Parse(tokens.Dequeue());99 // VariableFunctionTree varFunTree = new Differential().GetTreeNode();100 // varFunTree.Weight = weight;101 // varFunTree.SampleOffset = sampleOffset;102 // varFunTree.VariableName = name;103 // return varFunTree;104 //}105 106 //private IFunctionTree ParseVariable(Queue<string> tokens) {107 // string symb = tokens.Dequeue();108 // double weight = double.Parse(tokens.Dequeue());109 // string name = tokens.Dequeue();110 // int sampleOffset = int.Parse(tokens.Dequeue());111 // VariableFunctionTree varFunTree = new Variable().GetTreeNode();112 // varFunTree.Weight = weight;113 // varFunTree.SampleOffset = sampleOffset;114 // varFunTree.VariableName = name;115 // return varFunTree;116 //}117 118 //private void Expect(string p, Queue<string> tokens) {119 // var next = tokens.Dequeue();120 // if (p != next) throw new FormatException("Expected symbol: " + p + ", found symbol: " + next);121 //}122 123 //public bool TryImport(string tree, out IFunctionTree importedTree) {124 // try {125 // importedTree = Import(tree);126 // return true;127 // }128 // catch (UnknownFunctionException) {129 // importedTree = null;130 // return false;131 // }132 //}133 55 134 56 private void BuildExportString(IFunctionTree tree) {
Note: See TracChangeset
for help on using the changeset viewer.