public CrossoverInstructionFactory(string filename) { if (string.IsNullOrEmpty(filename)) { mCurrentCrossover = CreateDefaultInstruction(); } else { mFilename = filename; XmlDocument doc = new XmlDocument(); doc.Load(filename); XmlElement doc_root = doc.DocumentElement; string selected_strategy = doc_root.Attributes["strategy"].Value; foreach (XmlElement xml_level1 in doc_root.ChildNodes) { if (xml_level1.Name == "strategy") { string attrname = xml_level1.Attributes["name"].Value; if (attrname == selected_strategy) { mCurrentCrossover = CreateInstructionFromXml(attrname, xml_level1); } } } if (mCurrentCrossover == null) { mCurrentCrossover = CreateDefaultInstruction(); } } }
public CrossoverInstructionFactory() { mCurrentCrossover = CreateDefaultInstruction(); }