Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/15/08 16:41:18 (17 years ago)
Author:
gkronber
Message:

created a branch that combines the XmlReader and XmlWriter branches

Location:
branches/XmlReaderWriterBranch
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/EngineBase.cs

    r119 r125  
    204204      writer.WriteEndElement(); // </ExecutionTime>
    205205    }
    206     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    207       base.Populate(node, restoredObjects);
    208       myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);
    209       myGlobalScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("GlobalScope"), restoredObjects);
    210 
    211       XmlNode stackNode = node.SelectSingleNode("ExecutionStack");
    212       for (int i = stackNode.ChildNodes.Count - 1; i >= 0; i--)
    213         myExecutionStack.Push((IOperation)PersistenceManager.Restore(stackNode.ChildNodes[i], restoredObjects));
    214 
    215       XmlNode timeNode = node.SelectSingleNode("ExecutionTime");
    216       myExecutionTime = TimeSpan.Parse(timeNode.InnerText);
     206    public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
     207      base.Populate(reader, restoredObjects);
     208      reader.Read();
     209      myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects);
     210      reader.Skip();
     211      myGlobalScope = (IScope)PersistenceManager.Restore(reader, "GlobalScope", restoredObjects);
     212      reader.Skip();
     213      if(reader.Name!="ExecutionStack") throw new XmlException("Expected \"ExecutionStack\", found: \""+reader.Name+"\"");
     214      List<IOperation> operationList = new List<IOperation>();
     215      if(!reader.IsEmptyElement) {
     216        reader.Read();
     217        while(reader.IsStartElement()) {
     218          operationList.Insert(0, (IOperation)PersistenceManager.Restore(reader, restoredObjects));
     219          reader.Skip();
     220        }
     221        reader.ReadEndElement();
     222      } else {
     223        reader.Read();
     224      }
     225      foreach(IOperation op in operationList)
     226        myExecutionStack.Push(op);
     227      myExecutionTime = TimeSpan.Parse(reader.ReadElementString("ExecutionTime"));
    217228    }
    218229    #endregion
Note: See TracChangeset for help on using the changeset viewer.