Changeset 119
- Timestamp:
- 04/14/08 17:49:47 (17 years ago)
- Location:
- branches/XmlTextWriterBranch
- Files:
-
- 60 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/XmlTextWriterBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs
r2 r119 84 84 85 85 #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); 90 90 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); 92 96 } 93 97 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/AndConstraint.cs
r40 r119 73 73 74 74 #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); 79 79 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); 81 85 } 82 86 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs
r2 r119 132 132 133 133 #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"); 155 164 } 156 165 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs
r2 r119 127 127 128 128 #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"); 150 159 } 151 160 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs
r40 r119 78 78 } 79 79 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)); 86 90 } 87 91 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/NotConstraint.cs
r2 r119 68 68 69 69 #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); 75 79 } 76 80 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs
r2 r119 79 79 80 80 #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); 88 93 } 89 94 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/OrConstraint.cs
r40 r119 74 74 75 75 #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); 80 80 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); 82 86 } 83 87 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs
r2 r119 108 108 109 109 #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> 121 129 } 122 130 -
branches/XmlTextWriterBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs
r2 r119 106 106 } 107 107 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); 117 123 } 118 124 -
branches/XmlTextWriterBranch/HeuristicLab.Core/AtomicOperation.cs
r2 r119 51 51 52 52 #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); 58 63 } 59 64 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/CompositeOperation.cs
r2 r119 59 59 60 60 #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); 66 66 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> 72 80 } 73 81 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs
r2 r119 87 87 88 88 #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> 96 106 } 97 return node;98 107 } 99 108 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/EngineBase.cs
r47 r119 172 172 173 173 #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"); 181 197 IOperation[] operations = new IOperation[ExecutionStack.Count]; 182 198 ExecutionStack.CopyTo(operations, 0); 183 199 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> 191 205 } 192 206 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs
r2 r119 32 32 object Clone(IDictionary<Guid, object> clonedObjects); 33 33 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); 35 36 void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects); 36 37 } -
branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorBase.cs
r76 r119 437 437 438 438 #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> 462 480 } 463 481 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGraph.cs
r47 r119 122 122 123 123 #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); 133 142 } 134 143 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGroup.cs
r2 r119 83 83 84 84 #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> 99 111 } 100 112 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorLibrary.cs
r2 r119 51 51 52 52 #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); 57 61 } 58 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/PersistenceManager.cs
r40 r119 28 28 namespace HeuristicLab.Core { 29 29 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); 34 37 } 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) { 39 39 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; 45 49 } else { 46 50 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; 49 56 } 50 57 } 58 51 59 public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 52 60 Guid guid = new Guid(node.Attributes["GUID"].Value); … … 67 75 } 68 76 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(); 72 83 } 73 84 public static IStorable Load(string filename) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/Scope.cs
r63 r119 259 259 260 260 #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) { 293 314 base.Populate(node, restoredObjects); 294 315 myName = node.Attributes["Name"].Value; -
branches/XmlTextWriterBranch/HeuristicLab.Core/StorableBase.cs
r40 r119 45 45 } 46 46 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()); 56 60 } 57 61 public virtual void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/Variable.cs
r2 r119 100 100 101 101 #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); 110 116 } 111 117 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Core/VariableInfo.cs
r40 r119 109 109 110 110 #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); 116 116 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); 120 120 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); 124 124 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); 128 128 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); 132 132 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); 136 136 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()); 138 147 } 139 148 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/BoolArrayData.cs
r2 r119 44 44 } 45 45 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()); 50 54 } 51 55 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/BoolData.cs
r2 r119 51 51 } 52 52 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()); 57 61 } 58 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/BoolMatrixData.cs
r2 r119 45 45 } 46 46 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()); 57 63 } 64 58 65 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 66 base.Populate(node, restoredObjects); -
branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedDoubleData.cs
r2 r119 56 56 } 57 57 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); 62 66 } 63 67 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedIntData.cs
r2 r119 56 56 } 57 57 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); 62 66 } 63 67 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/ConstrainedItemList.cs
r2 r119 55 55 } 56 56 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> 67 75 } 68 76 -
branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleArrayData.cs
r2 r119 45 45 } 46 46 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)); 51 55 } 52 56 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleData.cs
r2 r119 52 52 } 53 53 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)); 58 62 } 59 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/DoubleMatrixData.cs
r2 r119 45 45 } 46 46 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)); 57 63 } 58 64 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/IntArrayData.cs
r2 r119 45 45 } 46 46 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)); 51 55 } 52 56 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/IntData.cs
r2 r119 52 52 } 53 53 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)); 58 62 } 59 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/IntMatrixData.cs
r2 r119 45 45 } 46 46 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)); 57 63 } 58 64 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/ItemList_T.cs
r69 r119 50 50 } 51 51 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); 57 62 } 58 63 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Data/StringData.cs
r2 r119 51 51 } 52 52 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); 57 61 } 58 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.DataAnalysis/Dataset.cs
r2 r119 121 121 } 122 122 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)); 141 149 } 142 150 -
branches/XmlTextWriterBranch/HeuristicLab.DistributedEngine/DistributedEngine.cs
r36 r119 181 181 182 182 #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); 189 193 } 190 194 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.ES/ES.cs
r98 r119 601 601 602 602 #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); 607 611 } 608 612 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Functions/FunctionBase.cs
r2 r119 289 289 } 290 290 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> 308 320 } 309 321 -
branches/XmlTextWriterBranch/HeuristicLab.Grid/ProcessingEngine.cs
r27 r119 46 46 myExecutionStack.Push(initialOperation); 47 47 } 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); 52 56 } 53 57 -
branches/XmlTextWriterBranch/HeuristicLab.Logging/Linechart.cs
r2 r119 83 83 84 84 #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); 90 95 } 91 96 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Logging/Log.cs
r2 r119 59 59 60 60 #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); 65 69 } 66 70 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
r117 r119 192 192 193 193 #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(); 203 212 } 204 213 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Operators/CombinedOperator.cs
r89 r119 88 88 89 89 #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); 97 104 } 98 105 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Operators/VariableInjector.cs
r2 r119 108 108 109 109 #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 persisted113 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 //} 117 117 #endregion 118 118 } -
branches/XmlTextWriterBranch/HeuristicLab.Random/MersenneTwister.cs
r2 r119 48 48 49 49 public MersenneTwister() { 50 if 50 if(!init) seed((uint)DateTime.Now.Ticks); 51 51 init = true; 52 52 } … … 70 70 71 71 public void Reset() { 72 lock 72 lock(locker) 73 73 seed((uint)DateTime.Now.Ticks); 74 74 } 75 75 public void Reset(int s) { 76 lock 76 lock(locker) 77 77 seed((uint)s); 78 78 } 79 79 80 80 public int Next() { 81 lock 81 lock(locker) { 82 82 return (int)(rand_int32() >> 1); 83 83 } 84 84 } 85 85 public int Next(int maxVal) { 86 lock 87 if 86 lock(locker) { 87 if(maxVal <= 0) 88 88 throw new ArgumentException("The interval [0, " + maxVal + ") is empty"); 89 89 int limit = (Int32.MaxValue / maxVal) * maxVal; 90 90 int value = Next(); 91 while 91 while(value >= limit) value = Next(); 92 92 return value % maxVal; 93 93 } 94 94 } 95 95 public int Next(int minVal, int maxVal) { 96 lock 97 if 96 lock(locker) { 97 if(maxVal <= minVal) 98 98 throw new ArgumentException("The interval [" + minVal + ", " + maxVal + ") is empty"); 99 99 return Next(maxVal - minVal) + minVal; … … 101 101 } 102 102 public double NextDouble() { 103 lock 103 lock(locker) { 104 104 return rand_double53(); 105 105 } … … 107 107 108 108 #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); 112 134 StringBuilder builder = new StringBuilder(); 113 135 builder.Append(state[0]); 114 for 136 for(int i = 1; i < state.Length; i++) { 115 137 builder.Append(';'); 116 138 builder.Append(state[i]); 117 139 } 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) { 133 151 base.Populate(node, restoredObjects); 134 152 135 153 string stateString = node.SelectSingleNode("State").InnerText; 136 154 string[] tokens = stateString.Split(';'); 137 for 155 for(int i = 0; i < tokens.Length; i++) 138 156 state[i] = uint.Parse(tokens[i]); 139 157 p = int.Parse(node.SelectSingleNode("P").InnerText); … … 145 163 public void seed(uint s) { 146 164 state[0] = s & 0xFFFFFFFFU; 147 for 165 for(int i = 1; i < n; ++i) { 148 166 state[i] = 1812433253U * (state[i - 1] ^ (state[i - 1] >> 30)) + (uint)i; 149 167 state[i] &= 0xFFFFFFFFU; … … 154 172 seed(19650218U); 155 173 int i = 1, j = 0; 156 for 174 for(int k = ((n > array.Length) ? n : array.Length); k > 0; --k) { 157 175 state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1664525U)) 158 176 + array[j] + (uint)j; … … 160 178 ++j; 161 179 j %= array.Length; 162 if 163 } 164 for 180 if((++i) == n) { state[0] = state[n - 1]; i = 1; } 181 } 182 for(int k = n - 1; k > 0; --k) { 165 183 state[i] = (state[i] ^ ((state[i - 1] ^ (state[i - 1] >> 30)) * 1566083941U)) - (uint)i; 166 184 state[i] &= 0xFFFFFFFFU; 167 if 185 if((++i) == n) { state[0] = state[n - 1]; i = 1; } 168 186 } 169 187 state[0] = 0x80000000U; … … 174 192 #region Random Number Generation Methods 175 193 private uint rand_int32() { 176 if 194 if(p == n) gen_state(); 177 195 uint x = state[p++]; 178 196 x ^= (x >> 11); … … 202 220 } 203 221 private void gen_state() { 204 for 222 for(int i = 0; i < (n - m); ++i) 205 223 state[i] = state[i + m] ^ twiddle(state[i], state[i + 1]); 206 for 224 for(int i = n - m; i < (n - 1); ++i) 207 225 state[i] = state[i + m - n] ^ twiddle(state[i], state[i + 1]); 208 226 state[n - 1] = state[m - 1] ^ twiddle(state[n - 1], state[0]); -
branches/XmlTextWriterBranch/HeuristicLab.Random/NormalDistributedRandom.cs
r2 r119 513 513 514 514 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); 529 539 } 530 540 -
branches/XmlTextWriterBranch/HeuristicLab.Routing.TSP/TSPTour.cs
r2 r119 72 72 73 73 #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); 79 84 } 80 85 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.SGA/SGA.cs
r65 r119 506 506 507 507 #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); 512 516 } 513 517 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs
r77 r119 81 81 82 82 #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); 89 95 } 90 96 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/Operation.cs
r2 r119 139 139 } 140 140 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); 150 159 } 151 160 -
branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs
r2 r119 66 66 #region IStorable Members 67 67 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); 77 83 } 78 84 -
branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs
r77 r119 64 64 65 65 #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); 72 77 } 73 78 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { -
branches/XmlTextWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs
r2 r119 208 208 209 209 #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()); 214 218 } 215 219 -
branches/XmlTextWriterBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs
r2 r119 67 67 68 68 #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); 73 77 } 74 78 -
branches/XmlTextWriterBranch/HeuristicLab.TestFunctions/HeuristicLab.TestFunctions.csproj
r106 r119 84 84 <EmbeddedResource Include="TestFunctionInjectorView.resx"> 85 85 <DependentUpon>TestFunctionInjectorView.cs</DependentUpon> 86 <SubType>Designer</SubType> 86 87 </EmbeddedResource> 87 88 </ItemGroup> -
branches/XmlTextWriterBranch/HeuristicLab.ThreadParallelEngine/ThreadParallelEngine.cs
r2 r119 176 176 177 177 #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()); 184 188 } 185 189 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
Note: See TracChangeset
for help on using the changeset viewer.