Free cookie consent management tool by TermsFeed Policy Generator

Changeset 119


Ignore:
Timestamp:
04/14/08 17:49:47 (17 years ago)
Author:
gkronber
Message:

created a branch that uses XmlTextWriter instead of XMLDocument to save documents. Investigating ticket #103.

Location:
branches/XmlTextWriterBranch
Files:
60 edited
1 copied

Legend:

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

    r2 r119  
    8484
    8585    #region persistence
    86     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    87       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    88       XmlNode subOperatorsNode = PersistenceManager.Persist("SubOperatorsGroupConstraint", groupConstraint, document, persistedObjects);
    89       node.AppendChild(subOperatorsNode);
     86    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     87    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     88    //  XmlNode subOperatorsNode = PersistenceManager.Persist("SubOperatorsGroupConstraint", groupConstraint, document, persistedObjects);
     89    //  node.AppendChild(subOperatorsNode);
    9090
    91       return node;
     91    //  return node;
     92    //}
     93    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     94      base.Persist(name, writer, persistedObjects);
     95      PersistenceManager.Persist("SubOperatorsGroupConstraint", groupConstraint, writer, persistedObjects);
    9296    }
    9397
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/AndConstraint.cs

    r40 r119  
    7373
    7474    #region persistence
    75     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    76       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    77       XmlNode clausesNode = PersistenceManager.Persist("Clauses", Clauses, document, persistedObjects);
    78       node.AppendChild(clausesNode);
     75    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     76    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     77    //  XmlNode clausesNode = PersistenceManager.Persist("Clauses", Clauses, document, persistedObjects);
     78    //  node.AppendChild(clausesNode);
    7979
    80       return node;
     80    //  return node;
     81    //}
     82    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     83      base.Persist(name, writer, persistedObjects);
     84      PersistenceManager.Persist("Clauses", Clauses, writer, persistedObjects);
    8185    }
    8286
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs

    r2 r119  
    132132
    133133    #region persistence
    134     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    135       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    136       XmlAttribute lb = document.CreateAttribute("LowerBound");
    137       lb.Value = LowerBound+"";
    138       XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
    139       lbi.Value = lowerBoundIncluded+"";
    140       XmlAttribute lbe = document.CreateAttribute("LowerBoundEnabled");
    141       lbe.Value = lowerBoundEnabled + "";
    142       XmlAttribute ub = document.CreateAttribute("UpperBound");
    143       ub.Value = upperBound + "";
    144       XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
    145       ubi.Value = upperBoundIncluded + "";
    146       XmlAttribute ube = document.CreateAttribute("UpperBoundEnabled");
    147       ube.Value = upperBoundEnabled + "";
    148       node.Attributes.Append(lb);
    149       if (!lowerBoundIncluded) node.Attributes.Append(lbi);
    150       if (!lowerBoundEnabled) node.Attributes.Append(lbe);
    151       node.Attributes.Append(ub);
    152       if (!upperBoundIncluded) node.Attributes.Append(ubi);
    153       if (!upperBoundEnabled) node.Attributes.Append(ube);
    154       return node;
     134    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     135    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     136    //  XmlAttribute lb = document.CreateAttribute("LowerBound");
     137    //  lb.Value = LowerBound+"";
     138    //  XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
     139    //  lbi.Value = lowerBoundIncluded+"";
     140    //  XmlAttribute lbe = document.CreateAttribute("LowerBoundEnabled");
     141    //  lbe.Value = lowerBoundEnabled + "";
     142    //  XmlAttribute ub = document.CreateAttribute("UpperBound");
     143    //  ub.Value = upperBound + "";
     144    //  XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
     145    //  ubi.Value = upperBoundIncluded + "";
     146    //  XmlAttribute ube = document.CreateAttribute("UpperBoundEnabled");
     147    //  ube.Value = upperBoundEnabled + "";
     148    //  node.Attributes.Append(lb);
     149    //  if (!lowerBoundIncluded) node.Attributes.Append(lbi);
     150    //  if (!lowerBoundEnabled) node.Attributes.Append(lbe);
     151    //  node.Attributes.Append(ub);
     152    //  if (!upperBoundIncluded) node.Attributes.Append(ubi);
     153    //  if (!upperBoundEnabled) node.Attributes.Append(ube);
     154    //  return node;
     155    //}
     156    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     157      base.Persist(name, writer, persistedObjects);
     158      writer.WriteAttributeString("LowerBound", LowerBound.ToString());
     159      if(!lowerBoundIncluded) writer.WriteAttributeString("LowerBoundIncluded", "false");
     160      if(!lowerBoundEnabled) writer.WriteAttributeString("LowerBoundEnabled", "false");
     161      writer.WriteAttributeString("UpperBound", UpperBound.ToString());
     162      if(!upperBoundIncluded) writer.WriteAttributeString("UpperBoundIncluded", "false");
     163      if(!upperBoundEnabled) writer.WriteAttributeString("UpperBoundEnabled", "false");
    155164    }
    156165
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs

    r2 r119  
    127127
    128128    #region persistence
    129     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    130       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    131       XmlAttribute lb = document.CreateAttribute("LowerBound");
    132       lb.Value = LowerBound + "";
    133       XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
    134       lbi.Value = lowerBoundIncluded + "";
    135       XmlAttribute lbe = document.CreateAttribute("LowerBoundEnabled");
    136       lbe.Value = lowerBoundEnabled + "";
    137       XmlAttribute ub = document.CreateAttribute("UpperBound");
    138       ub.Value = upperBound + "";
    139       XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
    140       ubi.Value = upperBoundIncluded + "";
    141       XmlAttribute ube = document.CreateAttribute("UpperBoundEnabled");
    142       ube.Value = upperBoundEnabled + "";
    143       node.Attributes.Append(lb);
    144       if (!lowerBoundIncluded) node.Attributes.Append(lbi);
    145       if (!lowerBoundEnabled) node.Attributes.Append(lbe);
    146       node.Attributes.Append(ub);
    147       if (!upperBoundIncluded) node.Attributes.Append(ubi);
    148       if (!upperBoundEnabled) node.Attributes.Append(ube);
    149       return node;
     129    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     130    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     131    //  XmlAttribute lb = document.CreateAttribute("LowerBound");
     132    //  lb.Value = LowerBound + "";
     133    //  XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
     134    //  lbi.Value = lowerBoundIncluded + "";
     135    //  XmlAttribute lbe = document.CreateAttribute("LowerBoundEnabled");
     136    //  lbe.Value = lowerBoundEnabled + "";
     137    //  XmlAttribute ub = document.CreateAttribute("UpperBound");
     138    //  ub.Value = upperBound + "";
     139    //  XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
     140    //  ubi.Value = upperBoundIncluded + "";
     141    //  XmlAttribute ube = document.CreateAttribute("UpperBoundEnabled");
     142    //  ube.Value = upperBoundEnabled + "";
     143    //  node.Attributes.Append(lb);
     144    //  if (!lowerBoundIncluded) node.Attributes.Append(lbi);
     145    //  if (!lowerBoundEnabled) node.Attributes.Append(lbe);
     146    //  node.Attributes.Append(ub);
     147    //  if (!upperBoundIncluded) node.Attributes.Append(ubi);
     148    //  if (!upperBoundEnabled) node.Attributes.Append(ube);
     149    //  return node;
     150    //}
     151    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     152      base.Persist(name, writer, persistedObjects);
     153      writer.WriteAttributeString("LowerBound", LowerBound.ToString());
     154      if(!lowerBoundIncluded) writer.WriteAttributeString("LowerBoundIncluded", "false");
     155      if(!lowerBoundEnabled) writer.WriteAttributeString("LowerBoundEnabled", "false");
     156      writer.WriteAttributeString("UpperBound", UpperBound.ToString());
     157      if(!upperBoundIncluded) writer.WriteAttributeString("UpperBoundIncluded", "false");
     158      if(!upperBoundEnabled) writer.WriteAttributeString("UpperBoundEnabled", "false");
    150159    }
    151160
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs

    r40 r119  
    7878    }
    7979
    80     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    81       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    82       XmlAttribute itemTypeAttribute = document.CreateAttribute("ItemType");
    83       itemTypeAttribute.Value = PersistenceManager.BuildTypeString(Type);
    84       node.Attributes.Append(itemTypeAttribute);
    85       return node;
     80    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     81    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     82    //  XmlAttribute itemTypeAttribute = document.CreateAttribute("ItemType");
     83    //  itemTypeAttribute.Value = PersistenceManager.BuildTypeString(Type);
     84    //  node.Attributes.Append(itemTypeAttribute);
     85    //  return node;
     86    //}
     87    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     88      base.Persist(name, writer, persistedObjects);
     89      writer.WriteAttributeString("ItemType", PersistenceManager.BuildTypeString(Type));
    8690    }
    8791
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/NotConstraint.cs

    r2 r119  
    6868
    6969    #region persistence
    70     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    71       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    72       XmlNode sub = PersistenceManager.Persist("SubConstraint", SubConstraint, document, persistedObjects);
    73       node.AppendChild(sub);
    74       return node;
     70    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     71    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     72    //  XmlNode sub = PersistenceManager.Persist("SubConstraint", SubConstraint, document, persistedObjects);
     73    //  node.AppendChild(sub);
     74    //  return node;
     75    //}
     76    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     77      base.Persist(name, writer, persistedObjects);
     78      PersistenceManager.Persist("SubConstraint", SubConstraint, writer, persistedObjects);
    7579    }
    7680
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs

    r2 r119  
    7979
    8080    #region persistence
    81     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    82       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    83       XmlNode minNode = PersistenceManager.Persist("min", minOperators, document, persistedObjects);
    84       XmlNode maxNode = PersistenceManager.Persist("max", maxOperators, document, persistedObjects);
    85       node.AppendChild(minNode);
    86       node.AppendChild(maxNode);
    87       return node;
     81    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     82    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     83    //  XmlNode minNode = PersistenceManager.Persist("min", minOperators, document, persistedObjects);
     84    //  XmlNode maxNode = PersistenceManager.Persist("max", maxOperators, document, persistedObjects);
     85    //  node.AppendChild(minNode);
     86    //  node.AppendChild(maxNode);
     87    //  return node;
     88    //}
     89    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     90      base.Persist(name, writer, persistedObjects);
     91      PersistenceManager.Persist("min", minOperators, writer, persistedObjects);
     92      PersistenceManager.Persist("max", maxOperators, writer, persistedObjects);
    8893    }
    8994
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/OrConstraint.cs

    r40 r119  
    7474
    7575    #region persistence
    76     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    77       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    78       XmlNode clausesNode = PersistenceManager.Persist("Clauses", Clauses, document, persistedObjects);
    79       node.AppendChild(clausesNode);
     76    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     77    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     78    //  XmlNode clausesNode = PersistenceManager.Persist("Clauses", Clauses, document, persistedObjects);
     79    //  node.AppendChild(clausesNode);
    8080
    81       return node;
     81    //  return node;
     82    //}
     83    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     84      base.Persist(name, writer, persistedObjects);
     85      PersistenceManager.Persist("Clauses", Clauses, writer, persistedObjects);
    8286    }
    8387
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs

    r2 r119  
    108108
    109109    #region persistence
    110     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    111       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    112       XmlNode indexNode = PersistenceManager.Persist("SubOperatorIndex", subOperatorIndex, document, persistedObjects);
    113       node.AppendChild(indexNode);
    114       XmlNode listNode = document.CreateNode(XmlNodeType.Element, "AllowedSubOperators", document.NamespaceURI);
    115       foreach(IOperator op in subOperators) {
    116         XmlNode opNode = PersistenceManager.Persist(op, document, persistedObjects);
    117         listNode.AppendChild(opNode);
    118       }
    119       node.AppendChild(listNode);
    120       return node;
     110    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     111    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     112    //  XmlNode indexNode = PersistenceManager.Persist("SubOperatorIndex", subOperatorIndex, document, persistedObjects);
     113    //  node.AppendChild(indexNode);
     114    //  XmlNode listNode = document.CreateNode(XmlNodeType.Element, "AllowedSubOperators", document.NamespaceURI);
     115    //  foreach(IOperator op in subOperators) {
     116    //    XmlNode opNode = PersistenceManager.Persist(op, document, persistedObjects);
     117    //    listNode.AppendChild(opNode);
     118    //  }
     119    //  node.AppendChild(listNode);
     120    //  return node;
     121    //}
     122    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     123      base.Persist(name, writer, persistedObjects);
     124      PersistenceManager.Persist("SubOperatorIndex", subOperatorIndex, writer, persistedObjects);
     125      writer.WriteStartElement("AllowedSubOperators");
     126      foreach(IOperator op in subOperators)
     127        PersistenceManager.Persist(op, writer, persistedObjects);
     128      writer.WriteEndElement(); // </AllowedSubOperators>
    121129    }
    122130
  • branches/XmlTextWriterBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs

    r2 r119  
    106106    }
    107107
    108     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    109       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    110       XmlNode leftNode = PersistenceManager.Persist("LeftVarName", LeftVarName, document, persistedObjects);
    111       node.AppendChild(leftNode);
    112       XmlNode rightNode = PersistenceManager.Persist("RightVarName", RightVarName, document, persistedObjects);
    113       node.AppendChild(rightNode);
    114       XmlNode comparerNode = PersistenceManager.Persist("Comparer", Comparer, document, persistedObjects);
    115       node.AppendChild(comparerNode);
    116       return node;
     108    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     109    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     110    //  XmlNode leftNode = PersistenceManager.Persist("LeftVarName", LeftVarName, document, persistedObjects);
     111    //  node.AppendChild(leftNode);
     112    //  XmlNode rightNode = PersistenceManager.Persist("RightVarName", RightVarName, document, persistedObjects);
     113    //  node.AppendChild(rightNode);
     114    //  XmlNode comparerNode = PersistenceManager.Persist("Comparer", Comparer, document, persistedObjects);
     115    //  node.AppendChild(comparerNode);
     116    //  return node;
     117    //}
     118    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     119      base.Persist(name, writer, persistedObjects);
     120      PersistenceManager.Persist("LeftVarName", LeftVarName, writer, persistedObjects);
     121      PersistenceManager.Persist("RightVarName", RightVarName, writer, persistedObjects);
     122      PersistenceManager.Persist("Comparer", Comparer, writer, persistedObjects);
    117123    }
    118124
  • branches/XmlTextWriterBranch/HeuristicLab.Core/AtomicOperation.cs

    r2 r119  
    5151
    5252    #region Persistence Methods
    53     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    54       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    55       node.AppendChild(PersistenceManager.Persist("Operator", Operator, document, persistedObjects));
    56       node.AppendChild(PersistenceManager.Persist("Scope", Scope, document, persistedObjects));
    57       return node;
     53    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     54    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     55    //  node.AppendChild(PersistenceManager.Persist("Operator", Operator, document, persistedObjects));
     56    //  node.AppendChild(PersistenceManager.Persist("Scope", Scope, document, persistedObjects));
     57    //  return node;
     58    //}
     59    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     60      base.Persist(name, writer, persistedObjects);
     61      PersistenceManager.Persist("Operator", Operator, writer, persistedObjects);
     62      PersistenceManager.Persist("Scope", Scope, writer, persistedObjects);
    5863    }
    5964    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/CompositeOperation.cs

    r2 r119  
    5959
    6060    #region Persistence Methods
    61     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    62       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    63       XmlAttribute parallelAttribute = document.CreateAttribute("ExecuteInParallel");
    64       parallelAttribute.Value = ExecuteInParallel.ToString();
    65       node.Attributes.Append(parallelAttribute);
     61    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     62    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     63    //  XmlAttribute parallelAttribute = document.CreateAttribute("ExecuteInParallel");
     64    //  parallelAttribute.Value = ExecuteInParallel.ToString();
     65    //  node.Attributes.Append(parallelAttribute);
    6666
    67       XmlNode operationsNode = document.CreateNode(XmlNodeType.Element, "Operations", null);
    68       for (int i = 0; i < Operations.Count; i++)
    69         operationsNode.AppendChild(PersistenceManager.Persist(Operations[i], document, persistedObjects));
    70       node.AppendChild(operationsNode);
    71       return node;
     67    //  XmlNode operationsNode = document.CreateNode(XmlNodeType.Element, "Operations", null);
     68    //  for (int i = 0; i < Operations.Count; i++)
     69    //    operationsNode.AppendChild(PersistenceManager.Persist(Operations[i], document, persistedObjects));
     70    //  node.AppendChild(operationsNode);
     71    //  return node;
     72    //}
     73    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     74      base.Persist(name, writer, persistedObjects);
     75      writer.WriteAttributeString("ExecuteInParallel", ExecuteInParallel.ToString());
     76      writer.WriteStartElement("Operations");
     77      for(int i = 0; i < Operations.Count; i++)
     78        PersistenceManager.Persist(Operations[i], writer, persistedObjects);
     79      writer.WriteEndElement(); // </Operations>
    7280    }
    7381    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs

    r2 r119  
    8787
    8888    #region Persistence Methods
    89     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    90       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    91       if (Constraints.Count > 0) {
    92         XmlNode constraintsNode = document.CreateNode(XmlNodeType.Element, "Constraints", null);
    93         foreach (IConstraint constraint in Constraints)
    94           constraintsNode.AppendChild(PersistenceManager.Persist(constraint, document, persistedObjects));
    95         node.AppendChild(constraintsNode);
     89    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     90    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     91    //  if (Constraints.Count > 0) {
     92    //    XmlNode constraintsNode = document.CreateNode(XmlNodeType.Element, "Constraints", null);
     93    //    foreach (IConstraint constraint in Constraints)
     94    //      constraintsNode.AppendChild(PersistenceManager.Persist(constraint, document, persistedObjects));
     95    //    node.AppendChild(constraintsNode);
     96    //  }
     97    //  return node;
     98    //}
     99    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     100      base.Persist(name, writer, persistedObjects);
     101      if(Constraints.Count > 0) {
     102        writer.WriteStartElement("Constraints");
     103        foreach(IConstraint constraint in Constraints)
     104          PersistenceManager.Persist(constraint, writer, persistedObjects);
     105        writer.WriteEndElement(); // </Constraints>
    96106      }
    97       return node;
    98107    }
    99108    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/EngineBase.cs

    r47 r119  
    172172
    173173    #region Persistence Methods
    174     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    175       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    176 
    177       node.AppendChild(PersistenceManager.Persist("OperatorGraph", OperatorGraph, document, persistedObjects));
    178       node.AppendChild(PersistenceManager.Persist("GlobalScope", GlobalScope, document, persistedObjects));
    179 
    180       XmlNode stackNode = document.CreateNode(XmlNodeType.Element, "ExecutionStack", null);
     174    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     175    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     176
     177    //  node.AppendChild(PersistenceManager.Persist("OperatorGraph", OperatorGraph, document, persistedObjects));
     178    //  node.AppendChild(PersistenceManager.Persist("GlobalScope", GlobalScope, document, persistedObjects));
     179
     180    //  XmlNode stackNode = document.CreateNode(XmlNodeType.Element, "ExecutionStack", null);
     181    //  IOperation[] operations = new IOperation[ExecutionStack.Count];
     182    //  ExecutionStack.CopyTo(operations, 0);
     183    //  for (int i = 0; i < operations.Length; i++)
     184    //    stackNode.AppendChild(PersistenceManager.Persist(operations[i], document, persistedObjects));
     185    //  node.AppendChild(stackNode);
     186
     187    //  XmlNode timeNode = document.CreateNode(XmlNodeType.Element, "ExecutionTime", null);
     188    //  timeNode.InnerText = ExecutionTime.ToString();
     189    //  node.AppendChild(timeNode);
     190    //  return node;
     191    //}
     192    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     193      base.Persist(name, writer, persistedObjects);
     194      PersistenceManager.Persist("OperatorGraph", OperatorGraph, writer, persistedObjects);
     195      PersistenceManager.Persist("GlobalScope", GlobalScope, writer, persistedObjects);
     196      writer.WriteStartElement("ExecutionStack");
    181197      IOperation[] operations = new IOperation[ExecutionStack.Count];
    182198      ExecutionStack.CopyTo(operations, 0);
    183199      for (int i = 0; i < operations.Length; i++)
    184         stackNode.AppendChild(PersistenceManager.Persist(operations[i], document, persistedObjects));
    185       node.AppendChild(stackNode);
    186 
    187       XmlNode timeNode = document.CreateNode(XmlNodeType.Element, "ExecutionTime", null);
    188       timeNode.InnerText = ExecutionTime.ToString();
    189       node.AppendChild(timeNode);
    190       return node;
     200          PersistenceManager.Persist(operations[i], writer, persistedObjects);
     201      writer.WriteEndElement(); // </ExecutionStack>
     202      writer.WriteStartElement("ExecutionTime");
     203      writer.WriteValue(ExecutionTime.ToString());
     204      writer.WriteEndElement(); // </ExecutionTime>
    191205    }
    192206    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs

    r2 r119  
    3232    object Clone(IDictionary<Guid, object> clonedObjects);
    3333
    34     XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects);
     34    //XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects);
     35    void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects);
    3536    void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects);
    3637  }
  • branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorBase.cs

    r76 r119  
    437437
    438438    #region Persistence Methods
    439     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    440       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    441       XmlAttribute nameAttribute = document.CreateAttribute("Name");
    442       nameAttribute.Value = Name;
    443       node.Attributes.Append(nameAttribute);
    444       if (Breakpoint) {
    445         XmlAttribute breakpointAttribute = document.CreateAttribute("Breakpoint");
    446         breakpointAttribute.Value = Breakpoint.ToString();
    447         node.Attributes.Append(breakpointAttribute);
    448       }
    449       XmlNode subOperatorsNode = document.CreateNode(XmlNodeType.Element, "SubOperators", null);
    450       for (int i = 0; i < SubOperators.Count; i++)
    451         subOperatorsNode.AppendChild(PersistenceManager.Persist(SubOperators[i], document, persistedObjects));
    452       node.AppendChild(subOperatorsNode);
    453       XmlNode infosNode = document.CreateNode(XmlNodeType.Element, "VariableInfos", null);
    454       foreach (IVariableInfo info in myVariableInfos.Values)
    455         infosNode.AppendChild(PersistenceManager.Persist(info, document, persistedObjects));
    456       node.AppendChild(infosNode);
    457       XmlNode variablesNode = document.CreateNode(XmlNodeType.Element, "Variables", null);
    458       foreach (IVariable variable in myVariables.Values)
    459         variablesNode.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
    460       node.AppendChild(variablesNode);
    461       return node;
     439    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     440    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     441    //  XmlAttribute nameAttribute = document.CreateAttribute("Name");
     442    //  nameAttribute.Value = Name;
     443    //  node.Attributes.Append(nameAttribute);
     444    //  if (Breakpoint) {
     445    //    XmlAttribute breakpointAttribute = document.CreateAttribute("Breakpoint");
     446    //    breakpointAttribute.Value = Breakpoint.ToString();
     447    //    node.Attributes.Append(breakpointAttribute);
     448    //  }
     449    //  XmlNode subOperatorsNode = document.CreateNode(XmlNodeType.Element, "SubOperators", null);
     450    //  for (int i = 0; i < SubOperators.Count; i++)
     451    //    subOperatorsNode.AppendChild(PersistenceManager.Persist(SubOperators[i], document, persistedObjects));
     452    //  node.AppendChild(subOperatorsNode);
     453    //  XmlNode infosNode = document.CreateNode(XmlNodeType.Element, "VariableInfos", null);
     454    //  foreach (IVariableInfo info in myVariableInfos.Values)
     455    //    infosNode.AppendChild(PersistenceManager.Persist(info, document, persistedObjects));
     456    //  node.AppendChild(infosNode);
     457    //  XmlNode variablesNode = document.CreateNode(XmlNodeType.Element, "Variables", null);
     458    //  foreach (IVariable variable in myVariables.Values)
     459    //    variablesNode.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
     460    //  node.AppendChild(variablesNode);
     461    //  return node;
     462    //}
     463    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     464      base.Persist(name, writer, persistedObjects);
     465      writer.WriteAttributeString("Name", Name);
     466      if(Breakpoint)
     467        writer.WriteAttributeString("BreakPoint", Breakpoint.ToString());
     468      writer.WriteStartElement("SubOperators");
     469      for(int i = 0; i < SubOperators.Count; i++)
     470        PersistenceManager.Persist(SubOperators[i], writer, persistedObjects);
     471      writer.WriteEndElement(); // </SubOperators>
     472      writer.WriteStartElement("VariableInfos");
     473      foreach(IVariableInfo info in myVariableInfos.Values)
     474        PersistenceManager.Persist(info, writer, persistedObjects);
     475      writer.WriteEndElement(); // </VariableInfos>
     476      writer.WriteStartElement("Variables");
     477      foreach(IVariable variable in myVariables.Values)
     478        PersistenceManager.Persist(variable, writer, persistedObjects);
     479      writer.WriteEndElement(); // </Variables>
    462480    }
    463481    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGraph.cs

    r47 r119  
    122122
    123123    #region Persistence Methods
    124     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    125       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    126       XmlNode ops = document.CreateNode(XmlNodeType.Element, "Operators", null);
    127       foreach (IOperator op in myOperators.Values)
    128         ops.AppendChild(PersistenceManager.Persist(op, document, persistedObjects));
    129       node.AppendChild(ops);
    130       if (InitialOperator != null)
    131         node.AppendChild(PersistenceManager.Persist("InitialOperator", InitialOperator, document, persistedObjects));
    132       return node;
     124    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     125    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     126    //  XmlNode ops = document.CreateNode(XmlNodeType.Element, "Operators", null);
     127    //  foreach (IOperator op in myOperators.Values)
     128    //    ops.AppendChild(PersistenceManager.Persist(op, document, persistedObjects));
     129    //  node.AppendChild(ops);
     130    //  if (InitialOperator != null)
     131    //    node.AppendChild(PersistenceManager.Persist("InitialOperator", InitialOperator, document, persistedObjects));
     132    //  return node;
     133    //}
     134    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     135      base.Persist(name, writer, persistedObjects);
     136      writer.WriteStartElement("Operators");
     137      foreach(IOperator op in myOperators.Values)
     138        PersistenceManager.Persist(op, writer, persistedObjects);
     139      writer.WriteEndElement(); // </Operators>
     140      if(InitialOperator != null)
     141        PersistenceManager.Persist("InitialOperator", InitialOperator, writer, persistedObjects);
    133142    }
    134143    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGroup.cs

    r2 r119  
    8383
    8484    #region Persistence Methods
    85     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    86       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    87       XmlAttribute nameAttribute = document.CreateAttribute("Name");
    88       nameAttribute.Value = Name;
    89       node.Attributes.Append(nameAttribute);
    90       XmlNode subGroupsNode = document.CreateNode(XmlNodeType.Element, "SubGroups", null);
    91       foreach (IOperatorGroup group in SubGroups)
    92         subGroupsNode.AppendChild(PersistenceManager.Persist(group, document, persistedObjects));
    93       node.AppendChild(subGroupsNode);
    94       XmlNode operatorsNode = document.CreateNode(XmlNodeType.Element, "Operators", null);
    95       foreach (IOperator op in Operators)
    96         operatorsNode.AppendChild(PersistenceManager.Persist(op, document, persistedObjects));
    97       node.AppendChild(operatorsNode);
    98       return node;
     85    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     86    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     87    //  XmlAttribute nameAttribute = document.CreateAttribute("Name");
     88    //  nameAttribute.Value = Name;
     89    //  node.Attributes.Append(nameAttribute);
     90    //  XmlNode subGroupsNode = document.CreateNode(XmlNodeType.Element, "SubGroups", null);
     91    //  foreach (IOperatorGroup group in SubGroups)
     92    //    subGroupsNode.AppendChild(PersistenceManager.Persist(group, document, persistedObjects));
     93    //  node.AppendChild(subGroupsNode);
     94    //  XmlNode operatorsNode = document.CreateNode(XmlNodeType.Element, "Operators", null);
     95    //  foreach (IOperator op in Operators)
     96    //    operatorsNode.AppendChild(PersistenceManager.Persist(op, document, persistedObjects));
     97    //  node.AppendChild(operatorsNode);
     98    //  return node;
     99    //}
     100    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     101      base.Persist(name, writer, persistedObjects);
     102      writer.WriteAttributeString("Name", Name);
     103      writer.WriteStartElement("SubGroups");
     104      foreach(IOperatorGroup group in SubGroups)
     105        PersistenceManager.Persist(group, writer, persistedObjects);
     106      writer.WriteEndElement(); // </SubGroups>
     107      writer.WriteStartElement("Operators");
     108      foreach(IOperator op in Operators)
     109        PersistenceManager.Persist(op, writer, persistedObjects);
     110      writer.WriteEndElement(); // </Operators>
    99111    }
    100112    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorLibrary.cs

    r2 r119  
    5151
    5252    #region Persistence Methods
    53     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    54       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    55       node.AppendChild(PersistenceManager.Persist("OperatorGroup", Group, document, persistedObjects));
    56       return node;
     53    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     54    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     55    //  node.AppendChild(PersistenceManager.Persist("OperatorGroup", Group, document, persistedObjects));
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      PersistenceManager.Persist("OperatorGroup", Group, writer, persistedObjects);
    5761    }
    5862    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/PersistenceManager.cs

    r40 r119  
    2828namespace HeuristicLab.Core {
    2929  public static class PersistenceManager {
    30     public static XmlDocument CreateXmlDocument() {
    31       XmlDocument document = new XmlDocument();
    32       document.AppendChild(document.CreateXmlDeclaration("1.0", null, null));
    33       return document;
     30    //public static XmlDocument CreateXmlDocument() {
     31    //  XmlDocument document = new XmlDocument();
     32    //  document.AppendChild(document.CreateXmlDeclaration("1.0", null, null));
     33    //  return document;
     34    //}
     35    public static void Persist(IStorable instance, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     36      Persist(instance.GetType().Name, instance, writer, persistedObjects);
    3437    }
    35     public static XmlNode Persist(IStorable instance, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    36       return Persist(instance.GetType().Name, instance, document, persistedObjects);
    37     }
    38     public static XmlNode Persist(string name, IStorable instance, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     38    public static void Persist(string name, IStorable instance, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
    3939      if (persistedObjects.ContainsKey(instance.Guid)) {
    40         XmlNode node = document.CreateNode(XmlNodeType.Element, name, null);
    41         XmlAttribute guidAttribute = document.CreateAttribute("GUID");
    42         guidAttribute.Value = instance.Guid.ToString();
    43         node.Attributes.Append(guidAttribute);
    44         return node;
     40        writer.WriteStartElement(name, null);
     41        writer.WriteAttributeString("GUID", instance.Guid.ToString());
     42        writer.WriteEndElement();
     43
     44        //XmlNode node = document.CreateNode(XmlNodeType.Element, name, null);
     45        //XmlAttribute guidAttribute = document.CreateAttribute("GUID");
     46        //guidAttribute.Value = instance.Guid.ToString();
     47        //node.Attributes.Append(guidAttribute);
     48        //return node;
    4549      } else {
    4650        persistedObjects.Add(instance.Guid, instance);
    47         XmlNode node = instance.GetXmlNode(name, document, persistedObjects);
    48         return node;
     51        writer.WriteStartElement(name);
     52        instance.Persist(name, writer, persistedObjects);
     53        writer.WriteEndElement();
     54        //XmlNode node = instance.GetXmlNode(name, document, persistedObjects);
     55        //return node;
    4956      }
    5057    }
     58
    5159    public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    5260      Guid guid = new Guid(node.Attributes["GUID"].Value);
     
    6775    }
    6876    public static void Save(IStorable instance, Stream stream) {
    69       XmlDocument document = PersistenceManager.CreateXmlDocument();
    70       document.AppendChild(Persist(instance, document, new Dictionary<Guid, IStorable>()));
    71       document.Save(stream);
     77      XmlTextWriter writer = new XmlTextWriter(stream, null);
     78      writer.Formatting = Formatting.Indented;
     79      writer.WriteProcessingInstruction("xml", "version=\"1.0\"");
     80      Persist(instance, writer, new Dictionary<Guid, IStorable>());     
     81      writer.Flush();
     82      writer.Close();
    7283    }
    7384    public static IStorable Load(string filename) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/Scope.cs

    r63 r119  
    259259
    260260    #region Persistence Methods
    261     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    262       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    263       XmlAttribute nameAttribute = document.CreateAttribute("Name");
    264       nameAttribute.Value = Name.ToString();
    265       node.Attributes.Append(nameAttribute);
    266 
    267       XmlNode variables = document.CreateNode(XmlNodeType.Element, "Variables", null);
    268       foreach (IVariable variable in Variables)
    269         variables.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
    270       node.AppendChild(variables);
    271 
    272       XmlNode aliases = document.CreateNode(XmlNodeType.Element, "Aliases", null);
    273       foreach (KeyValuePair<string, string> alias in myAliases) {
    274         XmlNode aliasNode = document.CreateNode(XmlNodeType.Element, "Alias", null);
    275         XmlAttribute keyAttribute = document.CreateAttribute("Alias");
    276         keyAttribute.Value = alias.Key;
    277         aliasNode.Attributes.Append(keyAttribute);
    278         XmlAttribute valueAttribute = document.CreateAttribute("Name");
    279         valueAttribute.Value = alias.Value;
    280         aliasNode.Attributes.Append(valueAttribute);
    281         aliases.AppendChild(aliasNode);
    282       }
    283       node.AppendChild(aliases);
    284 
    285       XmlNode subScopes = document.CreateNode(XmlNodeType.Element, "SubScopes", null);
    286       for (int i = 0; i < SubScopes.Count; i++)
    287         subScopes.AppendChild(PersistenceManager.Persist(SubScopes[i], document, persistedObjects));
    288       node.AppendChild(subScopes);
    289 
    290       return node;
    291     }
    292     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
     261    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     262    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     263    //  XmlAttribute nameAttribute = document.CreateAttribute("Name");
     264    //  nameAttribute.Value = Name.ToString();
     265    //  node.Attributes.Append(nameAttribute);
     266
     267    //  XmlNode variables = document.CreateNode(XmlNodeType.Element, "Variables", null);
     268    //  foreach (IVariable variable in Variables)
     269    //    variables.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
     270    //  node.AppendChild(variables);
     271
     272    //  XmlNode aliases = document.CreateNode(XmlNodeType.Element, "Aliases", null);
     273    //  foreach (KeyValuePair<string, string> alias in myAliases) {
     274    //    XmlNode aliasNode = document.CreateNode(XmlNodeType.Element, "Alias", null);
     275    //    XmlAttribute keyAttribute = document.CreateAttribute("Alias");
     276    //    keyAttribute.Value = alias.Key;
     277    //    aliasNode.Attributes.Append(keyAttribute);
     278    //    XmlAttribute valueAttribute = document.CreateAttribute("Name");
     279    //    valueAttribute.Value = alias.Value;
     280    //    aliasNode.Attributes.Append(valueAttribute);
     281    //    aliases.AppendChild(aliasNode);
     282    //  }
     283    //  node.AppendChild(aliases);
     284
     285    //  XmlNode subScopes = document.CreateNode(XmlNodeType.Element, "SubScopes", null);
     286    //  for (int i = 0; i < SubScopes.Count; i++)
     287    //    subScopes.AppendChild(PersistenceManager.Persist(SubScopes[i], document, persistedObjects));
     288    //  node.AppendChild(subScopes);
     289
     290    //  return node;
     291    //}
     292    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     293      base.Persist(name, writer, persistedObjects);
     294      writer.WriteAttributeString("Name", Name);
     295      writer.WriteStartElement("Variables");
     296      foreach(IVariable variable in Variables) {
     297        PersistenceManager.Persist(variable, writer, persistedObjects);
     298      }
     299      writer.WriteEndElement(); // </Variables>
     300      writer.WriteStartElement("Aliases");
     301      foreach(KeyValuePair<string,string> alias in myAliases) {
     302        writer.WriteStartElement("Alias");
     303        writer.WriteAttributeString("Alias", alias.Key);
     304        writer.WriteAttributeString("Name", alias.Value);
     305        writer.WriteEndElement(); // </Alias>
     306      }
     307      writer.WriteEndElement(); // </Aliases>
     308      writer.WriteStartElement("SubScopes");
     309      for(int i = 0; i < SubScopes.Count; i++)
     310        PersistenceManager.Persist(SubScopes[i], writer, persistedObjects);
     311      writer.WriteEndElement(); // </SubScopes>
     312    }
     313    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    293314      base.Populate(node, restoredObjects);
    294315      myName = node.Attributes["Name"].Value;
  • branches/XmlTextWriterBranch/HeuristicLab.Core/StorableBase.cs

    r40 r119  
    4545    }
    4646
    47     public virtual XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = document.CreateNode(XmlNodeType.Element, name, null);
    49       XmlAttribute typeAttribute = document.CreateAttribute("Type");
    50       typeAttribute.Value = PersistenceManager.BuildTypeString(this.GetType());
    51       node.Attributes.Append(typeAttribute);
    52       XmlAttribute guidAttribute = document.CreateAttribute("GUID");
    53       guidAttribute.Value = Guid.ToString();
    54       node.Attributes.Append(guidAttribute);
    55       return node;
     47    //public virtual XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = document.CreateNode(XmlNodeType.Element, name, null);
     49    //  XmlAttribute typeAttribute = document.CreateAttribute("Type");
     50    //  typeAttribute.Value = PersistenceManager.BuildTypeString(this.GetType());
     51    //  node.Attributes.Append(typeAttribute);
     52    //  XmlAttribute guidAttribute = document.CreateAttribute("GUID");
     53    //  guidAttribute.Value = Guid.ToString();
     54    //  node.Attributes.Append(guidAttribute);
     55    //  return node;
     56    //}
     57    public virtual void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     58      writer.WriteAttributeString("Type", PersistenceManager.BuildTypeString(this.GetType()));
     59      writer.WriteAttributeString("GUID", Guid.ToString());
    5660    }
    5761    public virtual void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/Variable.cs

    r2 r119  
    100100
    101101    #region Persistence Methods
    102     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    103       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    104       XmlAttribute nameAttribute = document.CreateAttribute("Name");
    105       nameAttribute.Value = Name;
    106       node.Attributes.Append(nameAttribute);
    107       if (Value != null)
    108         node.AppendChild(PersistenceManager.Persist("Value", Value, document, persistedObjects));
    109       return node;
     102    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     103    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     104    //  XmlAttribute nameAttribute = document.CreateAttribute("Name");
     105    //  nameAttribute.Value = Name;
     106    //  node.Attributes.Append(nameAttribute);
     107    //  if (Value != null)
     108    //    node.AppendChild(PersistenceManager.Persist("Value", Value, document, persistedObjects));
     109    //  return node;
     110    //}
     111    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     112      base.Persist(name, writer, persistedObjects);
     113      writer.WriteAttributeString("Name", Name);
     114      if(Value != null)
     115        PersistenceManager.Persist("Value", Value, writer, persistedObjects);
    110116    }
    111117    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Core/VariableInfo.cs

    r40 r119  
    109109
    110110    #region Persistence Methods
    111     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    112       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    113       XmlAttribute actualNameAttribute = document.CreateAttribute("ActualName");
    114       actualNameAttribute.Value = ActualName;
    115       node.Attributes.Append(actualNameAttribute);
     111    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     112    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     113    //  XmlAttribute actualNameAttribute = document.CreateAttribute("ActualName");
     114    //  actualNameAttribute.Value = ActualName;
     115    //  node.Attributes.Append(actualNameAttribute);
    116116
    117       XmlAttribute formalNameAttribute = document.CreateAttribute("FormalName");
    118       formalNameAttribute.Value = FormalName;
    119       node.Attributes.Append(formalNameAttribute);
     117    //  XmlAttribute formalNameAttribute = document.CreateAttribute("FormalName");
     118    //  formalNameAttribute.Value = FormalName;
     119    //  node.Attributes.Append(formalNameAttribute);
    120120
    121       XmlAttribute descriptionAttribute = document.CreateAttribute("Description");
    122       descriptionAttribute.Value = Description;
    123       node.Attributes.Append(descriptionAttribute);
     121    //  XmlAttribute descriptionAttribute = document.CreateAttribute("Description");
     122    //  descriptionAttribute.Value = Description;
     123    //  node.Attributes.Append(descriptionAttribute);
    124124
    125       XmlAttribute dataTypeAttribute = document.CreateAttribute("DataType");
    126       dataTypeAttribute.Value = PersistenceManager.BuildTypeString(DataType);
    127       node.Attributes.Append(dataTypeAttribute);
     125    //  XmlAttribute dataTypeAttribute = document.CreateAttribute("DataType");
     126    //  dataTypeAttribute.Value = PersistenceManager.BuildTypeString(DataType);
     127    //  node.Attributes.Append(dataTypeAttribute);
    128128
    129       XmlAttribute kindAttribute = document.CreateAttribute("Kind");
    130       kindAttribute.Value = Kind.ToString();
    131       node.Attributes.Append(kindAttribute);
     129    //  XmlAttribute kindAttribute = document.CreateAttribute("Kind");
     130    //  kindAttribute.Value = Kind.ToString();
     131    //  node.Attributes.Append(kindAttribute);
    132132
    133       XmlAttribute localAttribute = document.CreateAttribute("Local");
    134       localAttribute.Value = Local.ToString();
    135       node.Attributes.Append(localAttribute);
     133    //  XmlAttribute localAttribute = document.CreateAttribute("Local");
     134    //  localAttribute.Value = Local.ToString();
     135    //  node.Attributes.Append(localAttribute);
    136136
    137       return node;
     137    //  return node;
     138    //}
     139    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     140      base.Persist(name, writer, persistedObjects);
     141      writer.WriteAttributeString("ActualName", ActualName);
     142      writer.WriteAttributeString("FormalName", FormalName);
     143      writer.WriteAttributeString("Description", Description);
     144      writer.WriteAttributeString("DataType", PersistenceManager.BuildTypeString(DataType));
     145      writer.WriteAttributeString("Kind", Kind.ToString());
     146      writer.WriteAttributeString("Local", Local.ToString());
    138147    }
    139148    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/BoolArrayData.cs

    r2 r119  
    4444    }
    4545
    46     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    47       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    48       node.InnerText = ToString();
    49       return node;
     46    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     47    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     48    //  node.InnerText = ToString();
     49    //  return node;
     50    //}
     51    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     52      base.Persist(name, writer, persistedObjects);
     53      writer.WriteValue(ToString());
    5054    }
    5155    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/BoolData.cs

    r2 r119  
    5151    }
    5252
    53     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    54       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    55       node.InnerText = ToString();
    56       return node;
     53    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     54    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     55    //  node.InnerText = ToString();
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      writer.WriteValue(ToString());
    5761    }
    5862    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/BoolMatrixData.cs

    r2 r119  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    49       XmlAttribute dim1 = document.CreateAttribute("Dimension1");
    50       dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
    51       node.Attributes.Append(dim1);
    52       XmlAttribute dim2 = document.CreateAttribute("Dimension2");
    53       dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
    54       node.Attributes.Append(dim2);
    55       node.InnerText = ToString();
    56       return node;
     47    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     49    //  XmlAttribute dim1 = document.CreateAttribute("Dimension1");
     50    //  dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
     51    //  node.Attributes.Append(dim1);
     52    //  XmlAttribute dim2 = document.CreateAttribute("Dimension2");
     53    //  dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
     54    //  node.Attributes.Append(dim2);
     55    //  node.InnerText = ToString();
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      writer.WriteAttributeString("Dimension1", Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat));
     61      writer.WriteAttributeString("Dimension2", Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat));
     62      writer.WriteValue(ToString());
    5763    }
     64
    5865    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
    5966      base.Populate(node, restoredObjects);
  • branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedDoubleData.cs

    r2 r119  
    5656    }
    5757
    58     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    59       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    60       node.AppendChild(PersistenceManager.Persist("Value", (DoubleData) base.Data, document, persistedObjects));
    61       return node;
     58    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     59    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     60    //  node.AppendChild(PersistenceManager.Persist("Value", (DoubleData) base.Data, document, persistedObjects));
     61    //  return node;
     62    //}
     63    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     64      base.Persist(name, writer, persistedObjects);
     65      PersistenceManager.Persist("Value", (DoubleData)base.Data, writer, persistedObjects);
    6266    }
    6367    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedIntData.cs

    r2 r119  
    5656    }
    5757
    58     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    59       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    60       node.AppendChild(PersistenceManager.Persist("Value", ((IntData)base.Data), document, persistedObjects));
    61       return node;
     58    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     59    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     60    //  node.AppendChild(PersistenceManager.Persist("Value", ((IntData)base.Data), document, persistedObjects));
     61    //  return node;
     62    //}
     63    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     64      base.Persist(name, writer, persistedObjects);
     65      PersistenceManager.Persist("Value", (IntData)base.Data, writer, persistedObjects);
    6266    }
    6367    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedItemList.cs

    r2 r119  
    5555    }
    5656
    57     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    58       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    59       XmlNode listNode = document.CreateNode(XmlNodeType.Element, "ListItems", null);
    60       for (int i = 0; i < list.Count; i++)
    61         listNode.AppendChild(PersistenceManager.Persist(list[i], document, persistedObjects));
    62       XmlAttribute sccAttrib = document.CreateAttribute("SuspendConstraintCheck");
    63       sccAttrib.Value = suspendConstraintCheck.ToString();
    64       listNode.Attributes.Append(sccAttrib);
    65       node.AppendChild(listNode);
    66       return node;
     57    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     58    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     59    //  XmlNode listNode = document.CreateNode(XmlNodeType.Element, "ListItems", null);
     60    //  for (int i = 0; i < list.Count; i++)
     61    //    listNode.AppendChild(PersistenceManager.Persist(list[i], document, persistedObjects));
     62    //  XmlAttribute sccAttrib = document.CreateAttribute("SuspendConstraintCheck");
     63    //  sccAttrib.Value = suspendConstraintCheck.ToString();
     64    //  listNode.Attributes.Append(sccAttrib);
     65    //  node.AppendChild(listNode);
     66    //  return node;
     67    //}
     68    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     69      base.Persist(name, writer, persistedObjects);
     70      writer.WriteStartElement("ListItems");
     71      writer.WriteAttributeString("SuspendConstraintCheck", suspendConstraintCheck.ToString());
     72      for(int i = 0; i < list.Count; i++)
     73        PersistenceManager.Persist(list[i], writer, persistedObjects);
     74      writer.WriteEndElement(); // </ListItems>
    6775    }
    6876
  • branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleArrayData.cs

    r2 r119  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    49       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    50       return node;
     47    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     49    //  node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
     50    //  return node;
     51    //}
     52    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     53      base.Persist(name, writer, persistedObjects);
     54      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5155    }
    5256    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleData.cs

    r2 r119  
    5252    }
    5353
    54     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    55       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    56       node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat);
    57       return node;
     54    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     55    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     56    //  node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat);
     57    //  return node;
     58    //}
     59    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     60      base.Persist(name, writer, persistedObjects);
     61      writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat));
    5862    }
    5963    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleMatrixData.cs

    r2 r119  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    49       XmlAttribute dim1 = document.CreateAttribute("Dimension1");
    50       dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
    51       node.Attributes.Append(dim1);
    52       XmlAttribute dim2 = document.CreateAttribute("Dimension2");
    53       dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
    54       node.Attributes.Append(dim2);
    55       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    56       return node;
     47    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     49    //  XmlAttribute dim1 = document.CreateAttribute("Dimension1");
     50    //  dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
     51    //  node.Attributes.Append(dim1);
     52    //  XmlAttribute dim2 = document.CreateAttribute("Dimension2");
     53    //  dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
     54    //  node.Attributes.Append(dim2);
     55    //  node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      writer.WriteAttributeString("Dimension1", Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat));
     61      writer.WriteAttributeString("Dimension2", Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat));
     62      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5763    }
    5864    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/IntArrayData.cs

    r2 r119  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    49       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    50       return node;
     47    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     49    //  node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
     50    //  return node;
     51    //}
     52    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     53      base.Persist(name, writer, persistedObjects);
     54      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5155    }
    5256    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/IntData.cs

    r2 r119  
    5252    }
    5353
    54     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    55       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    56       node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat);
    57       return node;
     54    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     55    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     56    //  node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat);
     57    //  return node;
     58    //}
     59    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     60      base.Persist(name, writer, persistedObjects);
     61      writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat));
    5862    }
    5963    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/IntMatrixData.cs

    r2 r119  
    4545    }
    4646
    47     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    48       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    49       XmlAttribute dim1 = document.CreateAttribute("Dimension1");
    50       dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
    51       node.Attributes.Append(dim1);
    52       XmlAttribute dim2 = document.CreateAttribute("Dimension2");
    53       dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
    54       node.Attributes.Append(dim2);
    55       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    56       return node;
     47    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     48    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     49    //  XmlAttribute dim1 = document.CreateAttribute("Dimension1");
     50    //  dim1.Value = Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat);
     51    //  node.Attributes.Append(dim1);
     52    //  XmlAttribute dim2 = document.CreateAttribute("Dimension2");
     53    //  dim2.Value = Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat);
     54    //  node.Attributes.Append(dim2);
     55    //  node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      writer.WriteAttributeString("Dimension1", Data.GetLength(0).ToString(CultureInfo.InvariantCulture.NumberFormat));
     61      writer.WriteAttributeString("Dimension2", Data.GetLength(1).ToString(CultureInfo.InvariantCulture.NumberFormat));
     62      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    5763    }
    5864    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/ItemList_T.cs

    r69 r119  
    5050    }
    5151
    52     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    53       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    54       for (int i = 0; i < list.Count; i++)
    55         node.AppendChild(PersistenceManager.Persist(list[i], document, persistedObjects));
    56       return node;
     52    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     53    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     54    //  for (int i = 0; i < list.Count; i++)
     55    //    node.AppendChild(PersistenceManager.Persist(list[i], document, persistedObjects));
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      for(int i = 0; i < list.Count; i++)
     61        PersistenceManager.Persist(list[i], writer, persistedObjects);
    5762    }
    5863    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Data/StringData.cs

    r2 r119  
    5151    }
    5252
    53     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    54       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    55       node.InnerText = Data;
    56       return node;
     53    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     54    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     55    //  node.InnerText = Data;
     56    //  return node;
     57    //}
     58    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     59      base.Persist(name, writer, persistedObjects);
     60      writer.WriteValue(Data);
    5761    }
    5862    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.DataAnalysis/Dataset.cs

    r2 r119  
    121121    }
    122122
    123     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    124       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    125       XmlAttribute problemName = document.CreateAttribute("Name");
    126       problemName.Value = Name;
    127       node.Attributes.Append(problemName);
    128       XmlAttribute dim1 = document.CreateAttribute("Dimension1");
    129       dim1.Value = rows.ToString(CultureInfo.InvariantCulture.NumberFormat);
    130       node.Attributes.Append(dim1);
    131       XmlAttribute dim2 = document.CreateAttribute("Dimension2");
    132       dim2.Value = columns.ToString(CultureInfo.InvariantCulture.NumberFormat);
    133       node.Attributes.Append(dim2);
    134 
    135       XmlAttribute variableNames = document.CreateAttribute("VariableNames");
    136       variableNames.Value = GetVariableNamesString();
    137       node.Attributes.Append(variableNames);
    138 
    139       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    140       return node;
     123    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     124    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     125    //  XmlAttribute problemName = document.CreateAttribute("Name");
     126    //  problemName.Value = Name;
     127    //  node.Attributes.Append(problemName);
     128    //  XmlAttribute dim1 = document.CreateAttribute("Dimension1");
     129    //  dim1.Value = rows.ToString(CultureInfo.InvariantCulture.NumberFormat);
     130    //  node.Attributes.Append(dim1);
     131    //  XmlAttribute dim2 = document.CreateAttribute("Dimension2");
     132    //  dim2.Value = columns.ToString(CultureInfo.InvariantCulture.NumberFormat);
     133    //  node.Attributes.Append(dim2);
     134
     135    //  XmlAttribute variableNames = document.CreateAttribute("VariableNames");
     136    //  variableNames.Value = GetVariableNamesString();
     137    //  node.Attributes.Append(variableNames);
     138
     139    //  node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
     140    //  return node;
     141    //}
     142    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     143      base.Persist(name, writer, persistedObjects);
     144      writer.WriteAttributeString("Name", Name);
     145      writer.WriteAttributeString("Dimension1", rows.ToString(CultureInfo.InvariantCulture.NumberFormat));
     146      writer.WriteAttributeString("Dimension2", columns.ToString(CultureInfo.InvariantCulture.NumberFormat));
     147      writer.WriteAttributeString("VariableNames", GetVariableNamesString());
     148      writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat));
    141149    }
    142150
  • branches/XmlTextWriterBranch/HeuristicLab.DistributedEngine/DistributedEngine.cs

    r36 r119  
    181181
    182182    #region Persistence Methods
    183     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    184       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    185       XmlAttribute addressAttribute = document.CreateAttribute("ServerAddress");
    186       addressAttribute.Value = ServerAddress;
    187       node.Attributes.Append(addressAttribute);
    188       return node;
     183    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     184    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     185    //  XmlAttribute addressAttribute = document.CreateAttribute("ServerAddress");
     186    //  addressAttribute.Value = ServerAddress;
     187    //  node.Attributes.Append(addressAttribute);
     188    //  return node;
     189    //}
     190    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     191      base.Persist(name, writer, persistedObjects);
     192      writer.WriteAttributeString("ServerAddress", ServerAddress);
    189193    }
    190194    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.ES/ES.cs

    r98 r119  
    601601
    602602    #region Persistence Methods
    603     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    604       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    605       node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
    606       return node;
     603    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     604    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     605    //  node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
     606    //  return node;
     607    //}
     608    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     609      base.Persist(name, writer, persistedObjects);
     610      PersistenceManager.Persist("Engine", Engine, writer, persistedObjects);
    607611    }
    608612    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Functions/FunctionBase.cs

    r2 r119  
    289289    }
    290290
    291     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    292       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    293       if (metaObject != this) {
    294         XmlNode functionTemplateNode = document.CreateElement("FunctionTemplate");
    295         functionTemplateNode.AppendChild(PersistenceManager.Persist(metaObject, document, persistedObjects));
    296         node.AppendChild(functionTemplateNode);
    297       }
    298 
    299       // don't need to persist the sub-functions because OperatorBase.GetXmlNode already persisted the sub-operators
    300 
    301       // persist local variables
    302       XmlNode variablesNode = document.CreateNode(XmlNodeType.Element, "LocalVariables", null);
    303       foreach (IVariable variable in variables) {
    304         variablesNode.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
    305       }
    306       node.AppendChild(variablesNode);
    307       return node;
     291    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     292    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     293    //  if (metaObject != this) {
     294    //    XmlNode functionTemplateNode = document.CreateElement("FunctionTemplate");
     295    //    functionTemplateNode.AppendChild(PersistenceManager.Persist(metaObject, document, persistedObjects));
     296    //    node.AppendChild(functionTemplateNode);
     297    //  }
     298
     299    //  // don't need to persist the sub-functions because OperatorBase.GetXmlNode already persisted the sub-operators
     300
     301    //  // persist local variables
     302    //  XmlNode variablesNode = document.CreateNode(XmlNodeType.Element, "LocalVariables", null);
     303    //  foreach (IVariable variable in variables) {
     304    //    variablesNode.AppendChild(PersistenceManager.Persist(variable, document, persistedObjects));
     305    //  }
     306    //  node.AppendChild(variablesNode);
     307    //  return node;
     308    //}
     309    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     310      base.Persist(name, writer, persistedObjects);
     311      if(MetaObject != this) {
     312        writer.WriteStartElement("FunctionTemplate");
     313        PersistenceManager.Persist(metaObject, writer, persistedObjects);
     314        writer.WriteEndElement();
     315      }
     316      writer.WriteStartElement("LocalVariables");
     317      foreach(IVariable variable in variables)
     318        PersistenceManager.Persist(variable, writer, persistedObjects);
     319      writer.WriteEndElement(); // </LocalVariables>
    308320    }
    309321
  • branches/XmlTextWriterBranch/HeuristicLab.Grid/ProcessingEngine.cs

    r27 r119  
    4646      myExecutionStack.Push(initialOperation);
    4747    }
    48     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    49       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    50       node.AppendChild(PersistenceManager.Persist("InitialOperation", initialOperation, document, persistedObjects));
    51       return node;
     48    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     49    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     50    //  node.AppendChild(PersistenceManager.Persist("InitialOperation", initialOperation, document, persistedObjects));
     51    //  return node;
     52    //}
     53    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     54      base.Persist(name, writer, persistedObjects);
     55      PersistenceManager.Persist("InitialOperation", initialOperation, writer, persistedObjects);
    5256    }
    5357
  • branches/XmlTextWriterBranch/HeuristicLab.Logging/Linechart.cs

    r2 r119  
    8383
    8484    #region Persistence Methods
    85     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    86       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    87       node.AppendChild(PersistenceManager.Persist("NumberOfLines", myNumberOfLines, document, persistedObjects));
    88       node.AppendChild(PersistenceManager.Persist("Values", Values, document, persistedObjects));
    89       return node;
     85    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     86    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     87    //  node.AppendChild(PersistenceManager.Persist("NumberOfLines", myNumberOfLines, document, persistedObjects));
     88    //  node.AppendChild(PersistenceManager.Persist("Values", Values, document, persistedObjects));
     89    //  return node;
     90    //}
     91    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     92      base.Persist(name, writer, persistedObjects);
     93      PersistenceManager.Persist("NumberOfLines", myNumberOfLines, writer, persistedObjects);
     94      PersistenceManager.Persist("Values", Values, writer, persistedObjects);
    9095    }
    9196    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Logging/Log.cs

    r2 r119  
    5959
    6060    #region Persistence Methods
    61     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    62       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    63       node.AppendChild(PersistenceManager.Persist("Items", Items, document, persistedObjects));
    64       return node;
     61    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     62    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     63    //  node.AppendChild(PersistenceManager.Persist("Items", Items, document, persistedObjects));
     64    //  return node;
     65    //}
     66    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     67      base.Persist(name, writer, persistedObjects);
     68      PersistenceManager.Persist("Items", Items, writer, persistedObjects);
    6569    }
    6670    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs

    r117 r119  
    192192
    193193    #region Persistence Methods
    194     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    195       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    196       XmlNode descriptionNode = document.CreateNode(XmlNodeType.Element, "Description", null);
    197       descriptionNode.InnerText = myDescription;
    198       node.AppendChild(descriptionNode);
    199       XmlNode codeNode = document.CreateNode(XmlNodeType.Element, "Code", null);
    200       codeNode.InnerText = myCode;
    201       node.AppendChild(codeNode);
    202       return node;
     194    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     195    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     196    //  XmlNode descriptionNode = document.CreateNode(XmlNodeType.Element, "Description", null);
     197    //  descriptionNode.InnerText = myDescription;
     198    //  node.AppendChild(descriptionNode);
     199    //  XmlNode codeNode = document.CreateNode(XmlNodeType.Element, "Code", null);
     200    //  codeNode.InnerText = myCode;
     201    //  node.AppendChild(codeNode);
     202    //  return node;
     203    //}
     204    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     205      base.Persist(name, writer, persistedObjects);
     206      writer.WriteStartElement("Description");
     207      writer.WriteValue(myDescription);
     208      writer.WriteEndElement(); // </Description>
     209      writer.WriteStartElement("Code");
     210      writer.WriteValue(myCode);
     211      writer.WriteEndElement();
    203212    }
    204213    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Operators/CombinedOperator.cs

    r89 r119  
    8888
    8989    #region Persistence Methods
    90     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    91       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    92       XmlNode descriptionNode = document.CreateNode(XmlNodeType.Element, "Description", null);
    93       descriptionNode.InnerText = myDescription;
    94       node.AppendChild(descriptionNode);
    95       node.AppendChild(PersistenceManager.Persist("OperatorGraph", OperatorGraph, document, persistedObjects));
    96       return node;
     90    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     91    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     92    //  XmlNode descriptionNode = document.CreateNode(XmlNodeType.Element, "Description", null);
     93    //  descriptionNode.InnerText = myDescription;
     94    //  node.AppendChild(descriptionNode);
     95    //  node.AppendChild(PersistenceManager.Persist("OperatorGraph", OperatorGraph, document, persistedObjects));
     96    //  return node;
     97    //}
     98    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     99      base.Persist(name, writer, persistedObjects);
     100      writer.WriteStartElement("Description");
     101      writer.WriteValue(myDescription);
     102      writer.WriteEndElement(); // </Description>
     103      PersistenceManager.Persist("OperatorGraph", OperatorGraph, writer, persistedObjects);
    97104    }
    98105    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Operators/VariableInjector.cs

    r2 r119  
    108108
    109109    #region Persistence Methods
    110     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    111       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    112       // variable infos should not be persisted
    113       XmlNode infosNode = node.SelectSingleNode("VariableInfos");
    114       infosNode.RemoveAll();
    115       return node;
    116     }
     110    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     111    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     112    //  // variable infos should not be persisted
     113    //  XmlNode infosNode = node.SelectSingleNode("VariableInfos");
     114    //  infosNode.RemoveAll();
     115    //  return node;
     116    //}
    117117    #endregion
    118118  }
  • branches/XmlTextWriterBranch/HeuristicLab.Random/MersenneTwister.cs

    r2 r119  
    4848
    4949    public MersenneTwister() {
    50       if (!init) seed((uint)DateTime.Now.Ticks);
     50      if(!init) seed((uint)DateTime.Now.Ticks);
    5151      init = true;
    5252    }
     
    7070
    7171    public void Reset() {
    72       lock (locker)
     72      lock(locker)
    7373        seed((uint)DateTime.Now.Ticks);
    7474    }
    7575    public void Reset(int s) {
    76       lock (locker)
     76      lock(locker)
    7777        seed((uint)s);
    7878    }
    7979
    8080    public int Next() {
    81       lock (locker) {
     81      lock(locker) {
    8282        return (int)(rand_int32() >> 1);
    8383      }
    8484    }
    8585    public int Next(int maxVal) {
    86       lock (locker) {
    87         if (maxVal <= 0)
     86      lock(locker) {
     87        if(maxVal <= 0)
    8888          throw new ArgumentException("The interval [0, " + maxVal + ") is empty");
    8989        int limit = (Int32.MaxValue / maxVal) * maxVal;
    9090        int value = Next();
    91         while (value >= limit) value = Next();
     91        while(value >= limit) value = Next();
    9292        return value % maxVal;
    9393      }
    9494    }
    9595    public int Next(int minVal, int maxVal) {
    96       lock (locker) {
    97         if (maxVal <= minVal)
     96      lock(locker) {
     97        if(maxVal <= minVal)
    9898          throw new ArgumentException("The interval [" + minVal + ", " + maxVal + ") is empty");
    9999        return Next(maxVal - minVal) + minVal;
     
    101101    }
    102102    public double NextDouble() {
    103       lock (locker) {
     103      lock(locker) {
    104104        return rand_double53();
    105105      }
     
    107107
    108108    #region Persistence Methods
    109     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    110       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    111 
     109    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     110    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     111
     112    //  StringBuilder builder = new StringBuilder();
     113    //  builder.Append(state[0]);
     114    //  for (int i = 1; i < state.Length; i++) {
     115    //    builder.Append(';');
     116    //    builder.Append(state[i]);
     117    //  }
     118    //  XmlNode stateNode = document.CreateNode(XmlNodeType.Element, "State", null);
     119    //  stateNode.InnerText = builder.ToString();
     120    //  node.AppendChild(stateNode);
     121
     122    //  XmlNode pNode = document.CreateNode(XmlNodeType.Element, "P", null);
     123    //  pNode.InnerText = p.ToString();
     124    //  node.AppendChild(pNode);
     125
     126    //  XmlNode initNode = document.CreateNode(XmlNodeType.Element, "Init", null);
     127    //  initNode.InnerText = init.ToString();
     128    //  node.AppendChild(initNode);
     129
     130    //  return node;
     131    //}
     132    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     133      base.Persist(name, writer, persistedObjects);
    112134      StringBuilder builder = new StringBuilder();
    113135      builder.Append(state[0]);
    114       for (int i = 1; i < state.Length; i++) {
     136      for(int i = 1; i < state.Length; i++) {
    115137        builder.Append(';');
    116138        builder.Append(state[i]);
    117139      }
    118       XmlNode stateNode = document.CreateNode(XmlNodeType.Element, "State", null);
    119       stateNode.InnerText = builder.ToString();
    120       node.AppendChild(stateNode);
    121 
    122       XmlNode pNode = document.CreateNode(XmlNodeType.Element, "P", null);
    123       pNode.InnerText = p.ToString();
    124       node.AppendChild(pNode);
    125 
    126       XmlNode initNode = document.CreateNode(XmlNodeType.Element, "Init", null);
    127       initNode.InnerText = init.ToString();
    128       node.AppendChild(initNode);
    129 
    130       return node;
    131     }
    132     public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
     140      writer.WriteStartElement("State");
     141      writer.WriteValue(builder.ToString());
     142      writer.WriteEndElement(); // </State>
     143      writer.WriteStartElement("P");
     144      writer.WriteValue(p.ToString());
     145      writer.WriteEndElement(); // </P>
     146      writer.WriteStartElement("Init");
     147      writer.WriteValue(init.ToString());
     148      writer.WriteEndElement(); // </Init>
     149    }
     150    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    133151      base.Populate(node, restoredObjects);
    134152
    135153      string stateString = node.SelectSingleNode("State").InnerText;
    136154      string[] tokens = stateString.Split(';');
    137       for (int i = 0; i < tokens.Length; i++)
     155      for(int i = 0; i < tokens.Length; i++)
    138156        state[i] = uint.Parse(tokens[i]);
    139157      p = int.Parse(node.SelectSingleNode("P").InnerText);
     
    145163    public void seed(uint s) {
    146164      state[0] = s & 0xFFFFFFFFU;
    147       for (int i = 1; i < n; ++i) {
     165      for(int i = 1; i < n; ++i) {
    148166        state[i] = 1812433253U * (state[i - 1] ^ (state[i - 1] >> 30)) + (uint)i;
    149167        state[i] &= 0xFFFFFFFFU;
     
    154172      seed(19650218U);
    155173      int i = 1, j = 0;
    156       for (int k = ((n > array.Length) ? n : array.Length); k > 0; --k) {
     174      for(int k = ((n > array.Length) ? n : array.Length); k > 0; --k) {
    157175        state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525U))
    158176          + array[j] + (uint)j;
     
    160178        ++j;
    161179        j %= array.Length;
    162         if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
    163       }
    164       for (int k = n - 1; k > 0; --k) {
     180        if((++i) == n) { state[0] = state[n - 1]; i = 1; }
     181      }
     182      for(int k = n - 1; k > 0; --k) {
    165183        state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941U)) - (uint)i;
    166184        state[i] &= 0xFFFFFFFFU;
    167         if ((++i) == n) { state[0] = state[n - 1]; i = 1; }
     185        if((++i) == n) { state[0] = state[n - 1]; i = 1; }
    168186      }
    169187      state[0] = 0x80000000U;
     
    174192    #region Random Number Generation Methods
    175193    private uint rand_int32() {
    176       if (p == n) gen_state();
     194      if(p == n) gen_state();
    177195      uint x = state[p++];
    178196      x ^= (x >> 11);
     
    202220    }
    203221    private void gen_state() {
    204       for (int i = 0; i < (n - m); ++i)
     222      for(int i = 0; i < (n - m); ++i)
    205223        state[i] = state[i + m] ^ twiddle(state[i], state[i + 1]);
    206       for (int i = n - m; i < (n - 1); ++i)
     224      for(int i = n - m; i < (n - 1); ++i)
    207225        state[i] = state[i + m - n] ^ twiddle(state[i], state[i + 1]);
    208226      state[n - 1] = state[m - 1] ^ twiddle(state[n - 1], state[0]);
  • branches/XmlTextWriterBranch/HeuristicLab.Random/NormalDistributedRandom.cs

    r2 r119  
    513513
    514514
    515     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    516       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    517 
    518       XmlNode muNode = document.CreateNode(XmlNodeType.Element, "Mu", null);
    519       muNode.InnerText = mu.ToString();
    520       node.AppendChild(muNode);
    521 
    522       XmlNode sigmaNode = document.CreateNode(XmlNodeType.Element, "Sigma", null);
    523       sigmaNode.InnerText = sigma.ToString();
    524       node.AppendChild(sigmaNode);
    525 
    526       node.AppendChild(PersistenceManager.Persist("UniformRandom", uniform, document, persistedObjects));
    527 
    528       return node;
     515    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     516    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     517
     518    //  XmlNode muNode = document.CreateNode(XmlNodeType.Element, "Mu", null);
     519    //  muNode.InnerText = mu.ToString();
     520    //  node.AppendChild(muNode);
     521
     522    //  XmlNode sigmaNode = document.CreateNode(XmlNodeType.Element, "Sigma", null);
     523    //  sigmaNode.InnerText = sigma.ToString();
     524    //  node.AppendChild(sigmaNode);
     525
     526    //  node.AppendChild(PersistenceManager.Persist("UniformRandom", uniform, document, persistedObjects));
     527
     528    //  return node;
     529    //}
     530    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     531      base.Persist(name, writer, persistedObjects);
     532      writer.WriteStartElement("Mu");
     533      writer.WriteValue(mu.ToString());
     534      writer.WriteEndElement();
     535      writer.WriteStartElement("Sigma");
     536      writer.WriteValue(sigma.ToString());
     537      writer.WriteEndElement();
     538      PersistenceManager.Persist("UniformRandom", uniform, writer, persistedObjects);
    529539    }
    530540
  • branches/XmlTextWriterBranch/HeuristicLab.Routing.TSP/TSPTour.cs

    r2 r119  
    7272
    7373    #region Persistence Methods
    74     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    75       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    76       node.AppendChild(PersistenceManager.Persist("Coordinates", Coordinates, document, persistedObjects));
    77       node.AppendChild(PersistenceManager.Persist("Tour", Tour, document, persistedObjects));
    78       return node;
     74    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     75    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     76    //  node.AppendChild(PersistenceManager.Persist("Coordinates", Coordinates, document, persistedObjects));
     77    //  node.AppendChild(PersistenceManager.Persist("Tour", Tour, document, persistedObjects));
     78    //  return node;
     79    //}
     80    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     81      base.Persist(name, writer, persistedObjects);
     82      PersistenceManager.Persist("Coordinates", Coordinates, writer, persistedObjects);
     83      PersistenceManager.Persist("Tour", Tour, writer, persistedObjects);
    7984    }
    8085    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.SGA/SGA.cs

    r65 r119  
    506506
    507507    #region Persistence Methods
    508     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    509       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    510       node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
    511       return node;
     508    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     509    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     510    //  node.AppendChild(PersistenceManager.Persist("Engine", Engine, document, persistedObjects));
     511    //  return node;
     512    //}
     513    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     514      base.Persist(name, writer, persistedObjects);
     515      PersistenceManager.Persist("Engine", Engine, writer, persistedObjects);
    512516    }
    513517    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs

    r77 r119  
    8181
    8282    #region IStorable Members
    83     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    84       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    85       node.AppendChild(PersistenceManager.Persist("Machings", machines, document, persistedObjects));
    86       node.AppendChild(PersistenceManager.Persist("Jobs", jobs, document, persistedObjects));
    87       node.AppendChild(PersistenceManager.Persist("Operations", operations, document, persistedObjects));
    88       return node;
     83    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     84    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     85    //  node.AppendChild(PersistenceManager.Persist("Machings", machines, document, persistedObjects));
     86    //  node.AppendChild(PersistenceManager.Persist("Jobs", jobs, document, persistedObjects));
     87    //  node.AppendChild(PersistenceManager.Persist("Operations", operations, document, persistedObjects));
     88    //  return node;
     89    //}
     90    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     91      base.Persist(name, writer, persistedObjects);
     92      PersistenceManager.Persist("Machines", machines, writer, persistedObjects);
     93      PersistenceManager.Persist("Jobs", jobs, writer, persistedObjects);
     94      PersistenceManager.Persist("Operations", operations, writer, persistedObjects);
    8995    }
    9096    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/Operation.cs

    r2 r119  
    139139    }
    140140
    141     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    142       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    143       node.AppendChild(PersistenceManager.Persist("Job", job, document, persistedObjects));
    144       node.AppendChild(PersistenceManager.Persist("OperationIndex", operationIndex, document, persistedObjects));
    145       node.AppendChild(PersistenceManager.Persist("Start", start, document, persistedObjects));
    146       node.AppendChild(PersistenceManager.Persist("Duration", duration, document, persistedObjects));
    147       node.AppendChild(PersistenceManager.Persist("Predecessors", predecessors, document, persistedObjects));
    148       node.AppendChild(PersistenceManager.Persist("Machines", machines, document, persistedObjects));
    149       return node;
     141    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     142    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     143    //  node.AppendChild(PersistenceManager.Persist("Job", job, document, persistedObjects));
     144    //  node.AppendChild(PersistenceManager.Persist("OperationIndex", operationIndex, document, persistedObjects));
     145    //  node.AppendChild(PersistenceManager.Persist("Start", start, document, persistedObjects));
     146    //  node.AppendChild(PersistenceManager.Persist("Duration", duration, document, persistedObjects));
     147    //  node.AppendChild(PersistenceManager.Persist("Predecessors", predecessors, document, persistedObjects));
     148    //  node.AppendChild(PersistenceManager.Persist("Machines", machines, document, persistedObjects));
     149    //  return node;
     150    //}
     151    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     152      base.Persist(name, writer, persistedObjects);
     153      PersistenceManager.Persist("Job", job, writer, persistedObjects);
     154      PersistenceManager.Persist("OperationIndex", operationIndex, writer, persistedObjects);
     155      PersistenceManager.Persist("Start", start, writer, persistedObjects);
     156      PersistenceManager.Persist("Duration", duration, writer, persistedObjects);
     157      PersistenceManager.Persist("Predecessors", predecessors, writer, persistedObjects);
     158      PersistenceManager.Persist("Machines", machines, writer, persistedObjects);
    150159    }
    151160
  • branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs

    r2 r119  
    6666    #region IStorable Members
    6767
    68     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    69       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    70       XmlAttribute machineAttribute = document.CreateAttribute("Machines");
    71       machineAttribute.Value = Machines.ToString();
    72       node.Attributes.Append(machineAttribute);
    73       for(int i = 0; i < Machines; i++) {
    74         node.AppendChild(PersistenceManager.Persist("Machine" + i.ToString(), schedule[i], document, persistedObjects));
    75       }
    76       return node;
     68    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     69    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     70    //  XmlAttribute machineAttribute = document.CreateAttribute("Machines");
     71    //  machineAttribute.Value = Machines.ToString();
     72    //  node.Attributes.Append(machineAttribute);
     73    //  for(int i = 0; i < Machines; i++) {
     74    //    node.AppendChild(PersistenceManager.Persist("Machine" + i.ToString(), schedule[i], document, persistedObjects));
     75    //  }
     76    //  return node;
     77    //}
     78    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     79      base.Persist(name, writer, persistedObjects);
     80      writer.WriteAttributeString("Machines", Machines.ToString());
     81      for(int i = 0; i < Machines; i++)
     82        PersistenceManager.Persist("Machine" + i.ToString(), schedule[i], writer, persistedObjects);
    7783    }
    7884
  • branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs

    r77 r119  
    6464
    6565    #region IStorable Members
    66     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    67       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    68       if(schedule != null) {
    69         node.AppendChild(PersistenceManager.Persist("Schedule", schedule, document, persistedObjects));
    70       }
    71       return node;
     66    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     67    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     68    //  if(schedule != null) {
     69    //    node.AppendChild(PersistenceManager.Persist("Schedule", schedule, document, persistedObjects));
     70    //  }
     71    //  return node;
     72    //}
     73    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     74      base.Persist(name, writer, persistedObjects);
     75      if(schedule != null)
     76        PersistenceManager.Persist("Schedule", schedule, writer, persistedObjects);
    7277    }
    7378    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
  • branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs

    r2 r119  
    208208
    209209    #region IStorable Members
    210     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    211       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    212       node.InnerText = this.ToString();
    213       return node;
     210    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
     211    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     212    //  node.InnerText = this.ToString();
     213    //  return node;
     214    //}
     215    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     216      base.Persist(name, writer, persistedObjects);
     217      writer.WriteValue(ToString());
    214218    }
    215219
  • branches/XmlTextWriterBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs

    r2 r119  
    6767
    6868    #region persistence
    69     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    70       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    71       node.AppendChild(PersistenceManager.Persist("Group", group, document, persistedObjects));
    72       return node;
     69    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     70    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     71    //  node.AppendChild(PersistenceManager.Persist("Group", group, document, persistedObjects));
     72    //  return node;
     73    //}
     74    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     75      base.Persist(name, writer, persistedObjects);
     76      PersistenceManager.Persist("Group", group, writer, persistedObjects);
    7377    }
    7478
  • branches/XmlTextWriterBranch/HeuristicLab.TestFunctions/HeuristicLab.TestFunctions.csproj

    r106 r119  
    8484    <EmbeddedResource Include="TestFunctionInjectorView.resx">
    8585      <DependentUpon>TestFunctionInjectorView.cs</DependentUpon>
     86      <SubType>Designer</SubType>
    8687    </EmbeddedResource>
    8788  </ItemGroup>
  • branches/XmlTextWriterBranch/HeuristicLab.ThreadParallelEngine/ThreadParallelEngine.cs

    r2 r119  
    176176
    177177    #region Persistence Methods
    178     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    179       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    180       XmlAttribute workersAttribute = document.CreateAttribute("Workers");
    181       workersAttribute.Value = Workers.ToString();
    182       node.Attributes.Append(workersAttribute);
    183       return node;
     178    //public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
     179    //  XmlNode node = base.GetXmlNode(name, document, persistedObjects);
     180    //  XmlAttribute workersAttribute = document.CreateAttribute("Workers");
     181    //  workersAttribute.Value = Workers.ToString();
     182    //  node.Attributes.Append(workersAttribute);
     183    //  return node;
     184    //}
     185    public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
     186      base.Persist(name, writer, persistedObjects);
     187      writer.WriteAttributeString("Workers", Workers.ToString());
    184188    }
    185189    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
Note: See TracChangeset for help on using the changeset viewer.