Free cookie consent management tool by TermsFeed Policy Generator

Changeset 125 for branches


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:
60 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs

    r119 r125  
    9696    }
    9797
    98     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    99       base.Populate(node, restoredObjects);
    100       groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects);
     98    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     99    //  base.Populate(node, restoredObjects);
     100    //  groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects);
     101    //}
     102    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     103      base.Populate(reader, restoredObjects);
     104      reader.Read();
     105      groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(reader, "SubOperatorsGroupConstraint", restoredObjects);
     106      reader.Read();
    101107    }
    102108    #endregion persistence
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/AndConstraint.cs

    r119 r125  
    8585    }
    8686
    87     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    88       base.Populate(node, restoredObjects);
    89       clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     87    //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
     88    //  base.Populate(node, restoredObjects);
     89    //  clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     90    //}
     91    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     92      base.Populate(reader, restoredObjects);
     93      reader.Read();
     94      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects);
     95      reader.Read();
    9096    }
    9197    #endregion persistence
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs

    r119 r125  
    164164    }
    165165
    166     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    167       base.Populate(node, restoredObjects);
    168       lowerBound = double.Parse(node.Attributes["LowerBound"].Value);
    169       if (node.Attributes["LowerBoundIncluded"] != null) {
    170         lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value);
     166    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     167    //  base.Populate(node, restoredObjects);
     168    //  lowerBound = double.Parse(node.Attributes["LowerBound"].Value);
     169    //  if(node.Attributes["LowerBoundIncluded"] != null) {
     170    //    lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value);
     171    //  } else {
     172    //    lowerBoundIncluded = true;
     173    //  }
     174    //  if(node.Attributes["LowerBoundEnabled"] != null) {
     175    //    lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value);
     176    //  } else {
     177    //    lowerBoundEnabled = true;
     178    //  }
     179
     180    //  upperBound = double.Parse(node.Attributes["UpperBound"].Value);
     181    //  if(node.Attributes["UpperBoundIncluded"] != null) {
     182    //    upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value);
     183    //  } else {
     184    //    upperBoundIncluded = true;
     185    //  }
     186    //  if(node.Attributes["UpperBoundEnabled"] != null) {
     187    //    upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value);
     188    //  } else {
     189    //    upperBoundEnabled = true;
     190    //  }
     191    //}
     192    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     193      lowerBound = double.Parse(reader["LowerBound"]);
     194      if(reader["LowerBoundIncluded"] != null) {
     195        lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]);
    171196      } else {
    172197        lowerBoundIncluded = true;
    173198      }
    174       if (node.Attributes["LowerBoundEnabled"] != null) {
    175         lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value);
     199      if(reader["LowerBoundEnabled"] != null) {
     200        lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]);
    176201      } else {
    177202        lowerBoundEnabled = true;
    178203      }
    179204
    180       upperBound = double.Parse(node.Attributes["UpperBound"].Value);
    181       if (node.Attributes["UpperBoundIncluded"] != null) {
    182         upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value);
     205      upperBound = double.Parse(reader["UpperBound"]);
     206      if(reader["UpperBoundIncluded"] != null) {
     207        upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]);
    183208      } else {
    184209        upperBoundIncluded = true;
    185210      }
    186       if (node.Attributes["UpperBoundEnabled"] != null) {
    187         upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value);
     211      if(reader["UpperBoundEnabled"] != null) {
     212        upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]);
    188213      } else {
    189214        upperBoundEnabled = true;
    190215      }
     216      base.Populate(reader, restoredObjects);
    191217    }
    192218    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs

    r119 r125  
    159159    }
    160160
    161     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    162       base.Populate(node, restoredObjects);
    163       lowerBound = int.Parse(node.Attributes["LowerBound"].Value);
    164       if (node.Attributes["LowerBoundIncluded"] != null) {
    165         lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value);
     161    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     162    //  base.Populate(node, restoredObjects);
     163    //  lowerBound = int.Parse(node.Attributes["LowerBound"].Value);
     164    //  if (node.Attributes["LowerBoundIncluded"] != null) {
     165    //    lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value);
     166    //  } else {
     167    //    lowerBoundIncluded = true;
     168    //  }
     169    //  if (node.Attributes["LowerBoundEnabled"] != null) {
     170    //    lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value);
     171    //  } else {
     172    //    lowerBoundEnabled = true;
     173    //  }
     174
     175    //  upperBound = int.Parse(node.Attributes["UpperBound"].Value);
     176    //  if (node.Attributes["UpperBoundIncluded"] != null) {
     177    //    upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value);
     178    //  } else {
     179    //    upperBoundIncluded = true;
     180    //  }
     181    //  if (node.Attributes["UpperBoundEnabled"] != null) {
     182    //    upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value);
     183    //  } else {
     184    //    upperBoundEnabled = true;
     185    //  }
     186    //}
     187    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     188      lowerBound = int.Parse(reader["LowerBound"]);
     189      if(reader["LowerBoundIncluded"] != null) {
     190        lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]);
    166191      } else {
    167192        lowerBoundIncluded = true;
    168193      }
    169       if (node.Attributes["LowerBoundEnabled"] != null) {
    170         lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value);
     194      if(reader["LowerBoundEnabled"] != null) {
     195        lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]);
    171196      } else {
    172197        lowerBoundEnabled = true;
    173198      }
    174199
    175       upperBound = int.Parse(node.Attributes["UpperBound"].Value);
    176       if (node.Attributes["UpperBoundIncluded"] != null) {
    177         upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value);
     200      upperBound = int.Parse(reader["UpperBound"]);
     201      if(reader["UpperBoundIncluded"] != null) {
     202        upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]);
    178203      } else {
    179204        upperBoundIncluded = true;
    180205      }
    181       if (node.Attributes["UpperBoundEnabled"] != null) {
    182         upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value);
     206      if(reader["UpperBoundEnabled"] != null) {
     207        upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]);
    183208      } else {
    184209        upperBoundEnabled = true;
    185210      }
    186     }
     211      base.Populate(reader, restoredObjects);
     212    }
     213
    187214    #endregion
    188215  }
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs

    r119 r125  
    9090    }
    9191
    92     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    93       base.Populate(node, restoredObjects);
    94       XmlAttribute itemTypeAttribute = node.Attributes["ItemType"];
    95       type = Type.GetType(itemTypeAttribute.Value);
     92    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     93    //  base.Populate(node, restoredObjects);
     94    //  XmlAttribute itemTypeAttribute = node.Attributes["ItemType"];
     95    //  type = Type.GetType(itemTypeAttribute.Value);
     96    //}
     97    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     98      type = Type.GetType(reader["ItemType"]);
     99      base.Populate(reader, restoredObjects);
    96100    }
    97101    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/NotConstraint.cs

    r119 r125  
    7979    }
    8080
    81     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    82       base.Populate(node, restoredObjects);
    83       subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects);
     81    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     82    //  base.Populate(node, restoredObjects);
     83    //  subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects);
     84    //}
     85    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     86      base.Populate(reader, restoredObjects);
     87      reader.Read();
     88      subConstraint = (ConstraintBase)PersistenceManager.Restore(reader, "SubConstraint", restoredObjects);
     89      reader.Read();
    8490    }
    8591    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs

    r119 r125  
    9393    }
    9494
    95     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    96       base.Populate(node, restoredObjects);
    97       minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects);
    98       maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects);
     95    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     96    //  base.Populate(node, restoredObjects);
     97    //  minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects);
     98    //  maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects);
     99    //}
     100    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     101      base.Populate(reader, restoredObjects);
     102      reader.Read();
     103      minOperators = (IntData)PersistenceManager.Restore(reader, "min", restoredObjects);
     104      reader.Read();
     105      maxOperators = (IntData)PersistenceManager.Restore(reader, "max", restoredObjects);
     106      reader.Read();
    99107    }
    100108    #endregion persistence
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/OrConstraint.cs

    r119 r125  
    8686    }
    8787
    88     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    89       base.Populate(node, restoredObjects);
    90       clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     88    //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
     89    //  base.Populate(node, restoredObjects);
     90    //  clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects);
     91    //}
     92    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     93      base.Populate(reader, restoredObjects);
     94      reader.Read();
     95      clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects);
     96      reader.Read();
    9197    }
    9298    #endregion persistence
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs

    r119 r125  
    129129    }
    130130
    131     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    132       base.Populate(node, restoredObjects);
    133       subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects);
     131    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     132    //  base.Populate(node, restoredObjects);
     133    //  subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects);
     134    //  subOperators = new List<IOperator>();
     135    //  foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) {
     136    //    subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects));
     137    //  }
     138    //}
     139    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     140      base.Populate(reader, restoredObjects);
     141      reader.Read();
     142      subOperatorIndex = (IntData)PersistenceManager.Restore(reader, "SubOperatorIndex", restoredObjects);
     143      reader.Read();
    134144      subOperators = new List<IOperator>();
    135       foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) {
    136         subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects));
     145      if(reader.Name !="AllowedSubOperators") throw new XmlException("Expected: \"AllowedSubOperators\", found: \""+reader.Name+"\"");
     146      if(!reader.IsEmptyElement) {
     147        reader.Read();
     148        while(reader.IsStartElement()) {
     149          subOperators.Add((IOperator)PersistenceManager.Restore(reader, restoredObjects));
     150          reader.Skip();
     151        }
     152        reader.ReadEndElement();
     153      } else {
     154        reader.Read();
    137155      }
    138156    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs

    r119 r125  
    123123    }
    124124
    125     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    126       base.Populate(node, restoredObjects);
    127       leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects);
    128       rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects);
    129       comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects);
     125    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     126    //  base.Populate(node, restoredObjects);
     127    //  leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects);
     128    //  rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects);
     129    //  comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects);
     130    //}
     131    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     132      base.Populate(reader, restoredObjects);
     133      reader.Read();
     134      leftVarName = (StringData)PersistenceManager.Restore(reader, "LeftVarName", restoredObjects);
     135      reader.Skip();
     136      rightVarName = (StringData)PersistenceManager.Restore(reader, "RightVarName", restoredObjects);
     137      reader.Skip();
     138      comparer = (IntData)PersistenceManager.Restore(reader, "Comparer", restoredObjects);
     139      reader.Read();
    130140    }
    131141    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/AtomicOperation.cs

    r119 r125  
    6262      PersistenceManager.Persist("Scope", Scope, writer, persistedObjects);
    6363    }
    64     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    65       base.Populate(node, restoredObjects);
    66       myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects);
    67       myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects);
     64    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     65    //  base.Populate(node, restoredObjects);
     66    //  myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects);
     67    //  myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects);
     68    //}
     69    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     70      base.Populate(reader, restoredObjects);
     71      reader.Read();
     72      myOperator = (IOperator)PersistenceManager.Restore(reader, "Operator", restoredObjects);
     73      reader.Skip();
     74      myScope = (IScope)PersistenceManager.Restore(reader, "Scope", restoredObjects);
     75      reader.Read();
    6876    }
    6977    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/CompositeOperation.cs

    r119 r125  
    7979      writer.WriteEndElement(); // </Operations>
    8080    }
    81     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    82       base.Populate(node, restoredObjects);
     81    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     82    //  base.Populate(node, restoredObjects);
    8383
    84       myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);
     84    //  myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);
    8585
    86       XmlNode operationsNode = node.SelectSingleNode("Operations");
    87       for (int i = 0; i < operationsNode.ChildNodes.Count; i++)
    88         AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects));
     86    //  XmlNode operationsNode = node.SelectSingleNode("Operations");
     87    //  for (int i = 0; i < operationsNode.ChildNodes.Count; i++)
     88    //    AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects));
     89    //}
     90    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     91      myExecuteInParallel = bool.Parse(reader["ExecuteInParallel"]);
     92      base.Populate(reader, restoredObjects);
     93
     94      if(reader.Name != "Operations") throw new XmlException("Expected: \"Operations\", found: \""+reader.Name+"\"");
     95      if(!reader.IsEmptyElement) {
     96        reader.Read();
     97        while(reader.IsStartElement()) {
     98          AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects));
     99          reader.Skip();
     100        }
     101        reader.ReadEndElement();
     102      } else {
     103        reader.Read();
     104      }
    89105    }
    90106    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs

    r119 r125  
    3939      ConstrainedItemBase clone = (ConstrainedItemBase)base.Clone(clonedObjects);
    4040      clone.myConstraints.Clear();
    41       foreach (IConstraint constraint in Constraints)
     41      foreach(IConstraint constraint in Constraints)
    4242        clone.AddConstraint((IConstraint)Auxiliary.Clone(constraint, clonedObjects));
    4343      return clone;
     
    4949    }
    5050    public virtual void RemoveConstraint(IConstraint constraint) {
    51       if (myConstraints.Remove(constraint))
     51      if(myConstraints.Remove(constraint))
    5252        OnConstraintRemoved(constraint);
    5353    }
     
    5555    public bool IsValid() {
    5656      bool result = true;
    57       foreach (IConstraint constraint in Constraints)
     57      foreach(IConstraint constraint in Constraints)
    5858        result = result && constraint.Check(this);
    5959      return result;
     
    6262      bool result = true;
    6363      violatedConstraints = new List<IConstraint>();
    64       foreach (IConstraint constraint in Constraints) {
    65         if (!constraint.Check(this)) {
     64      foreach(IConstraint constraint in Constraints) {
     65        if(!constraint.Check(this)) {
    6666          result = false;
    6767          violatedConstraints.Add(constraint);
     
    7777    public event EventHandler<ConstraintEventArgs> ConstraintAdded;
    7878    protected virtual void OnConstraintAdded(IConstraint constraint) {
    79       if (ConstraintAdded != null)
     79      if(ConstraintAdded != null)
    8080        ConstraintAdded(this, new ConstraintEventArgs(constraint));
    8181    }
    8282    public event EventHandler<ConstraintEventArgs> ConstraintRemoved;
    8383    protected virtual void OnConstraintRemoved(IConstraint constraint) {
    84       if (ConstraintRemoved != null)
     84      if(ConstraintRemoved != null)
    8585        ConstraintRemoved(this, new ConstraintEventArgs(constraint));
    8686    }
     
    106106      }
    107107    }
    108     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    109       base.Populate(node, restoredObjects);
    110       XmlNode constraintsNode = node.SelectSingleNode("Constraints");
    111       if (constraintsNode != null) {
     108    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     109    //  base.Populate(node, restoredObjects);
     110    //  XmlNode constraintsNode = node.SelectSingleNode("Constraints");
     111    //  if(constraintsNode != null) {
     112    //    myConstraints.Clear();
     113    //    foreach(XmlNode constraintNode in constraintsNode.ChildNodes)
     114    //      AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects));
     115    //  }
     116    //}
     117    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     118      base.Populate(reader, restoredObjects);
     119      reader.Read();
     120      if(reader.Name == "Constraints") {
    112121        myConstraints.Clear();
    113         foreach (XmlNode constraintNode in constraintsNode.ChildNodes)
    114           AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects));
     122        reader.Read();
     123        while(reader.IsStartElement()) {
     124          AddConstraint((IConstraint)PersistenceManager.Restore(reader, restoredObjects));
     125          reader.Skip();
     126        }
     127        reader.ReadEndElement();
    115128      }
    116129    }
  • 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
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs

    r119 r125  
    3434    //XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects);
    3535    void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects);
    36     void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects);
     36    void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects);
    3737  }
    3838}
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorBase.cs

    r124 r125  
    480480      writer.WriteEndElement(); // </Variables>
    481481    }
    482     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    483       base.Populate(node, restoredObjects);
    484       myName = node.Attributes["Name"].Value;
    485       if (node.Attributes["Breakpoint"] != null)
    486         myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value);
    487       XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators");
    488       for (int i = 0; i < subOperatorsNode.ChildNodes.Count; i++)
    489         AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects));
    490       XmlNode infosNode = node.SelectSingleNode("VariableInfos");
     482    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     483    //  base.Populate(node, restoredObjects);
     484    //  myName = node.Attributes["Name"].Value;
     485    //  if(node.Attributes["Breakpoint"] != null)
     486    //    myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value);
     487    //  XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators");
     488    //  for(int i = 0; i < subOperatorsNode.ChildNodes.Count; i++)
     489    //    AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects));
     490    //  XmlNode infosNode = node.SelectSingleNode("VariableInfos");
     491    //  myVariableInfos.Clear();
     492    //  foreach(XmlNode infoNode in infosNode.ChildNodes)
     493    //    AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects));
     494    //  XmlNode variablesNode = node.SelectSingleNode("Variables");
     495    //  myVariables.Clear();
     496    //  foreach(XmlNode variableNode in variablesNode.ChildNodes)
     497    //    AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
     498    //}
     499    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     500      myName = reader["Name"];
     501      if(reader["Breakpoint"] != null)
     502        myBreakpoint = bool.Parse(reader["Breakpoint"]);
     503
     504      base.Populate(reader, restoredObjects);
     505      // constraintItemBase already reads to the next subelement
     506      if(reader.Name != "SubOperators") throw new XmlException("Expected: \"SubOperators\" found: \"" + reader.Name+"\"");
     507      if(!reader.IsEmptyElement) {
     508        reader.Read();
     509        while(reader.IsStartElement()) {
     510          AddSubOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
     511          reader.Skip();
     512        }
     513        reader.ReadEndElement();
     514      } else {
     515        reader.Read();
     516      }
     517      if(reader.Name != "VariableInfos") throw new XmlException("Expected: \"VariableInfos\" found: \"" + reader.Name+"\"");
    491518      myVariableInfos.Clear();
    492       foreach (XmlNode infoNode in infosNode.ChildNodes)
    493         AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects));
    494       XmlNode variablesNode = node.SelectSingleNode("Variables");
     519      if(!reader.IsEmptyElement) {
     520        reader.Read();
     521        while(reader.IsStartElement()) {       
     522          AddVariableInfo((IVariableInfo)PersistenceManager.Restore(reader, restoredObjects));
     523          reader.Skip();
     524        }
     525        reader.ReadEndElement();
     526      } else {
     527        reader.Read();
     528      }
     529      if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\" found: \"" + reader.Name + "\"");
    495530      myVariables.Clear();
    496       foreach (XmlNode variableNode in variablesNode.ChildNodes)
    497         AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
     531      if(!reader.IsEmptyElement) {
     532        reader.Read();
     533        while(reader.IsStartElement()) {
     534          AddVariable((IVariable)PersistenceManager.Restore(reader, restoredObjects));
     535          reader.Skip();
     536        }
     537        reader.ReadEndElement();
     538      } else {
     539        reader.Read();
     540      }
    498541    }
    499542    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGraph.cs

    r119 r125  
    3535      get { return myInitialOperator; }
    3636      set {
    37         if (myInitialOperator != value) {
     37        if(myInitialOperator != value) {
    3838          myInitialOperator = value;
    3939          OnInitialOperatorChanged();
     
    5353      OperatorGraph clone = new OperatorGraph();
    5454      clonedObjects.Add(Guid, clone);
    55       foreach (IOperator op in Operators)
     55      foreach(IOperator op in Operators)
    5656        clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects));
    57       if (InitialOperator != null)
     57      if(InitialOperator != null)
    5858        clone.myInitialOperator = (IOperator)Auxiliary.Clone(InitialOperator, clonedObjects);
    5959      return clone;
     
    6161
    6262    public void AddOperator(IOperator op) {
    63       if (!myOperators.ContainsKey(op.Guid)) {
     63      if(!myOperators.ContainsKey(op.Guid)) {
    6464        myOperators.Add(op.Guid, op);
    6565        OnOperatorAdded(op);
    6666
    67         foreach (IOperator subOperator in op.SubOperators)
     67        foreach(IOperator subOperator in op.SubOperators)
    6868          AddOperator(subOperator);
    6969      }
     
    7171    public void RemoveOperator(Guid guid) {
    7272      IOperator op = GetOperator(guid);
    73       if (op != null) {
    74         foreach (IOperator o in Operators) {
     73      if(op != null) {
     74        foreach(IOperator o in Operators) {
    7575          int i = 0;
    76           while (i < o.SubOperators.Count) {
    77             if (o.SubOperators[i] == op)
     76          while(i < o.SubOperators.Count) {
     77            if(o.SubOperators[i] == op)
    7878              o.RemoveSubOperator(i);
    7979            else
     
    8181          }
    8282        }
    83         if (InitialOperator == op)
     83        if(InitialOperator == op)
    8484          InitialOperator = null;
    8585        myOperators.Remove(op.Guid);
     
    8989    public IOperator GetOperator(Guid guid) {
    9090      IOperator op;
    91       if (myOperators.TryGetValue(guid, out op))
     91      if(myOperators.TryGetValue(guid, out op))
    9292        return op;
    9393      else
     
    9797      Guid[] guids = new Guid[Operators.Count];
    9898      int i = 0;
    99       foreach (IOperator op in Operators) {
     99      foreach(IOperator op in Operators) {
    100100        guids[i] = op.Guid;
    101101        i++;
    102102      }
    103       for (int j = 0; j < guids.Length; j++)
     103      for(int j = 0; j < guids.Length; j++)
    104104        RemoveOperator(guids[j]);
    105105    }
     
    107107    public event EventHandler<OperatorEventArgs> OperatorAdded;
    108108    protected virtual void OnOperatorAdded(IOperator op) {
    109       if (OperatorAdded != null)
     109      if(OperatorAdded != null)
    110110        OperatorAdded(this, new OperatorEventArgs(op));
    111111    }
    112112    public event EventHandler<OperatorEventArgs> OperatorRemoved;
    113113    protected virtual void OnOperatorRemoved(IOperator op) {
    114       if (OperatorRemoved != null)
     114      if(OperatorRemoved != null)
    115115        OperatorRemoved(this, new OperatorEventArgs(op));
    116116    }
    117117    public event EventHandler InitialOperatorChanged;
    118118    protected virtual void OnInitialOperatorChanged() {
    119       if (InitialOperatorChanged != null)
     119      if(InitialOperatorChanged != null)
    120120        InitialOperatorChanged(this, new EventArgs());
    121121    }
     
    141141        PersistenceManager.Persist("InitialOperator", InitialOperator, writer, persistedObjects);
    142142    }
    143     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    144       base.Populate(node, restoredObjects);
     143    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     144    //  base.Populate(node, restoredObjects);
    145145
    146       XmlNode ops = node.SelectSingleNode("Operators");
    147       for (int i = 0; i < ops.ChildNodes.Count; i++) {
    148         XmlNode opNode = ops.ChildNodes[i];
    149         IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects);
     146    //  XmlNode ops = node.SelectSingleNode("Operators");
     147    //  for(int i = 0; i < ops.ChildNodes.Count; i++) {
     148    //    XmlNode opNode = ops.ChildNodes[i];
     149    //    IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects);
     150    //    myOperators.Add(op.Guid, op);
     151    //  }
     152
     153    //  XmlNode initial = node.SelectSingleNode("InitialOperator");
     154    //  if(initial != null)
     155    //    myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);
     156    //}
     157    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     158      base.Populate(reader, restoredObjects);
     159
     160      reader.Read();
     161      if(reader.Name != "Operators") throw new XmlException("Expected: Operators found: " + reader.Name);
     162      reader.Read();
     163      while(reader.IsStartElement()) {
     164        IOperator op = (IOperator)PersistenceManager.Restore(reader, restoredObjects);
     165        reader.Skip();
    150166        myOperators.Add(op.Guid, op);
    151167      }
    152 
    153       XmlNode initial = node.SelectSingleNode("InitialOperator");
    154       if (initial != null)
    155         myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);
     168      reader.ReadEndElement();
     169      if(reader.IsStartElement()) {
     170        myInitialOperator = (IOperator)PersistenceManager.Restore(reader, "InitialOperator", restoredObjects);
     171      }
    156172    }
    157173    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGroup.cs

    r119 r125  
    110110      writer.WriteEndElement(); // </Operators>
    111111    }
    112     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    113       base.Populate(node, restoredObjects);
    114       myName = node.Attributes["Name"].Value;
    115       XmlNode subGroupsNode = node.SelectSingleNode("SubGroups");
    116       foreach (XmlNode subGroupNode in subGroupsNode.ChildNodes)
    117         AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects));
    118       XmlNode operatorsNode = node.SelectSingleNode("Operators");
    119       foreach (XmlNode operatorNode in operatorsNode.ChildNodes)
    120         AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects));
     112    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     113    //  base.Populate(node, restoredObjects);
     114    //  myName = node.Attributes["Name"].Value;
     115    //  XmlNode subGroupsNode = node.SelectSingleNode("SubGroups");
     116    //  foreach(XmlNode subGroupNode in subGroupsNode.ChildNodes)
     117    //    AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects));
     118    //  XmlNode operatorsNode = node.SelectSingleNode("Operators");
     119    //  foreach(XmlNode operatorNode in operatorsNode.ChildNodes)
     120    //    AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects));
     121    //}
     122    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     123      myName = reader["Name"];
     124      base.Populate(reader, restoredObjects);
     125      reader.Read();
     126      if(reader.Name != "SubGroups") throw new XmlException("Expected: \"SubGroups\", found: \"" + reader.Name + "\"");
     127      if(!reader.IsEmptyElement) {
     128        reader.Read();
     129        while(reader.IsStartElement()) {
     130          AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects));
     131          reader.Skip();
     132        }
     133        reader.ReadEndElement();
     134      } else {
     135        reader.Read();
     136      }
     137      if(reader.Name != "Operators") throw new XmlException("Expected: \"Operators\", found: \"" + reader.Name + "\"");
     138      if(!reader.IsEmptyElement) {
     139        reader.Read();
     140        while(reader.IsStartElement()) {
     141          AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
     142          reader.Skip();
     143        }
     144        reader.ReadEndElement();
     145      } else {
     146        reader.Read();
     147      }
    121148    }
    122149    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorLibrary.cs

    r119 r125  
    6060      PersistenceManager.Persist("OperatorGroup", Group, writer, persistedObjects);
    6161    }
    62     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    63       base.Populate(node, restoredObjects);
    64       myGroup = (IOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("OperatorGroup"), restoredObjects);
     62    public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
     63      base.Populate(reader, restoredObjects);
     64      reader.Read();
     65      myGroup = (IOperatorGroup)PersistenceManager.Restore(reader, "OperatorGroup", restoredObjects);
     66      reader.Read();
    6567    }
    6668    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/PersistenceManager.cs

    r119 r125  
    5757    }
    5858
    59     public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    60       Guid guid = new Guid(node.Attributes["GUID"].Value);
    61       if (restoredObjects.ContainsKey(guid)) {
     59    public static IStorable Restore(XmlReader reader, string elementName, IDictionary<Guid, IStorable> restoredObjects) {
     60      reader = reader.ReadSubtree();
     61      reader.Read();
     62      if(reader.Name != elementName) throw new XmlException("Expected: \"" + elementName + "\" found: \"" + reader.Name+"\"");
     63      IStorable result = RestoreElement(reader, restoredObjects);
     64      reader.Read();
     65      reader.Close();
     66      return result;
     67    }
     68
     69    public static IStorable Restore(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     70      reader = reader.ReadSubtree();
     71      reader.Read();
     72      IStorable result = RestoreElement(reader, restoredObjects);
     73      reader.Read();
     74      reader.Close();
     75      return result;
     76    }
     77    private static IStorable RestoreElement(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     78      Guid guid = new Guid(reader["GUID"]);
     79      if(restoredObjects.ContainsKey(guid)) {       
    6280        return restoredObjects[guid];
    6381      } else {
    64         Type type = Type.GetType(node.Attributes["Type"].Value, true);
     82        Type type = Type.GetType(reader["Type"], true);
    6583        IStorable instance = (IStorable)Activator.CreateInstance(type);
    6684        restoredObjects.Add(guid, instance);
    67         instance.Populate(node, restoredObjects);
     85        instance.Populate(reader, restoredObjects);
    6886        return instance;
    6987      }
     
    89107    }
    90108    public static IStorable Load(Stream stream) {
    91       XmlDocument doc = new XmlDocument();
    92       doc.Load(stream);
    93       return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
     109      XmlReaderSettings settings = new XmlReaderSettings();
     110      settings.IgnoreComments = true;
     111      settings.IgnoreWhitespace = true;
     112      XmlReader reader = XmlReader.Create(stream, settings);
     113      reader.MoveToContent(); // read "<?xml version="1.0"?/>
     114      return PersistenceManager.RestoreElement(reader, new Dictionary<Guid, IStorable>());
    94115    }
    95116
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/Scope.cs

    r119 r125  
    311311      writer.WriteEndElement(); // </SubScopes>
    312312    }
    313     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    314       base.Populate(node, restoredObjects);
    315       myName = node.Attributes["Name"].Value;
    316 
    317       XmlNode variables = node.SelectSingleNode("Variables");
    318       foreach (XmlNode variableNode in variables.ChildNodes) {
    319         IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects);
    320         AddVariable(variable);
    321       }
    322 
    323       XmlNode aliases = node.SelectSingleNode("Aliases");
    324       if (aliases != null) {
    325         foreach (XmlNode aliasNode in aliases.ChildNodes)
    326           AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value);
    327       }
    328 
    329       XmlNode subScopes = node.SelectSingleNode("SubScopes");
    330       for (int i = 0; i < subScopes.ChildNodes.Count; i++) {
    331         IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects);
    332         AddSubScope(scope);
     313    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     314    //  base.Populate(node, restoredObjects);
     315    //  myName = node.Attributes["Name"].Value;
     316
     317    //  XmlNode variables = node.SelectSingleNode("Variables");
     318    //  foreach(XmlNode variableNode in variables.ChildNodes) {
     319    //    IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects);
     320    //    AddVariable(variable);
     321    //  }
     322
     323    //  XmlNode aliases = node.SelectSingleNode("Aliases");
     324    //  if(aliases != null) {
     325    //    foreach(XmlNode aliasNode in aliases.ChildNodes)
     326    //      AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value);
     327    //  }
     328
     329    //  XmlNode subScopes = node.SelectSingleNode("SubScopes");
     330    //  for(int i = 0; i < subScopes.ChildNodes.Count; i++) {
     331    //    IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects);
     332    //    AddSubScope(scope);
     333    //  }
     334    //}
     335    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     336      myName = reader["Name"];
     337      base.Populate(reader, restoredObjects);
     338      reader.Read();
     339      if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\", found: \""+reader.Name+"\"");
     340      if(!reader.IsEmptyElement) {
     341        reader.Read();
     342        while(reader.IsStartElement()) {
     343          IVariable variable = (IVariable)PersistenceManager.Restore(reader, restoredObjects);
     344          reader.Skip();
     345          AddVariable(variable);
     346        }
     347        reader.ReadEndElement();
     348      } else {
     349        reader.Read();
     350      }
     351      if(reader.Name == "Aliases" && !reader.IsEmptyElement) {
     352        reader.Read();
     353        while(reader.IsStartElement()) {
     354          AddAlias(reader["Alias"], reader["Name"]);
     355        }
     356        reader.ReadEndElement();
     357      } else {
     358        reader.Read();
     359      }
     360      if(reader.Name != "SubScopes") throw new XmlException("Expected: \"SubScopes\", found: \"" + reader.Name + "\"");
     361      if(!reader.IsEmptyElement) {
     362        reader.Read();
     363        while(reader.IsStartElement()) {
     364          IScope scope = (IScope)PersistenceManager.Restore(reader, restoredObjects);
     365          reader.Skip();
     366          AddSubScope(scope);
     367        }
     368        reader.ReadEndElement();
     369      } else {
     370        reader.Read();
    333371      }
    334372    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/StorableBase.cs

    r119 r125  
    5959      writer.WriteAttributeString("GUID", Guid.ToString());
    6060    }
    61     public virtual void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    62       myGuid = new Guid(node.Attributes["GUID"].Value);
     61    public virtual void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
     62      myGuid = new Guid(reader["GUID"]);
    6363    }
    6464  }
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/Variable.cs

    r119 r125  
    115115        PersistenceManager.Persist("Value", Value, writer, persistedObjects);
    116116    }
    117     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    118       myName = node.Attributes["Name"].Value;
    119       XmlNode valueNode = node.SelectSingleNode("Value");
    120       if (valueNode != null)
    121         myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects);
     117    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     118    //  myName = node.Attributes["Name"].Value;
     119    //  XmlNode valueNode = node.SelectSingleNode("Value");
     120    //  if(valueNode != null)
     121    //    myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects);
     122    //}
     123    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     124      myName = reader["Name"];
     125      reader.Read();
     126      if(reader.IsStartElement())
     127        myValue = (IItem)PersistenceManager.Restore(reader, "Value", restoredObjects);
    122128    }
    123129    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Core/VariableInfo.cs

    r119 r125  
    146146      writer.WriteAttributeString("Local", Local.ToString());
    147147    }
    148     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    149       myActualName = node.Attributes["ActualName"].Value;
    150       myFormalName = node.Attributes["FormalName"].Value;
    151       myDescription = node.Attributes["Description"].Value;
    152       myDataType = Type.GetType(node.Attributes["DataType"].Value, true);
    153       myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value);
    154       myLocal = bool.Parse(node.Attributes["Local"].Value);
     148    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     149    //  myActualName = node.Attributes["ActualName"].Value;
     150    //  myFormalName = node.Attributes["FormalName"].Value;
     151    //  myDescription = node.Attributes["Description"].Value;
     152    //  myDataType = Type.GetType(node.Attributes["DataType"].Value, true);
     153    //  myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value);
     154    //  myLocal = bool.Parse(node.Attributes["Local"].Value);
     155    //}
     156    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     157      myActualName = reader["ActualName"];
     158      myFormalName = reader["FormalName"];
     159      myDescription = reader["Description"];
     160      myDataType = Type.GetType(reader["DataType"], true);
     161      myKind = (VariableKind)Enum.Parse(typeof(VariableKind), reader["Kind"]);
     162      myLocal = bool.Parse(reader["Local"]);
    155163    }
    156164    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolArrayData.cs

    r119 r125  
    5353      writer.WriteValue(ToString());
    5454    }
    55     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    56       base.Populate(node, restoredObjects);
    57       string[] tokens = node.InnerText.Split(';');
     55    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     56    //  base.Populate(node, restoredObjects);
     57    //  string[] tokens = node.InnerText.Split(';');
     58    //  bool[] data = new bool[tokens.Length];
     59    //  for(int i = 0; i < data.Length; i++)
     60    //    data[i] = bool.Parse(tokens[i]);
     61    //  Data = data;
     62    //}
     63    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     64      base.Populate(reader, restoredObjects);
     65      string[] tokens = reader.ReadString().Split(';');
    5866      bool[] data = new bool[tokens.Length];
    59       for (int i = 0; i < data.Length; i++)
     67      for(int i = 0; i < data.Length; i++)
    6068        data[i] = bool.Parse(tokens[i]);
    6169      Data = data;
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolData.cs

    r119 r125  
    6060      writer.WriteValue(ToString());
    6161    }
    62     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    63       base.Populate(node, restoredObjects);
    64       Data = bool.Parse(node.InnerText);
     62    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     63    //  base.Populate(node, restoredObjects);
     64    //  Data = bool.Parse(node.InnerText);
     65    //}
     66    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     67      base.Populate(reader, restoredObjects);
     68      Data = bool.Parse(reader.ReadString());
    6569    }
    6670
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolMatrixData.cs

    r119 r125  
    6262      writer.WriteValue(ToString());
    6363    }
    64 
    65     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    66       base.Populate(node, restoredObjects);
    67       int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    68       int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    69       string[] tokens = node.InnerText.Split(';');
     64    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     65    //  base.Populate(node, restoredObjects);
     66    //  int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
     67    //  int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
     68    //  string[] tokens = node.InnerText.Split(';');
     69    //  bool[,] data = new bool[dim1, dim2];
     70    //  for(int i = 0; i < dim1; i++) {
     71    //    for(int j = 0; j < dim2; j++) {
     72    //      data[i, j] = bool.Parse(tokens[i * dim2 + j]);
     73    //    }
     74    //  }
     75    //  Data = data;
     76    //}
     77    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     78      base.Populate(reader, restoredObjects);
     79      int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat);
     80      int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat);
     81      string[] tokens = reader.ReadString().Split(';');
    7082      bool[,] data = new bool[dim1, dim2];
    71       for (int i = 0; i < dim1; i++) {
    72         for (int j = 0; j < dim2; j++) {
     83      for(int i = 0; i < dim1; i++) {
     84        for(int j = 0; j < dim2; j++) {
    7385          data[i, j] = bool.Parse(tokens[i * dim2 + j]);
    7486        }
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedDoubleData.cs

    r119 r125  
    6565      PersistenceManager.Persist("Value", (DoubleData)base.Data, writer, persistedObjects);
    6666    }
    67     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    68       base.Populate(node, restoredObjects);
    69       base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects);
     67    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     68    //  base.Populate(node, restoredObjects);
     69    //  base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects);
     70    //}
     71    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     72      base.Populate(reader, restoredObjects);
     73      base.Data = (DoubleData)PersistenceManager.Restore(reader, "Value", restoredObjects);
     74      reader.Read();
    7075    }
    7176
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedIntData.cs

    r119 r125  
    6565      PersistenceManager.Persist("Value", (IntData)base.Data, writer, persistedObjects);
    6666    }
    67     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    68       base.Populate(node, restoredObjects);
    69       base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects);
     67    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     68    //  base.Populate(node, restoredObjects);
     69    //  base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects);
     70    //}
     71    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     72      base.Populate(reader, restoredObjects);
     73      base.Data = (IntData)PersistenceManager.Restore(reader, "Value", restoredObjects);
     74      reader.Read();
    7075    }
    7176
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedItemList.cs

    r119 r125  
    7575    }
    7676
    77     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    78       base.Populate(node, restoredObjects);
    79       XmlNode listNode = node.SelectSingleNode("ListItems");
     77    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     78    //  base.Populate(node, restoredObjects);
     79    //  XmlNode listNode = node.SelectSingleNode("ListItems");
     80    //  list = new List<IItem>();
     81    //  for(int i = 0; i < listNode.ChildNodes.Count; i++)
     82    //    list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects));
     83    //  suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value);
     84    //}
     85    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     86      base.Populate(reader, restoredObjects);
     87      if(reader.Name!="ListItems") throw new XmlException("Expected: \"ListItems\", found: \""+reader.Name+"\"");
     88      suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]);
    8089      list = new List<IItem>();
    81       for (int i = 0; i < listNode.ChildNodes.Count; i++)
    82         list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects));
    83       suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value);
     90      if(!reader.IsEmptyElement) {
     91        while(reader.IsStartElement()) {
     92          list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects));
     93          reader.Skip();
     94        }
     95        reader.ReadEndElement();
     96      } else {
     97        reader.Read();
     98      }
    8499    }
    85100    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleArrayData.cs

    r119 r125  
    5454      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5555    }
    56     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    57       base.Populate(node, restoredObjects);
    58       string[] tokens = node.InnerText.Split(';');
     56    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     57    //  base.Populate(node, restoredObjects);
     58    //  string[] tokens = node.InnerText.Split(';');
     59    //  double[] data = new double[tokens.Length];
     60    //  for(int i = 0; i < data.Length; i++)
     61    //    if(double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) {
     62    //      throw new FormatException("Can't parse " + tokens[i] + " as double value.");
     63    //    }
     64    //  Data = data;
     65    //}
     66    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     67      base.Populate(reader, restoredObjects);
     68      string[] tokens = reader.ReadString().Split(';');
    5969      double[] data = new double[tokens.Length];
    6070      for(int i = 0; i < data.Length; i++)
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleData.cs

    r119 r125  
    6161      writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat));
    6262    }
    63     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    64       base.Populate(node, restoredObjects);
     63    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     64    //  base.Populate(node, restoredObjects);
     65    //  double data;
     66    //  if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {
     67    //    Data = data;
     68    //  } else {
     69    //    throw new FormatException("Can't parse " + node.InnerText + " as double value.");
     70    //  }
     71    //}
     72    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     73      base.Populate(reader, restoredObjects);
    6574      double data;
    66       if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {
     75      string token = reader.ReadString();
     76      if(double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {
    6777        Data = data;
    6878      } else {
    69         throw new FormatException("Can't parse " + node.InnerText + " as double value.");       
     79        throw new FormatException("Can't parse " + token + " as double value.");
    7080      }
    7181    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleMatrixData.cs

    r119 r125  
    6262      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    6363    }
    64     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    65       base.Populate(node, restoredObjects);
    66       int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    67       int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    68       string[] tokens = node.InnerText.Split(';');
     64    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     65    //  base.Populate(node, restoredObjects);
     66    //  int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
     67    //  int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
     68    //  string[] tokens = node.InnerText.Split(';');
     69    //  double[,] data = new double[dim1, dim2];
     70    //  for(int i = 0; i < dim1; i++) {
     71    //    for(int j = 0; j < dim2; j++) {
     72    //      if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) {
     73    //        throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value.");
     74    //      }
     75    //    }
     76    //  }
     77    //  Data = data;
     78    //}
     79    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     80      base.Populate(reader, restoredObjects);
     81      int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat);
     82      int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat);
     83      string[] tokens = reader.ReadString().Split(';');
    6984      double[,] data = new double[dim1, dim2];
    70       for (int i = 0; i < dim1; i++) {
    71         for (int j = 0; j < dim2; j++) {
    72           if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j])==false) {
     85      for(int i = 0; i < dim1; i++) {
     86        for(int j = 0; j < dim2; j++) {
     87          if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) {
    7388            throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value.");
    7489          }
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/IntArrayData.cs

    r119 r125  
    5454      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5555    }
    56     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    57       base.Populate(node, restoredObjects);
    58       if (!node.InnerText.Equals("")) {
    59         string[] tokens = node.InnerText.Split(';');
     56    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     57    //  base.Populate(node, restoredObjects);
     58    //  if(!node.InnerText.Equals("")) {
     59    //    string[] tokens = node.InnerText.Split(';');
     60    //    int[] data = new int[tokens.Length];
     61    //    for(int i = 0; i < data.Length; i++)
     62    //      data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat);
     63    //    Data = data;
     64    //  }
     65    //}
     66    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     67      base.Populate(reader, restoredObjects);
     68      string innerText = reader.ReadString();
     69      if(!innerText.Equals("")) {
     70        string[] tokens = innerText.Split(';');
    6071        int[] data = new int[tokens.Length];
    61         for (int i = 0; i < data.Length; i++)
     72        for(int i = 0; i < data.Length; i++)
    6273          data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat);
    6374        Data = data;
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/IntData.cs

    r119 r125  
    6161      writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat));
    6262    }
    63     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    64       base.Populate(node, restoredObjects);
    65       Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat);
     63    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     64    //  base.Populate(node, restoredObjects);
     65    //  Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat);
     66    //}
     67    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     68      base.Populate(reader, restoredObjects);
     69      Data = int.Parse(reader.ReadString(), CultureInfo.InvariantCulture.NumberFormat);
    6670    }
    6771
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/IntMatrixData.cs

    r119 r125  
    6262      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    6363    }
    64     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    65       base.Populate(node, restoredObjects);
    66       int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    67       int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    68       string[] tokens = node.InnerText.Split(';');
     64    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     65    //  base.Populate(node, restoredObjects);
     66    //  int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
     67    //  int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
     68    //  string[] tokens = node.InnerText.Split(';');
     69    //  int[,] data = new int[dim1, dim2];
     70    //  for(int i = 0; i < dim1; i++) {
     71    //    for(int j = 0; j < dim2; j++) {
     72    //      data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat);
     73    //    }
     74    //  }
     75    //  Data = data;
     76    //}
     77    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     78      base.Populate(reader, restoredObjects);
     79      int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat);
     80      int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat);
     81      string[] tokens = reader.ReadString().Split(';');
     82
    6983      int[,] data = new int[dim1, dim2];
    70       for (int i = 0; i < dim1; i++) {
    71         for (int j = 0; j < dim2; j++) {
     84      for(int i = 0; i < dim1; i++) {
     85        for(int j = 0; j < dim2; j++) {
    7286          data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat);
    7387        }
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/ItemList_T.cs

    r119 r125  
    6161        PersistenceManager.Persist(list[i], writer, persistedObjects);
    6262    }
    63     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    64       base.Populate(node, restoredObjects);
    65       for (int i = 0; i < node.ChildNodes.Count; i++)
    66         list.Add((T) PersistenceManager.Restore(node.ChildNodes[i], restoredObjects));
     63    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     64    //  base.Populate(node, restoredObjects);
     65    //  for(int i = 0; i < node.ChildNodes.Count; i++)
     66    //    list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects));
     67    //}
     68    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     69      base.Populate(reader, restoredObjects);
     70      if(!reader.IsEmptyElement) {
     71        reader.Read();
     72        while(reader.IsStartElement()) {
     73          list.Add((T)PersistenceManager.Restore(reader, restoredObjects));
     74          reader.Skip();
     75        }
     76        reader.ReadEndElement();
     77      } else {
     78        reader.Read();
     79      }
    6780    }
    6881
  • branches/XmlReaderWriterBranch/HeuristicLab.Data/StringData.cs

    r119 r125  
    6060      writer.WriteValue(Data);
    6161    }
    62     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    63       base.Populate(node, restoredObjects);
    64       Data = node.InnerText;
     62    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     63    //  base.Populate(node, restoredObjects);
     64    //  Data = node.InnerText;
     65    //}
     66    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     67      base.Populate(reader, restoredObjects);
     68      Data = reader.ReadString();
    6569    }
    6670
  • branches/XmlReaderWriterBranch/HeuristicLab.DataAnalysis/Dataset.cs

    r119 r125  
    149149    }
    150150
    151     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    152       base.Populate(node, restoredObjects);
    153       Name = node.Attributes["Name"].Value;
    154       rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    155       columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    156      
    157       VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
    158 
    159       string[] tokens = node.InnerText.Split(';');
     151    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     152    //  base.Populate(node, restoredObjects);
     153    //  Name = node.Attributes["Name"].Value;
     154    //  rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
     155    //  columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
     156
     157    //  VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
     158
     159    //  string[] tokens = node.InnerText.Split(';');
     160    //  if(tokens.Length != rows * columns) throw new FormatException();
     161    //  samples = new double[rows * columns];
     162    //  for(int row = 0; row < rows; row++) {
     163    //    for(int column = 0; column < columns; column++) {
     164    //      if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) {
     165    //        throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value.");
     166    //      }
     167    //    }
     168    //  }
     169    //  CreateDictionaries();
     170    //}
     171    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     172      base.Populate(reader, restoredObjects);
     173      Name = reader["Name"];
     174      rows = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat);
     175      columns = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat);
     176      VariableNames = ParseVariableNamesString(reader["VariableNames"]);
     177      string[] tokens = reader.ReadString().Split(';');
     178
    160179      if(tokens.Length != rows * columns) throw new FormatException();
    161180      samples = new double[rows * columns];
    162181      for(int row = 0; row < rows; row++) {
    163182        for(int column = 0; column < columns; column++) {
    164           if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row*columns + column]) == false) {
     183          if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) {
    165184            throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value.");
    166185          }
  • branches/XmlReaderWriterBranch/HeuristicLab.DistributedEngine/DistributedEngine.cs

    r119 r125  
    192192      writer.WriteAttributeString("ServerAddress", ServerAddress);
    193193    }
    194     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    195       base.Populate(node, restoredObjects);
    196       ServerAddress = node.Attributes["ServerAddress"].Value;
     194    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     195    //  base.Populate(node, restoredObjects);
     196    //  ServerAddress = node.Attributes["ServerAddress"].Value;
     197    //}
     198    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     199      ServerAddress = reader["ServerAddress"];
     200      base.Populate(reader, restoredObjects);
    197201    }
    198202    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.ES/ES.cs

    r119 r125  
    610610      PersistenceManager.Persist("Engine", Engine, writer, persistedObjects);
    611611    }
    612     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    613       base.Populate(node, restoredObjects);
    614       myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     612    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     613    //  base.Populate(node, restoredObjects);
     614    //  myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     615    //  SetReferences();
     616    //}
     617    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     618      base.Populate(reader, restoredObjects);
     619      reader.Read();
     620      myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects);
    615621      SetReferences();
     622      reader.Read();
    616623    }
    617624    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Functions/Constant.cs

    r2 r125  
    7373
    7474
    75     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    76       base.Populate(node, restoredObjects);
     75    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     76    //  base.Populate(node, restoredObjects);
    7777
     78    //  value = GetVariable("Value");
     79    //}
     80    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     81      base.Populate(reader, restoredObjects);
    7882      value = GetVariable("Value");
    7983    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Functions/FunctionBase.cs

    r119 r125  
    320320    }
    321321
    322     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    323       base.Populate(node, restoredObjects);
    324       XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate");
    325       if (functionTemplateNode != null) {
    326         metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects);
     322    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     323    //  base.Populate(node, restoredObjects);
     324    //  XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate");
     325    //  if(functionTemplateNode != null) {
     326    //    metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects);
     327    //  } else {
     328    //    metaObject = this;
     329    //  }
     330    //  // don't need to explicitly load the sub-functions because that has already been done in OperatorBase.Populate()
     331
     332    //  // load local variables
     333    //  XmlNode variablesNode = node.SelectSingleNode("LocalVariables");
     334
     335    //  // remove the variables that have been added in a constructor
     336    //  variables.Clear();
     337    //  // load the persisted variables
     338    //  foreach(XmlNode variableNode in variablesNode.ChildNodes)
     339    //    variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
     340    //}
     341    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     342      base.Populate(reader, restoredObjects);
     343      if(reader.Name == "FunctionTemplate") {
     344        reader.Read();
     345        metaObject = (FunctionBase)PersistenceManager.Restore(reader, restoredObjects);
     346        reader.Read();
     347        reader.ReadEndElement();
    327348      } else {
    328349        metaObject = this;
     
    331352
    332353      // load local variables
    333       XmlNode variablesNode = node.SelectSingleNode("LocalVariables");
    334      
     354      if(reader.Name!="LocalVariables") throw new XmlException("Expected: \"LocalVariables\", found: \""+reader.Name+"\"");
    335355      // remove the variables that have been added in a constructor
    336356      variables.Clear();
    337357      // load the persisted variables
    338       foreach (XmlNode variableNode in variablesNode.ChildNodes)
    339         variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
     358      if(!reader.IsEmptyElement) {
     359        reader.Read();
     360        while(reader.IsStartElement()) {
     361          variables.Add((IVariable)PersistenceManager.Restore(reader, restoredObjects));
     362          reader.Skip();
     363        }
     364        reader.ReadEndElement();
     365      } else {
     366        reader.Read();
     367      }
    340368    }
    341369
  • branches/XmlReaderWriterBranch/HeuristicLab.Functions/Variable.cs

    r2 r125  
    2828using HeuristicLab.Constraints;
    2929using HeuristicLab.DataAnalysis;
     30using System.Xml;
    3031
    3132namespace HeuristicLab.Functions {
     
    9495    }
    9596
    96     public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    97       base.Populate(node, restoredObjects);
     97    //public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     98    //  base.Populate(node, restoredObjects);
    9899
     100    //  variable = (ConstrainedIntData)GetVariable("Variable").Value;
     101    //  weight = (ConstrainedDoubleData)GetVariable("Weight").Value;
     102    //  sampleOffset = (ConstrainedIntData)GetVariable("SampleOffset").Value;
     103    //}
     104    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     105      base.Populate(reader, restoredObjects);
    99106      variable = (ConstrainedIntData)GetVariable("Variable").Value;
    100107      weight = (ConstrainedDoubleData)GetVariable("Weight").Value;
  • branches/XmlReaderWriterBranch/HeuristicLab.Grid/ProcessingEngine.cs

    r119 r125  
    5656    }
    5757
    58     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    59       base.Populate(node, restoredObjects);
    60       initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects);
     58    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     59    //  base.Populate(node, restoredObjects);
     60    //  initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects);
     61    //}
     62    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     63      base.Populate(reader, restoredObjects);
     64      reader.Read();
     65      initialOperation = (AtomicOperation)PersistenceManager.Restore(reader, "InitialOperation", restoredObjects);
     66      reader.Read();
    6167    }
    6268
  • branches/XmlReaderWriterBranch/HeuristicLab.Logging/Linechart.cs

    r119 r125  
    9494      PersistenceManager.Persist("Values", Values, writer, persistedObjects);
    9595    }
    96     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    97       base.Populate(node, restoredObjects);
    98       myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects);
    99       myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects);
     96    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     97    //  base.Populate(node, restoredObjects);
     98    //  myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects);
     99    //  myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects);
     100    //}
     101    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     102      base.Populate(reader, restoredObjects);
     103      reader.Read();
     104      myNumberOfLines = (IntData)PersistenceManager.Restore(reader, "NumberOfLines", restoredObjects);
     105      reader.Skip();
     106      myValues = (ItemList)PersistenceManager.Restore(reader, "Values", restoredObjects);
     107      reader.Read();
    100108    }
    101109    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Logging/Log.cs

    r119 r125  
    6868      PersistenceManager.Persist("Items", Items, writer, persistedObjects);
    6969    }
    70     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    71       base.Populate(node, restoredObjects);
    72       myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects);
     70    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     71    //  base.Populate(node, restoredObjects);
     72    //  myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects);
     73    //}
     74    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     75      base.Populate(reader, restoredObjects);
     76      reader.Read();
     77      myItems = (ItemList)PersistenceManager.Restore(reader, "Items", restoredObjects);
     78      reader.Read();
    7379    }
    7480    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs

    r119 r125  
    211211      writer.WriteEndElement();
    212212    }
    213     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    214       base.Populate(node, restoredObjects);
    215       XmlNode descriptionNode = node.SelectSingleNode("Description");
    216       myDescription = descriptionNode.InnerText;
    217       XmlNode codeNode = node.SelectSingleNode("Code");
    218       myCode = codeNode.InnerText;
     213    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     214    //  base.Populate(node, restoredObjects);
     215    //  XmlNode descriptionNode = node.SelectSingleNode("Description");
     216    //  myDescription = descriptionNode.InnerText;
     217    //  XmlNode codeNode = node.SelectSingleNode("Code");
     218    //  myCode = codeNode.InnerText;
     219    //}
     220    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     221      base.Populate(reader, restoredObjects);
     222      myDescription = reader.ReadElementString("Description");
     223      myCode = reader.ReadElementString("Code");
    219224    }
    220225    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Operators/CombinedOperator.cs

    r119 r125  
    103103      PersistenceManager.Persist("OperatorGraph", OperatorGraph, writer, persistedObjects);
    104104    }
    105     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    106       base.Populate(node, restoredObjects);
    107       XmlNode descriptionNode = node.SelectSingleNode("Description");
    108       if (descriptionNode != null) myDescription = descriptionNode.InnerText;
    109       myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);
     105    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     106    //  base.Populate(node, restoredObjects);
     107    //  XmlNode descriptionNode = node.SelectSingleNode("Description");
     108    //  if(descriptionNode != null) myDescription = descriptionNode.InnerText;
     109    //  myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);
     110    //}
     111    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     112      base.Populate(reader, restoredObjects);
     113      myDescription = reader.ReadElementString("Description");
     114      myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects);
     115      reader.Read();
    110116    }
    111117    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Random/MersenneTwister.cs

    r119 r125  
    148148      writer.WriteEndElement(); // </Init>
    149149    }
    150     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    151       base.Populate(node, restoredObjects);
    152 
    153       string stateString = node.SelectSingleNode("State").InnerText;
     150    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     151    //  base.Populate(node, restoredObjects);
     152
     153    //  string stateString = node.SelectSingleNode("State").InnerText;
     154    //  string[] tokens = stateString.Split(';');
     155    //  for(int i = 0; i < tokens.Length; i++)
     156    //    state[i] = uint.Parse(tokens[i]);
     157    //  p = int.Parse(node.SelectSingleNode("P").InnerText);
     158    //  init = bool.Parse(node.SelectSingleNode("Init").InnerText);
     159    //}
     160    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     161      base.Populate(reader, restoredObjects);
     162      reader.Read();
     163      string stateString = reader.ReadElementString("State");
    154164      string[] tokens = stateString.Split(';');
    155165      for(int i = 0; i < tokens.Length; i++)
    156166        state[i] = uint.Parse(tokens[i]);
    157       p = int.Parse(node.SelectSingleNode("P").InnerText);
    158       init = bool.Parse(node.SelectSingleNode("Init").InnerText);
     167      p = int.Parse(reader.ReadElementString("P"));
     168      init = bool.Parse(reader.ReadElementString("Init"));
    159169    }
    160170    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Random/NormalDistributedRandom.cs

    r119 r125  
    539539    }
    540540
    541     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    542       base.Populate(node, restoredObjects);
    543 
    544       mu = double.Parse(node.SelectSingleNode("Mu").InnerText);
    545       sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText);
    546       uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects);
     541    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     542    //  base.Populate(node, restoredObjects);
     543
     544    //  mu = double.Parse(node.SelectSingleNode("Mu").InnerText);
     545    //  sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText);
     546    //  uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects);
     547    //}
     548    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     549      base.Populate(reader, restoredObjects);
     550      mu = double.Parse(reader.ReadElementString("Mu"));
     551      sigma = double.Parse(reader.ReadElementString("Sigma"));
     552      uniform = (IRandom)PersistenceManager.Restore(reader, "UniformRandom", restoredObjects);
     553      reader.Read();
    547554    }
    548555
  • branches/XmlReaderWriterBranch/HeuristicLab.Routing.TSP/TSPTour.cs

    r119 r125  
    8383      PersistenceManager.Persist("Tour", Tour, writer, persistedObjects);
    8484    }
    85     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    86       base.Populate(node, restoredObjects);
    87       myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects);
    88       myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects);
     85    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     86    //  base.Populate(node, restoredObjects);
     87    //  myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects);
     88    //  myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects);
     89    //}
     90    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     91      base.Populate(reader, restoredObjects);
     92      reader.Read();
     93      myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(reader, "Coordinates", restoredObjects);
     94      reader.Skip();
     95      myTour = (Permutation.Permutation)PersistenceManager.Restore(reader, "Tour", restoredObjects);
     96      reader.Read();
    8997    }
    9098    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.SGA/SGA.cs

    r119 r125  
    515515      PersistenceManager.Persist("Engine", Engine, writer, persistedObjects);
    516516    }
    517     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    518       base.Populate(node, restoredObjects);
    519       myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     517    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     518    //  base.Populate(node, restoredObjects);
     519    //  myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects);
     520    //  SetReferences();
     521    //}
     522    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     523      base.Populate(reader, restoredObjects);
     524      reader.Read();
     525      myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects);
    520526      SetReferences();
     527      reader.Read();
    521528    }
    522529    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs

    r119 r125  
    9494      PersistenceManager.Persist("Operations", operations, writer, persistedObjects);
    9595    }
    96     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    97       base.Populate(node, restoredObjects);
    98       operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects);
    99       jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects);
    100       machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects);
     96    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     97    //  base.Populate(node, restoredObjects);
     98    //  operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects);
     99    //  jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects);
     100    //  machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects);
     101    //}
     102    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     103      base.Populate(reader, restoredObjects);
     104      reader.Read();
     105      operations = (ItemList)PersistenceManager.Restore(reader, "Operations", restoredObjects);
     106      reader.Skip();
     107      jobs = (IntData)PersistenceManager.Restore(reader, "Jobs", restoredObjects);
     108      reader.Skip();
     109      machines = (IntData)PersistenceManager.Restore(reader, "Machines", restoredObjects);
     110      reader.Read();
    101111    }
    102112    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/Operation.cs

    r119 r125  
    159159    }
    160160
    161     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    162       base.Populate(node, restoredObjects);
    163       job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects);
    164       operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects);
    165       start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects);
    166       duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects);
    167       predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects);
    168       machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects);
     161    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     162    //  base.Populate(node, restoredObjects);
     163    //  job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects);
     164    //  operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects);
     165    //  start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects);
     166    //  duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects);
     167    //  predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects);
     168    //  machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects);
     169    //}
     170    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     171      base.Populate(reader, restoredObjects);
     172      reader.Read();
     173      job = (IntData)PersistenceManager.Restore(reader, "Job", restoredObjects);
     174      reader.Skip();
     175      operationIndex = (IntData)PersistenceManager.Restore(reader, "OperationIndex", restoredObjects);
     176      reader.Skip();
     177      start = (IntData)PersistenceManager.Restore(reader, "Start", restoredObjects);
     178      reader.Skip();
     179      duration = (IntData)PersistenceManager.Restore(reader, "Duration", restoredObjects);
     180      reader.Skip();
     181      predecessors = (ItemList)PersistenceManager.Restore(reader, "Predecessors", restoredObjects);
     182      reader.Skip();
     183      machines = (IntArrayData)PersistenceManager.Restore(reader, "Machines", restoredObjects);
     184      reader.Read();
    169185    }
    170186
  • branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs

    r119 r125  
    8383    }
    8484
    85     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    86       base.Populate(node, restoredObjects);
    87       int machines = int.Parse(node.Attributes["Machines"].Value);
     85    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     86    //  base.Populate(node, restoredObjects);
     87    //  int machines = int.Parse(node.Attributes["Machines"].Value);
     88    //  schedule = new ScheduleTree[machines];
     89    //  for(int i = 0; i < machines; i++) {
     90    //    schedule[i] = (ScheduleTree)PersistenceManager.Restore(node.SelectSingleNode("Machine" + i.ToString()), restoredObjects);
     91    //  }
     92    //}
     93    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     94      int machines = int.Parse(reader["Machines"]);
     95      base.Populate(reader, restoredObjects);
    8896      schedule = new ScheduleTree[machines];
    8997      for(int i = 0; i < machines; i++) {
    90         schedule[i] = (ScheduleTree)PersistenceManager.Restore(node.SelectSingleNode("Machine" + i.ToString()), restoredObjects);
     98        schedule[i] = (ScheduleTree)PersistenceManager.Restore(reader, "Machine" + i.ToString(), restoredObjects);
     99        reader.Skip();
    91100      }
    92101    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs

    r119 r125  
    7676        PersistenceManager.Persist("Schedule", schedule, writer, persistedObjects);
    7777    }
    78     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    79       base.Populate(node, restoredObjects);
    80       XmlNode scheduleNode = node.SelectSingleNode("Schedule");
    81       if(scheduleNode != null) {
    82         schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects);
     78    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     79    //  base.Populate(node, restoredObjects);
     80    //  XmlNode scheduleNode = node.SelectSingleNode("Schedule");
     81    //  if(scheduleNode != null) {
     82    //    schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects);
     83    //  }
     84    //}
     85    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     86      base.Populate(reader, restoredObjects);
     87
     88      if(reader.Name == "Schedule") {
     89        schedule = (Schedule)PersistenceManager.Restore(reader, "Schedule", restoredObjects);
     90        reader.Read();
    8391      }
    8492    }
  • branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs

    r119 r125  
    218218    }
    219219
    220     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    221       base.Populate(node, restoredObjects);
    222       string[] tokens = node.InnerText.Split(';');
     220    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     221    //  base.Populate(node, restoredObjects);
     222    //  string[] tokens = node.InnerText.Split(';');
     223    //  for(int i = 0; i < tokens.Length - 1; i++) {
     224    //    TimeSlot t = new TimeSlot(tokens[i]);
     225    //    if(t.job > -1) {
     226    //      this.InsertOperation(t);
     227    //    }
     228    //  }
     229    //}
     230    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     231      base.Populate(reader, restoredObjects);
     232      string[] tokens = reader.ReadString().Split(';');
    223233      for(int i = 0; i < tokens.Length - 1; i++) {
    224234        TimeSlot t = new TimeSlot(tokens[i]);
  • branches/XmlReaderWriterBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs

    r119 r125  
    7777    }
    7878
    79     public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    80       base.Populate(node, restoredObjects);
    81       group = (GPOperatorGroup) PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects);
     79    //public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     80    //  base.Populate(node, restoredObjects);
     81    //  group = (GPOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects);
     82    //}
     83    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     84      base.Populate(reader, restoredObjects);
     85      reader.Read();
     86      group = (GPOperatorGroup)PersistenceManager.Restore(reader, "Group", restoredObjects);
     87      reader.Read();
    8288    }
    8389    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab.ThreadParallelEngine/ThreadParallelEngine.cs

    r119 r125  
    187187      writer.WriteAttributeString("Workers", Workers.ToString());
    188188    }
    189     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    190       base.Populate(node, restoredObjects);
    191       myWorkers = int.Parse(node.Attributes["Workers"].Value);
     189    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
     190    //  base.Populate(node, restoredObjects);
     191    //  myWorkers = int.Parse(node.Attributes["Workers"].Value);
     192    //}
     193    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
     194      myWorkers = int.Parse(reader["Workers"]);
     195      base.Populate(reader, restoredObjects);
    192196    }
    193197    #endregion
  • branches/XmlReaderWriterBranch/HeuristicLab/UpdateLocalInstallation.cmd

    r45 r125  
    1 set target=C:\Program Files\HeuristicLab 3.0
     1set target=G:\Program Files\HeuristicLab 3.0
    22
    33copy "HeuristicLab.exe" "%target%"
Note: See TracChangeset for help on using the changeset viewer.