public static TestDecisionTree XmlDeserialize(string xml) { TestDecisionTree dt = null; try { using (MemoryStream ms = new MemoryStream()) { using (StreamWriter sr = new StreamWriter(ms)) { sr.WriteLine(xml); sr.Flush(); ms.Seek(0, SeekOrigin.Begin); XmlSerializer xs = new XmlSerializer(typeof(TestDecisionTree), new Type[] { typeof(DecisionTree), typeof(Node), typeof(LeafNode), typeof(OpenNode), typeof(TestNode), typeof(ScoreTestNode), typeof(AnchorNode), typeof(Test), typeof(SymbolicTest), typeof(NumericalTest), typeof(Attribute), typeof(SymbolicAttribute), typeof(IdSymbolicAttribute), typeof(NumericalAttribute), typeof(KnownSymbolicValue), typeof(KnownNumericalValue), typeof(AttributeSet) }); dt = xs.Deserialize(ms) as TestDecisionTree; } } } catch (Exception ex) { throw ex; } return(dt); }
private TestDecisionTree GetTestDecisionTree(IEnumerable <Node> nodes) { try { TestDecisionTree dt = new TestDecisionTree( this.AttributeSet, this.GoalAttribute, nodes.ToArray()); this._anchor = dt._anchor; return(this); } catch (Exception ex) { throw ex; } }