Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/15/08 14:17:26 (17 years ago)
Author:
gkronber
Message:

bug fixes to make loading of OSGA-TSP work. Some non-working code remains

Location:
branches/XmlTextReaderBranch/HeuristicLab.Data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedItemList.cs

    r121 r122  
    7777    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    7878      base.Populate(reader, restoredObjects);
    79       reader.ReadStartElement("ListItems");
     79      reader.Read();
     80      if(reader.Name!="ListItems") throw new XmlException("Expected: \"ListItems\", found: \""+reader.Name+"\"");
    8081      suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]);
    8182      list = new List<IItem>();
    82       while(reader.IsStartElement())
    83         list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects));
    84       reader.ReadEndElement();
     83      if(!reader.IsEmptyElement) {
     84        while(reader.IsStartElement()) {
     85          list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects));
     86          reader.Skip();
     87        }
     88        reader.ReadEndElement();
     89      } else {
     90        reader.Read();
     91      }
    8592    }
    8693    #endregion
  • branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleData.cs

    r121 r122  
    6969      base.Populate(reader, restoredObjects);
    7070      double data;
    71       if(double.TryParse(reader.ReadString(), NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {
     71      string token = reader.ReadString();
     72      if(double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {
    7273        Data = data;
    7374      } else {
    74         throw new FormatException("Can't parse " + reader.ReadString() + " as double value.");
     75        throw new FormatException("Can't parse " + token + " as double value.");
    7576      }
    7677    }
  • branches/XmlTextReaderBranch/HeuristicLab.Data/IntMatrixData.cs

    r121 r122  
    7474      int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat);
    7575      string[] tokens = reader.ReadString().Split(';');
     76
    7677      int[,] data = new int[dim1, dim2];
    7778      for(int i = 0; i < dim1; i++) {
  • branches/XmlTextReaderBranch/HeuristicLab.Data/ItemList_T.cs

    r121 r122  
    6363    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
    6464      base.Populate(reader, restoredObjects);
    65       while(reader.IsStartElement())
     65      reader.Read();
     66      while(reader.IsStartElement()) {
    6667        list.Add((T)PersistenceManager.Restore(reader, restoredObjects));
     68        reader.Skip();
     69      }
     70      reader.ReadEndElement();
    6771    }
    6872
Note: See TracChangeset for help on using the changeset viewer.