public virtual void ReadTree(IEvolutionState state, BinaryReader reader) { var initializer = ((GPInitializer)state.Initializer); Child = GPNode.ReadRootedTree(state, reader, Constraints(initializer).TreeType, Constraints(initializer).FunctionSet, this, 0); }
/// <summary> /// Reads in the tree from a form printed by PrintTree. /// </summary> public virtual void ReadTree(IEvolutionState state, StreamReader reader) { // BRS : TODO : The .NET StreamReader does not provide a way to get the current linenumber. // For now we'll use the byte offset. (could pass in a linenumber tracked by the caller) var linenumber = (int)reader.BaseStream.Position; // the next line will be the child var s = reader.ReadLine(); if (s == null) { // uh oh state.Output.Fatal("Reading at stream position " + linenumber + " : " + "No Tree found."); } else { var initializer = ((GPInitializer)state.Initializer); Child = GPNode.ReadRootedTree(linenumber, new DecodeReturn(s), Constraints(initializer).TreeType, Constraints(initializer).FunctionSet, this, 0, state); } }