- Timestamp:
- 04/15/08 16:41:18 (17 years ago)
- Location:
- branches/XmlReaderWriterBranch
- Files:
-
- 60 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs
r119 r125 96 96 } 97 97 98 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 99 base.Populate(node, restoredObjects); 100 groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects); 98 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 99 // base.Populate(node, restoredObjects); 100 // groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects); 101 //} 102 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 103 base.Populate(reader, restoredObjects); 104 reader.Read(); 105 groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(reader, "SubOperatorsGroupConstraint", restoredObjects); 106 reader.Read(); 101 107 } 102 108 #endregion persistence -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/AndConstraint.cs
r119 r125 85 85 } 86 86 87 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 88 base.Populate(node, restoredObjects); 89 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 87 //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 88 // base.Populate(node, restoredObjects); 89 // clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 90 //} 91 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 92 base.Populate(reader, restoredObjects); 93 reader.Read(); 94 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects); 95 reader.Read(); 90 96 } 91 97 #endregion persistence -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs
r119 r125 164 164 } 165 165 166 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 167 base.Populate(node, restoredObjects); 168 lowerBound = double.Parse(node.Attributes["LowerBound"].Value); 169 if (node.Attributes["LowerBoundIncluded"] != null) { 170 lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 166 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 167 // base.Populate(node, restoredObjects); 168 // lowerBound = double.Parse(node.Attributes["LowerBound"].Value); 169 // if(node.Attributes["LowerBoundIncluded"] != null) { 170 // lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 171 // } else { 172 // lowerBoundIncluded = true; 173 // } 174 // if(node.Attributes["LowerBoundEnabled"] != null) { 175 // lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value); 176 // } else { 177 // lowerBoundEnabled = true; 178 // } 179 180 // upperBound = double.Parse(node.Attributes["UpperBound"].Value); 181 // if(node.Attributes["UpperBoundIncluded"] != null) { 182 // upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value); 183 // } else { 184 // upperBoundIncluded = true; 185 // } 186 // if(node.Attributes["UpperBoundEnabled"] != null) { 187 // upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value); 188 // } else { 189 // upperBoundEnabled = true; 190 // } 191 //} 192 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 193 lowerBound = double.Parse(reader["LowerBound"]); 194 if(reader["LowerBoundIncluded"] != null) { 195 lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]); 171 196 } else { 172 197 lowerBoundIncluded = true; 173 198 } 174 if (node.Attributes["LowerBoundEnabled"] != null) {175 lowerBoundEnabled = bool.Parse( node.Attributes["LowerBoundEnabled"].Value);199 if(reader["LowerBoundEnabled"] != null) { 200 lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]); 176 201 } else { 177 202 lowerBoundEnabled = true; 178 203 } 179 204 180 upperBound = double.Parse( node.Attributes["UpperBound"].Value);181 if (node.Attributes["UpperBoundIncluded"] != null) {182 upperBoundIncluded = bool.Parse( node.Attributes["UpperBoundIncluded"].Value);205 upperBound = double.Parse(reader["UpperBound"]); 206 if(reader["UpperBoundIncluded"] != null) { 207 upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]); 183 208 } else { 184 209 upperBoundIncluded = true; 185 210 } 186 if (node.Attributes["UpperBoundEnabled"] != null) {187 upperBoundEnabled = bool.Parse( node.Attributes["UpperBoundEnabled"].Value);211 if(reader["UpperBoundEnabled"] != null) { 212 upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]); 188 213 } else { 189 214 upperBoundEnabled = true; 190 215 } 216 base.Populate(reader, restoredObjects); 191 217 } 192 218 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs
r119 r125 159 159 } 160 160 161 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 162 base.Populate(node, restoredObjects); 163 lowerBound = int.Parse(node.Attributes["LowerBound"].Value); 164 if (node.Attributes["LowerBoundIncluded"] != null) { 165 lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 161 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 162 // base.Populate(node, restoredObjects); 163 // lowerBound = int.Parse(node.Attributes["LowerBound"].Value); 164 // if (node.Attributes["LowerBoundIncluded"] != null) { 165 // lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 166 // } else { 167 // lowerBoundIncluded = true; 168 // } 169 // if (node.Attributes["LowerBoundEnabled"] != null) { 170 // lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value); 171 // } else { 172 // lowerBoundEnabled = true; 173 // } 174 175 // upperBound = int.Parse(node.Attributes["UpperBound"].Value); 176 // if (node.Attributes["UpperBoundIncluded"] != null) { 177 // upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value); 178 // } else { 179 // upperBoundIncluded = true; 180 // } 181 // if (node.Attributes["UpperBoundEnabled"] != null) { 182 // upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value); 183 // } else { 184 // upperBoundEnabled = true; 185 // } 186 //} 187 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 188 lowerBound = int.Parse(reader["LowerBound"]); 189 if(reader["LowerBoundIncluded"] != null) { 190 lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]); 166 191 } else { 167 192 lowerBoundIncluded = true; 168 193 } 169 if (node.Attributes["LowerBoundEnabled"] != null) {170 lowerBoundEnabled = bool.Parse( node.Attributes["LowerBoundEnabled"].Value);194 if(reader["LowerBoundEnabled"] != null) { 195 lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]); 171 196 } else { 172 197 lowerBoundEnabled = true; 173 198 } 174 199 175 upperBound = int.Parse( node.Attributes["UpperBound"].Value);176 if (node.Attributes["UpperBoundIncluded"] != null) {177 upperBoundIncluded = bool.Parse( node.Attributes["UpperBoundIncluded"].Value);200 upperBound = int.Parse(reader["UpperBound"]); 201 if(reader["UpperBoundIncluded"] != null) { 202 upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]); 178 203 } else { 179 204 upperBoundIncluded = true; 180 205 } 181 if (node.Attributes["UpperBoundEnabled"] != null) {182 upperBoundEnabled = bool.Parse( node.Attributes["UpperBoundEnabled"].Value);206 if(reader["UpperBoundEnabled"] != null) { 207 upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]); 183 208 } else { 184 209 upperBoundEnabled = true; 185 210 } 186 } 211 base.Populate(reader, restoredObjects); 212 } 213 187 214 #endregion 188 215 } -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs
r119 r125 90 90 } 91 91 92 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 93 base.Populate(node, restoredObjects); 94 XmlAttribute itemTypeAttribute = node.Attributes["ItemType"]; 95 type = Type.GetType(itemTypeAttribute.Value); 92 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 93 // base.Populate(node, restoredObjects); 94 // XmlAttribute itemTypeAttribute = node.Attributes["ItemType"]; 95 // type = Type.GetType(itemTypeAttribute.Value); 96 //} 97 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 98 type = Type.GetType(reader["ItemType"]); 99 base.Populate(reader, restoredObjects); 96 100 } 97 101 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/NotConstraint.cs
r119 r125 79 79 } 80 80 81 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 82 base.Populate(node, restoredObjects); 83 subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects); 81 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 82 // base.Populate(node, restoredObjects); 83 // subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects); 84 //} 85 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(reader, restoredObjects); 87 reader.Read(); 88 subConstraint = (ConstraintBase)PersistenceManager.Restore(reader, "SubConstraint", restoredObjects); 89 reader.Read(); 84 90 } 85 91 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs
r119 r125 93 93 } 94 94 95 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 96 base.Populate(node, restoredObjects); 97 minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects); 98 maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects); 95 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 96 // base.Populate(node, restoredObjects); 97 // minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects); 98 // maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects); 99 //} 100 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 101 base.Populate(reader, restoredObjects); 102 reader.Read(); 103 minOperators = (IntData)PersistenceManager.Restore(reader, "min", restoredObjects); 104 reader.Read(); 105 maxOperators = (IntData)PersistenceManager.Restore(reader, "max", restoredObjects); 106 reader.Read(); 99 107 } 100 108 #endregion persistence -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/OrConstraint.cs
r119 r125 86 86 } 87 87 88 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 89 base.Populate(node, restoredObjects); 90 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 88 //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 89 // base.Populate(node, restoredObjects); 90 // clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 91 //} 92 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 93 base.Populate(reader, restoredObjects); 94 reader.Read(); 95 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects); 96 reader.Read(); 91 97 } 92 98 #endregion persistence -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs
r119 r125 129 129 } 130 130 131 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 132 base.Populate(node, restoredObjects); 133 subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); 131 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 132 // base.Populate(node, restoredObjects); 133 // subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); 134 // subOperators = new List<IOperator>(); 135 // foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) { 136 // subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects)); 137 // } 138 //} 139 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 140 base.Populate(reader, restoredObjects); 141 reader.Read(); 142 subOperatorIndex = (IntData)PersistenceManager.Restore(reader, "SubOperatorIndex", restoredObjects); 143 reader.Read(); 134 144 subOperators = new List<IOperator>(); 135 foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) { 136 subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects)); 145 if(reader.Name !="AllowedSubOperators") throw new XmlException("Expected: \"AllowedSubOperators\", found: \""+reader.Name+"\""); 146 if(!reader.IsEmptyElement) { 147 reader.Read(); 148 while(reader.IsStartElement()) { 149 subOperators.Add((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 150 reader.Skip(); 151 } 152 reader.ReadEndElement(); 153 } else { 154 reader.Read(); 137 155 } 138 156 } -
branches/XmlReaderWriterBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs
r119 r125 123 123 } 124 124 125 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 126 base.Populate(node, restoredObjects); 127 leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects); 128 rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects); 129 comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects); 125 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 126 // base.Populate(node, restoredObjects); 127 // leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects); 128 // rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects); 129 // comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects); 130 //} 131 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 132 base.Populate(reader, restoredObjects); 133 reader.Read(); 134 leftVarName = (StringData)PersistenceManager.Restore(reader, "LeftVarName", restoredObjects); 135 reader.Skip(); 136 rightVarName = (StringData)PersistenceManager.Restore(reader, "RightVarName", restoredObjects); 137 reader.Skip(); 138 comparer = (IntData)PersistenceManager.Restore(reader, "Comparer", restoredObjects); 139 reader.Read(); 130 140 } 131 141 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/AtomicOperation.cs
r119 r125 62 62 PersistenceManager.Persist("Scope", Scope, writer, persistedObjects); 63 63 } 64 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 65 base.Populate(node, restoredObjects); 66 myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects); 67 myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects); 64 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 65 // base.Populate(node, restoredObjects); 66 // myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects); 67 // myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects); 68 //} 69 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 70 base.Populate(reader, restoredObjects); 71 reader.Read(); 72 myOperator = (IOperator)PersistenceManager.Restore(reader, "Operator", restoredObjects); 73 reader.Skip(); 74 myScope = (IScope)PersistenceManager.Restore(reader, "Scope", restoredObjects); 75 reader.Read(); 68 76 } 69 77 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/CompositeOperation.cs
r119 r125 79 79 writer.WriteEndElement(); // </Operations> 80 80 } 81 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {82 base.Populate(node, restoredObjects);81 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 82 // base.Populate(node, restoredObjects); 83 83 84 myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);84 // myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value); 85 85 86 XmlNode operationsNode = node.SelectSingleNode("Operations"); 87 for (int i = 0; i < operationsNode.ChildNodes.Count; i++) 88 AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects)); 86 // XmlNode operationsNode = node.SelectSingleNode("Operations"); 87 // for (int i = 0; i < operationsNode.ChildNodes.Count; i++) 88 // AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects)); 89 //} 90 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 91 myExecuteInParallel = bool.Parse(reader["ExecuteInParallel"]); 92 base.Populate(reader, restoredObjects); 93 94 if(reader.Name != "Operations") throw new XmlException("Expected: \"Operations\", found: \""+reader.Name+"\""); 95 if(!reader.IsEmptyElement) { 96 reader.Read(); 97 while(reader.IsStartElement()) { 98 AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects)); 99 reader.Skip(); 100 } 101 reader.ReadEndElement(); 102 } else { 103 reader.Read(); 104 } 89 105 } 90 106 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs
r119 r125 39 39 ConstrainedItemBase clone = (ConstrainedItemBase)base.Clone(clonedObjects); 40 40 clone.myConstraints.Clear(); 41 foreach 41 foreach(IConstraint constraint in Constraints) 42 42 clone.AddConstraint((IConstraint)Auxiliary.Clone(constraint, clonedObjects)); 43 43 return clone; … … 49 49 } 50 50 public virtual void RemoveConstraint(IConstraint constraint) { 51 if 51 if(myConstraints.Remove(constraint)) 52 52 OnConstraintRemoved(constraint); 53 53 } … … 55 55 public bool IsValid() { 56 56 bool result = true; 57 foreach 57 foreach(IConstraint constraint in Constraints) 58 58 result = result && constraint.Check(this); 59 59 return result; … … 62 62 bool result = true; 63 63 violatedConstraints = new List<IConstraint>(); 64 foreach 65 if 64 foreach(IConstraint constraint in Constraints) { 65 if(!constraint.Check(this)) { 66 66 result = false; 67 67 violatedConstraints.Add(constraint); … … 77 77 public event EventHandler<ConstraintEventArgs> ConstraintAdded; 78 78 protected virtual void OnConstraintAdded(IConstraint constraint) { 79 if 79 if(ConstraintAdded != null) 80 80 ConstraintAdded(this, new ConstraintEventArgs(constraint)); 81 81 } 82 82 public event EventHandler<ConstraintEventArgs> ConstraintRemoved; 83 83 protected virtual void OnConstraintRemoved(IConstraint constraint) { 84 if 84 if(ConstraintRemoved != null) 85 85 ConstraintRemoved(this, new ConstraintEventArgs(constraint)); 86 86 } … … 106 106 } 107 107 } 108 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 109 base.Populate(node, restoredObjects); 110 XmlNode constraintsNode = node.SelectSingleNode("Constraints"); 111 if (constraintsNode != null) { 108 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 109 // base.Populate(node, restoredObjects); 110 // XmlNode constraintsNode = node.SelectSingleNode("Constraints"); 111 // if(constraintsNode != null) { 112 // myConstraints.Clear(); 113 // foreach(XmlNode constraintNode in constraintsNode.ChildNodes) 114 // AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects)); 115 // } 116 //} 117 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 118 base.Populate(reader, restoredObjects); 119 reader.Read(); 120 if(reader.Name == "Constraints") { 112 121 myConstraints.Clear(); 113 foreach (XmlNode constraintNode in constraintsNode.ChildNodes) 114 AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects)); 122 reader.Read(); 123 while(reader.IsStartElement()) { 124 AddConstraint((IConstraint)PersistenceManager.Restore(reader, restoredObjects)); 125 reader.Skip(); 126 } 127 reader.ReadEndElement(); 115 128 } 116 129 } -
branches/XmlReaderWriterBranch/HeuristicLab.Core/EngineBase.cs
r119 r125 204 204 writer.WriteEndElement(); // </ExecutionTime> 205 205 } 206 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 207 base.Populate(node, restoredObjects); 208 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 209 myGlobalScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("GlobalScope"), restoredObjects); 210 211 XmlNode stackNode = node.SelectSingleNode("ExecutionStack"); 212 for (int i = stackNode.ChildNodes.Count - 1; i >= 0; i--) 213 myExecutionStack.Push((IOperation)PersistenceManager.Restore(stackNode.ChildNodes[i], restoredObjects)); 214 215 XmlNode timeNode = node.SelectSingleNode("ExecutionTime"); 216 myExecutionTime = TimeSpan.Parse(timeNode.InnerText); 206 public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 207 base.Populate(reader, restoredObjects); 208 reader.Read(); 209 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects); 210 reader.Skip(); 211 myGlobalScope = (IScope)PersistenceManager.Restore(reader, "GlobalScope", restoredObjects); 212 reader.Skip(); 213 if(reader.Name!="ExecutionStack") throw new XmlException("Expected \"ExecutionStack\", found: \""+reader.Name+"\""); 214 List<IOperation> operationList = new List<IOperation>(); 215 if(!reader.IsEmptyElement) { 216 reader.Read(); 217 while(reader.IsStartElement()) { 218 operationList.Insert(0, (IOperation)PersistenceManager.Restore(reader, restoredObjects)); 219 reader.Skip(); 220 } 221 reader.ReadEndElement(); 222 } else { 223 reader.Read(); 224 } 225 foreach(IOperation op in operationList) 226 myExecutionStack.Push(op); 227 myExecutionTime = TimeSpan.Parse(reader.ReadElementString("ExecutionTime")); 217 228 } 218 229 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs
r119 r125 34 34 //XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects); 35 35 void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects); 36 void Populate(Xml Node node, IDictionary<Guid, IStorable> restoredObjects);36 void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects); 37 37 } 38 38 } -
branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorBase.cs
r124 r125 480 480 writer.WriteEndElement(); // </Variables> 481 481 } 482 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 483 base.Populate(node, restoredObjects); 484 myName = node.Attributes["Name"].Value; 485 if (node.Attributes["Breakpoint"] != null) 486 myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value); 487 XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators"); 488 for (int i = 0; i < subOperatorsNode.ChildNodes.Count; i++) 489 AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects)); 490 XmlNode infosNode = node.SelectSingleNode("VariableInfos"); 482 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 483 // base.Populate(node, restoredObjects); 484 // myName = node.Attributes["Name"].Value; 485 // if(node.Attributes["Breakpoint"] != null) 486 // myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value); 487 // XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators"); 488 // for(int i = 0; i < subOperatorsNode.ChildNodes.Count; i++) 489 // AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects)); 490 // XmlNode infosNode = node.SelectSingleNode("VariableInfos"); 491 // myVariableInfos.Clear(); 492 // foreach(XmlNode infoNode in infosNode.ChildNodes) 493 // AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects)); 494 // XmlNode variablesNode = node.SelectSingleNode("Variables"); 495 // myVariables.Clear(); 496 // foreach(XmlNode variableNode in variablesNode.ChildNodes) 497 // AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 498 //} 499 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 500 myName = reader["Name"]; 501 if(reader["Breakpoint"] != null) 502 myBreakpoint = bool.Parse(reader["Breakpoint"]); 503 504 base.Populate(reader, restoredObjects); 505 // constraintItemBase already reads to the next subelement 506 if(reader.Name != "SubOperators") throw new XmlException("Expected: \"SubOperators\" found: \"" + reader.Name+"\""); 507 if(!reader.IsEmptyElement) { 508 reader.Read(); 509 while(reader.IsStartElement()) { 510 AddSubOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 511 reader.Skip(); 512 } 513 reader.ReadEndElement(); 514 } else { 515 reader.Read(); 516 } 517 if(reader.Name != "VariableInfos") throw new XmlException("Expected: \"VariableInfos\" found: \"" + reader.Name+"\""); 491 518 myVariableInfos.Clear(); 492 foreach (XmlNode infoNode in infosNode.ChildNodes) 493 AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects)); 494 XmlNode variablesNode = node.SelectSingleNode("Variables"); 519 if(!reader.IsEmptyElement) { 520 reader.Read(); 521 while(reader.IsStartElement()) { 522 AddVariableInfo((IVariableInfo)PersistenceManager.Restore(reader, restoredObjects)); 523 reader.Skip(); 524 } 525 reader.ReadEndElement(); 526 } else { 527 reader.Read(); 528 } 529 if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\" found: \"" + reader.Name + "\""); 495 530 myVariables.Clear(); 496 foreach (XmlNode variableNode in variablesNode.ChildNodes) 497 AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 531 if(!reader.IsEmptyElement) { 532 reader.Read(); 533 while(reader.IsStartElement()) { 534 AddVariable((IVariable)PersistenceManager.Restore(reader, restoredObjects)); 535 reader.Skip(); 536 } 537 reader.ReadEndElement(); 538 } else { 539 reader.Read(); 540 } 498 541 } 499 542 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGraph.cs
r119 r125 35 35 get { return myInitialOperator; } 36 36 set { 37 if 37 if(myInitialOperator != value) { 38 38 myInitialOperator = value; 39 39 OnInitialOperatorChanged(); … … 53 53 OperatorGraph clone = new OperatorGraph(); 54 54 clonedObjects.Add(Guid, clone); 55 foreach 55 foreach(IOperator op in Operators) 56 56 clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); 57 if 57 if(InitialOperator != null) 58 58 clone.myInitialOperator = (IOperator)Auxiliary.Clone(InitialOperator, clonedObjects); 59 59 return clone; … … 61 61 62 62 public void AddOperator(IOperator op) { 63 if 63 if(!myOperators.ContainsKey(op.Guid)) { 64 64 myOperators.Add(op.Guid, op); 65 65 OnOperatorAdded(op); 66 66 67 foreach 67 foreach(IOperator subOperator in op.SubOperators) 68 68 AddOperator(subOperator); 69 69 } … … 71 71 public void RemoveOperator(Guid guid) { 72 72 IOperator op = GetOperator(guid); 73 if 74 foreach 73 if(op != null) { 74 foreach(IOperator o in Operators) { 75 75 int i = 0; 76 while 77 if 76 while(i < o.SubOperators.Count) { 77 if(o.SubOperators[i] == op) 78 78 o.RemoveSubOperator(i); 79 79 else … … 81 81 } 82 82 } 83 if 83 if(InitialOperator == op) 84 84 InitialOperator = null; 85 85 myOperators.Remove(op.Guid); … … 89 89 public IOperator GetOperator(Guid guid) { 90 90 IOperator op; 91 if 91 if(myOperators.TryGetValue(guid, out op)) 92 92 return op; 93 93 else … … 97 97 Guid[] guids = new Guid[Operators.Count]; 98 98 int i = 0; 99 foreach 99 foreach(IOperator op in Operators) { 100 100 guids[i] = op.Guid; 101 101 i++; 102 102 } 103 for 103 for(int j = 0; j < guids.Length; j++) 104 104 RemoveOperator(guids[j]); 105 105 } … … 107 107 public event EventHandler<OperatorEventArgs> OperatorAdded; 108 108 protected virtual void OnOperatorAdded(IOperator op) { 109 if 109 if(OperatorAdded != null) 110 110 OperatorAdded(this, new OperatorEventArgs(op)); 111 111 } 112 112 public event EventHandler<OperatorEventArgs> OperatorRemoved; 113 113 protected virtual void OnOperatorRemoved(IOperator op) { 114 if 114 if(OperatorRemoved != null) 115 115 OperatorRemoved(this, new OperatorEventArgs(op)); 116 116 } 117 117 public event EventHandler InitialOperatorChanged; 118 118 protected virtual void OnInitialOperatorChanged() { 119 if 119 if(InitialOperatorChanged != null) 120 120 InitialOperatorChanged(this, new EventArgs()); 121 121 } … … 141 141 PersistenceManager.Persist("InitialOperator", InitialOperator, writer, persistedObjects); 142 142 } 143 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {144 base.Populate(node, restoredObjects);143 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 144 // base.Populate(node, restoredObjects); 145 145 146 XmlNode ops = node.SelectSingleNode("Operators"); 147 for (int i = 0; i < ops.ChildNodes.Count; i++) { 148 XmlNode opNode = ops.ChildNodes[i]; 149 IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects); 146 // XmlNode ops = node.SelectSingleNode("Operators"); 147 // for(int i = 0; i < ops.ChildNodes.Count; i++) { 148 // XmlNode opNode = ops.ChildNodes[i]; 149 // IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects); 150 // myOperators.Add(op.Guid, op); 151 // } 152 153 // XmlNode initial = node.SelectSingleNode("InitialOperator"); 154 // if(initial != null) 155 // myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects); 156 //} 157 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 158 base.Populate(reader, restoredObjects); 159 160 reader.Read(); 161 if(reader.Name != "Operators") throw new XmlException("Expected: Operators found: " + reader.Name); 162 reader.Read(); 163 while(reader.IsStartElement()) { 164 IOperator op = (IOperator)PersistenceManager.Restore(reader, restoredObjects); 165 reader.Skip(); 150 166 myOperators.Add(op.Guid, op); 151 167 } 152 153 XmlNode initial = node.SelectSingleNode("InitialOperator");154 if (initial != null)155 myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);168 reader.ReadEndElement(); 169 if(reader.IsStartElement()) { 170 myInitialOperator = (IOperator)PersistenceManager.Restore(reader, "InitialOperator", restoredObjects); 171 } 156 172 } 157 173 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGroup.cs
r119 r125 110 110 writer.WriteEndElement(); // </Operators> 111 111 } 112 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 113 base.Populate(node, restoredObjects); 114 myName = node.Attributes["Name"].Value; 115 XmlNode subGroupsNode = node.SelectSingleNode("SubGroups"); 116 foreach (XmlNode subGroupNode in subGroupsNode.ChildNodes) 117 AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects)); 118 XmlNode operatorsNode = node.SelectSingleNode("Operators"); 119 foreach (XmlNode operatorNode in operatorsNode.ChildNodes) 120 AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects)); 112 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 113 // base.Populate(node, restoredObjects); 114 // myName = node.Attributes["Name"].Value; 115 // XmlNode subGroupsNode = node.SelectSingleNode("SubGroups"); 116 // foreach(XmlNode subGroupNode in subGroupsNode.ChildNodes) 117 // AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects)); 118 // XmlNode operatorsNode = node.SelectSingleNode("Operators"); 119 // foreach(XmlNode operatorNode in operatorsNode.ChildNodes) 120 // AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects)); 121 //} 122 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 123 myName = reader["Name"]; 124 base.Populate(reader, restoredObjects); 125 reader.Read(); 126 if(reader.Name != "SubGroups") throw new XmlException("Expected: \"SubGroups\", found: \"" + reader.Name + "\""); 127 if(!reader.IsEmptyElement) { 128 reader.Read(); 129 while(reader.IsStartElement()) { 130 AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects)); 131 reader.Skip(); 132 } 133 reader.ReadEndElement(); 134 } else { 135 reader.Read(); 136 } 137 if(reader.Name != "Operators") throw new XmlException("Expected: \"Operators\", found: \"" + reader.Name + "\""); 138 if(!reader.IsEmptyElement) { 139 reader.Read(); 140 while(reader.IsStartElement()) { 141 AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 142 reader.Skip(); 143 } 144 reader.ReadEndElement(); 145 } else { 146 reader.Read(); 147 } 121 148 } 122 149 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorLibrary.cs
r119 r125 60 60 PersistenceManager.Persist("OperatorGroup", Group, writer, persistedObjects); 61 61 } 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 63 base.Populate(node, restoredObjects); 64 myGroup = (IOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("OperatorGroup"), restoredObjects); 62 public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 reader.Read(); 65 myGroup = (IOperatorGroup)PersistenceManager.Restore(reader, "OperatorGroup", restoredObjects); 66 reader.Read(); 65 67 } 66 68 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/PersistenceManager.cs
r119 r125 57 57 } 58 58 59 public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 60 Guid guid = new Guid(node.Attributes["GUID"].Value); 61 if (restoredObjects.ContainsKey(guid)) { 59 public static IStorable Restore(XmlReader reader, string elementName, IDictionary<Guid, IStorable> restoredObjects) { 60 reader = reader.ReadSubtree(); 61 reader.Read(); 62 if(reader.Name != elementName) throw new XmlException("Expected: \"" + elementName + "\" found: \"" + reader.Name+"\""); 63 IStorable result = RestoreElement(reader, restoredObjects); 64 reader.Read(); 65 reader.Close(); 66 return result; 67 } 68 69 public static IStorable Restore(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 70 reader = reader.ReadSubtree(); 71 reader.Read(); 72 IStorable result = RestoreElement(reader, restoredObjects); 73 reader.Read(); 74 reader.Close(); 75 return result; 76 } 77 private static IStorable RestoreElement(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 78 Guid guid = new Guid(reader["GUID"]); 79 if(restoredObjects.ContainsKey(guid)) { 62 80 return restoredObjects[guid]; 63 81 } else { 64 Type type = Type.GetType( node.Attributes["Type"].Value, true);82 Type type = Type.GetType(reader["Type"], true); 65 83 IStorable instance = (IStorable)Activator.CreateInstance(type); 66 84 restoredObjects.Add(guid, instance); 67 instance.Populate( node, restoredObjects);85 instance.Populate(reader, restoredObjects); 68 86 return instance; 69 87 } … … 89 107 } 90 108 public static IStorable Load(Stream stream) { 91 XmlDocument doc = new XmlDocument(); 92 doc.Load(stream); 93 return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>()); 109 XmlReaderSettings settings = new XmlReaderSettings(); 110 settings.IgnoreComments = true; 111 settings.IgnoreWhitespace = true; 112 XmlReader reader = XmlReader.Create(stream, settings); 113 reader.MoveToContent(); // read "<?xml version="1.0"?/> 114 return PersistenceManager.RestoreElement(reader, new Dictionary<Guid, IStorable>()); 94 115 } 95 116 -
branches/XmlReaderWriterBranch/HeuristicLab.Core/Scope.cs
r119 r125 311 311 writer.WriteEndElement(); // </SubScopes> 312 312 } 313 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 314 base.Populate(node, restoredObjects); 315 myName = node.Attributes["Name"].Value; 316 317 XmlNode variables = node.SelectSingleNode("Variables"); 318 foreach (XmlNode variableNode in variables.ChildNodes) { 319 IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects); 320 AddVariable(variable); 321 } 322 323 XmlNode aliases = node.SelectSingleNode("Aliases"); 324 if (aliases != null) { 325 foreach (XmlNode aliasNode in aliases.ChildNodes) 326 AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value); 327 } 328 329 XmlNode subScopes = node.SelectSingleNode("SubScopes"); 330 for (int i = 0; i < subScopes.ChildNodes.Count; i++) { 331 IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects); 332 AddSubScope(scope); 313 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 314 // base.Populate(node, restoredObjects); 315 // myName = node.Attributes["Name"].Value; 316 317 // XmlNode variables = node.SelectSingleNode("Variables"); 318 // foreach(XmlNode variableNode in variables.ChildNodes) { 319 // IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects); 320 // AddVariable(variable); 321 // } 322 323 // XmlNode aliases = node.SelectSingleNode("Aliases"); 324 // if(aliases != null) { 325 // foreach(XmlNode aliasNode in aliases.ChildNodes) 326 // AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value); 327 // } 328 329 // XmlNode subScopes = node.SelectSingleNode("SubScopes"); 330 // for(int i = 0; i < subScopes.ChildNodes.Count; i++) { 331 // IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects); 332 // AddSubScope(scope); 333 // } 334 //} 335 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 336 myName = reader["Name"]; 337 base.Populate(reader, restoredObjects); 338 reader.Read(); 339 if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\", found: \""+reader.Name+"\""); 340 if(!reader.IsEmptyElement) { 341 reader.Read(); 342 while(reader.IsStartElement()) { 343 IVariable variable = (IVariable)PersistenceManager.Restore(reader, restoredObjects); 344 reader.Skip(); 345 AddVariable(variable); 346 } 347 reader.ReadEndElement(); 348 } else { 349 reader.Read(); 350 } 351 if(reader.Name == "Aliases" && !reader.IsEmptyElement) { 352 reader.Read(); 353 while(reader.IsStartElement()) { 354 AddAlias(reader["Alias"], reader["Name"]); 355 } 356 reader.ReadEndElement(); 357 } else { 358 reader.Read(); 359 } 360 if(reader.Name != "SubScopes") throw new XmlException("Expected: \"SubScopes\", found: \"" + reader.Name + "\""); 361 if(!reader.IsEmptyElement) { 362 reader.Read(); 363 while(reader.IsStartElement()) { 364 IScope scope = (IScope)PersistenceManager.Restore(reader, restoredObjects); 365 reader.Skip(); 366 AddSubScope(scope); 367 } 368 reader.ReadEndElement(); 369 } else { 370 reader.Read(); 333 371 } 334 372 } -
branches/XmlReaderWriterBranch/HeuristicLab.Core/StorableBase.cs
r119 r125 59 59 writer.WriteAttributeString("GUID", Guid.ToString()); 60 60 } 61 public virtual void Populate(Xml Node node, IDictionary<Guid,IStorable> restoredObjects) {62 myGuid = new Guid( node.Attributes["GUID"].Value);61 public virtual void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 62 myGuid = new Guid(reader["GUID"]); 63 63 } 64 64 } -
branches/XmlReaderWriterBranch/HeuristicLab.Core/Variable.cs
r119 r125 115 115 PersistenceManager.Persist("Value", Value, writer, persistedObjects); 116 116 } 117 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 118 myName = node.Attributes["Name"].Value; 119 XmlNode valueNode = node.SelectSingleNode("Value"); 120 if (valueNode != null) 121 myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects); 117 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 118 // myName = node.Attributes["Name"].Value; 119 // XmlNode valueNode = node.SelectSingleNode("Value"); 120 // if(valueNode != null) 121 // myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects); 122 //} 123 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 124 myName = reader["Name"]; 125 reader.Read(); 126 if(reader.IsStartElement()) 127 myValue = (IItem)PersistenceManager.Restore(reader, "Value", restoredObjects); 122 128 } 123 129 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Core/VariableInfo.cs
r119 r125 146 146 writer.WriteAttributeString("Local", Local.ToString()); 147 147 } 148 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 149 myActualName = node.Attributes["ActualName"].Value; 150 myFormalName = node.Attributes["FormalName"].Value; 151 myDescription = node.Attributes["Description"].Value; 152 myDataType = Type.GetType(node.Attributes["DataType"].Value, true); 153 myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value); 154 myLocal = bool.Parse(node.Attributes["Local"].Value); 148 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 149 // myActualName = node.Attributes["ActualName"].Value; 150 // myFormalName = node.Attributes["FormalName"].Value; 151 // myDescription = node.Attributes["Description"].Value; 152 // myDataType = Type.GetType(node.Attributes["DataType"].Value, true); 153 // myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value); 154 // myLocal = bool.Parse(node.Attributes["Local"].Value); 155 //} 156 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 157 myActualName = reader["ActualName"]; 158 myFormalName = reader["FormalName"]; 159 myDescription = reader["Description"]; 160 myDataType = Type.GetType(reader["DataType"], true); 161 myKind = (VariableKind)Enum.Parse(typeof(VariableKind), reader["Kind"]); 162 myLocal = bool.Parse(reader["Local"]); 155 163 } 156 164 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolArrayData.cs
r119 r125 53 53 writer.WriteValue(ToString()); 54 54 } 55 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 56 base.Populate(node, restoredObjects); 57 string[] tokens = node.InnerText.Split(';'); 55 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 56 // base.Populate(node, restoredObjects); 57 // string[] tokens = node.InnerText.Split(';'); 58 // bool[] data = new bool[tokens.Length]; 59 // for(int i = 0; i < data.Length; i++) 60 // data[i] = bool.Parse(tokens[i]); 61 // Data = data; 62 //} 63 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(reader, restoredObjects); 65 string[] tokens = reader.ReadString().Split(';'); 58 66 bool[] data = new bool[tokens.Length]; 59 for 67 for(int i = 0; i < data.Length; i++) 60 68 data[i] = bool.Parse(tokens[i]); 61 69 Data = data; -
branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolData.cs
r119 r125 60 60 writer.WriteValue(ToString()); 61 61 } 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 63 base.Populate(node, restoredObjects); 64 Data = bool.Parse(node.InnerText); 62 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 63 // base.Populate(node, restoredObjects); 64 // Data = bool.Parse(node.InnerText); 65 //} 66 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 67 base.Populate(reader, restoredObjects); 68 Data = bool.Parse(reader.ReadString()); 65 69 } 66 70 -
branches/XmlReaderWriterBranch/HeuristicLab.Data/BoolMatrixData.cs
r119 r125 62 62 writer.WriteValue(ToString()); 63 63 } 64 65 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 66 base.Populate(node, restoredObjects); 67 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 69 string[] tokens = node.InnerText.Split(';'); 64 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 65 // base.Populate(node, restoredObjects); 66 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 67 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 // string[] tokens = node.InnerText.Split(';'); 69 // bool[,] data = new bool[dim1, dim2]; 70 // for(int i = 0; i < dim1; i++) { 71 // for(int j = 0; j < dim2; j++) { 72 // data[i, j] = bool.Parse(tokens[i * dim2 + j]); 73 // } 74 // } 75 // Data = data; 76 //} 77 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 78 base.Populate(reader, restoredObjects); 79 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 80 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 81 string[] tokens = reader.ReadString().Split(';'); 70 82 bool[,] data = new bool[dim1, dim2]; 71 for 72 for 83 for(int i = 0; i < dim1; i++) { 84 for(int j = 0; j < dim2; j++) { 73 85 data[i, j] = bool.Parse(tokens[i * dim2 + j]); 74 86 } -
branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedDoubleData.cs
r119 r125 65 65 PersistenceManager.Persist("Value", (DoubleData)base.Data, writer, persistedObjects); 66 66 } 67 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 68 base.Populate(node, restoredObjects); 69 base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 67 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 68 // base.Populate(node, restoredObjects); 69 // base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 base.Data = (DoubleData)PersistenceManager.Restore(reader, "Value", restoredObjects); 74 reader.Read(); 70 75 } 71 76 -
branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedIntData.cs
r119 r125 65 65 PersistenceManager.Persist("Value", (IntData)base.Data, writer, persistedObjects); 66 66 } 67 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 68 base.Populate(node, restoredObjects); 69 base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 67 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 68 // base.Populate(node, restoredObjects); 69 // base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 base.Data = (IntData)PersistenceManager.Restore(reader, "Value", restoredObjects); 74 reader.Read(); 70 75 } 71 76 -
branches/XmlReaderWriterBranch/HeuristicLab.Data/ConstrainedItemList.cs
r119 r125 75 75 } 76 76 77 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 78 base.Populate(node, restoredObjects); 79 XmlNode listNode = node.SelectSingleNode("ListItems"); 77 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 78 // base.Populate(node, restoredObjects); 79 // XmlNode listNode = node.SelectSingleNode("ListItems"); 80 // list = new List<IItem>(); 81 // for(int i = 0; i < listNode.ChildNodes.Count; i++) 82 // list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects)); 83 // suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value); 84 //} 85 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(reader, restoredObjects); 87 if(reader.Name!="ListItems") throw new XmlException("Expected: \"ListItems\", found: \""+reader.Name+"\""); 88 suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]); 80 89 list = new List<IItem>(); 81 for (int i = 0; i < listNode.ChildNodes.Count; i++) 82 list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects)); 83 suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value); 90 if(!reader.IsEmptyElement) { 91 while(reader.IsStartElement()) { 92 list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects)); 93 reader.Skip(); 94 } 95 reader.ReadEndElement(); 96 } else { 97 reader.Read(); 98 } 84 99 } 85 100 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleArrayData.cs
r119 r125 54 54 writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat)); 55 55 } 56 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 57 base.Populate(node, restoredObjects); 58 string[] tokens = node.InnerText.Split(';'); 56 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 57 // base.Populate(node, restoredObjects); 58 // string[] tokens = node.InnerText.Split(';'); 59 // double[] data = new double[tokens.Length]; 60 // for(int i = 0; i < data.Length; i++) 61 // if(double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) { 62 // throw new FormatException("Can't parse " + tokens[i] + " as double value."); 63 // } 64 // Data = data; 65 //} 66 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 67 base.Populate(reader, restoredObjects); 68 string[] tokens = reader.ReadString().Split(';'); 59 69 double[] data = new double[tokens.Length]; 60 70 for(int i = 0; i < data.Length; i++) -
branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleData.cs
r119 r125 61 61 writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat)); 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // double data; 66 // if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 67 // Data = data; 68 // } else { 69 // throw new FormatException("Can't parse " + node.InnerText + " as double value."); 70 // } 71 //} 72 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 73 base.Populate(reader, restoredObjects); 65 74 double data; 66 if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 75 string token = reader.ReadString(); 76 if(double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 67 77 Data = data; 68 78 } else { 69 throw new FormatException("Can't parse " + node.InnerText + " as double value.");79 throw new FormatException("Can't parse " + token + " as double value."); 70 80 } 71 81 } -
branches/XmlReaderWriterBranch/HeuristicLab.Data/DoubleMatrixData.cs
r119 r125 62 62 writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat)); 63 63 } 64 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 65 base.Populate(node, restoredObjects); 66 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 67 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 string[] tokens = node.InnerText.Split(';'); 64 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 65 // base.Populate(node, restoredObjects); 66 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 67 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 // string[] tokens = node.InnerText.Split(';'); 69 // double[,] data = new double[dim1, dim2]; 70 // for(int i = 0; i < dim1; i++) { 71 // for(int j = 0; j < dim2; j++) { 72 // if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 73 // throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 74 // } 75 // } 76 // } 77 // Data = data; 78 //} 79 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 80 base.Populate(reader, restoredObjects); 81 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 82 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 83 string[] tokens = reader.ReadString().Split(';'); 69 84 double[,] data = new double[dim1, dim2]; 70 for 71 for 72 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) ==false) {85 for(int i = 0; i < dim1; i++) { 86 for(int j = 0; j < dim2; j++) { 87 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 73 88 throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 74 89 } -
branches/XmlReaderWriterBranch/HeuristicLab.Data/IntArrayData.cs
r119 r125 54 54 writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat)); 55 55 } 56 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 57 base.Populate(node, restoredObjects); 58 if (!node.InnerText.Equals("")) { 59 string[] tokens = node.InnerText.Split(';'); 56 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 57 // base.Populate(node, restoredObjects); 58 // if(!node.InnerText.Equals("")) { 59 // string[] tokens = node.InnerText.Split(';'); 60 // int[] data = new int[tokens.Length]; 61 // for(int i = 0; i < data.Length; i++) 62 // data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 63 // Data = data; 64 // } 65 //} 66 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 67 base.Populate(reader, restoredObjects); 68 string innerText = reader.ReadString(); 69 if(!innerText.Equals("")) { 70 string[] tokens = innerText.Split(';'); 60 71 int[] data = new int[tokens.Length]; 61 for 72 for(int i = 0; i < data.Length; i++) 62 73 data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 63 74 Data = data; -
branches/XmlReaderWriterBranch/HeuristicLab.Data/IntData.cs
r119 r125 61 61 writer.WriteValue(Data.ToString(CultureInfo.InvariantCulture.NumberFormat)); 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 66 //} 67 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 68 base.Populate(reader, restoredObjects); 69 Data = int.Parse(reader.ReadString(), CultureInfo.InvariantCulture.NumberFormat); 66 70 } 67 71 -
branches/XmlReaderWriterBranch/HeuristicLab.Data/IntMatrixData.cs
r119 r125 62 62 writer.WriteValue(ToString(CultureInfo.InvariantCulture.NumberFormat)); 63 63 } 64 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 65 base.Populate(node, restoredObjects); 66 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 67 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 string[] tokens = node.InnerText.Split(';'); 64 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 65 // base.Populate(node, restoredObjects); 66 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 67 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 68 // string[] tokens = node.InnerText.Split(';'); 69 // int[,] data = new int[dim1, dim2]; 70 // for(int i = 0; i < dim1; i++) { 71 // for(int j = 0; j < dim2; j++) { 72 // data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 73 // } 74 // } 75 // Data = data; 76 //} 77 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 78 base.Populate(reader, restoredObjects); 79 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 80 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 81 string[] tokens = reader.ReadString().Split(';'); 82 69 83 int[,] data = new int[dim1, dim2]; 70 for 71 for 84 for(int i = 0; i < dim1; i++) { 85 for(int j = 0; j < dim2; j++) { 72 86 data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 73 87 } -
branches/XmlReaderWriterBranch/HeuristicLab.Data/ItemList_T.cs
r119 r125 61 61 PersistenceManager.Persist(list[i], writer, persistedObjects); 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 for (int i = 0; i < node.ChildNodes.Count; i++) 66 list.Add((T) PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // for(int i = 0; i < node.ChildNodes.Count; i++) 66 // list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 67 //} 68 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 69 base.Populate(reader, restoredObjects); 70 if(!reader.IsEmptyElement) { 71 reader.Read(); 72 while(reader.IsStartElement()) { 73 list.Add((T)PersistenceManager.Restore(reader, restoredObjects)); 74 reader.Skip(); 75 } 76 reader.ReadEndElement(); 77 } else { 78 reader.Read(); 79 } 67 80 } 68 81 -
branches/XmlReaderWriterBranch/HeuristicLab.Data/StringData.cs
r119 r125 60 60 writer.WriteValue(Data); 61 61 } 62 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 63 base.Populate(node, restoredObjects); 64 Data = node.InnerText; 62 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 63 // base.Populate(node, restoredObjects); 64 // Data = node.InnerText; 65 //} 66 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 67 base.Populate(reader, restoredObjects); 68 Data = reader.ReadString(); 65 69 } 66 70 -
branches/XmlReaderWriterBranch/HeuristicLab.DataAnalysis/Dataset.cs
r119 r125 149 149 } 150 150 151 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 152 base.Populate(node, restoredObjects); 153 Name = node.Attributes["Name"].Value; 154 rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 155 columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 156 157 VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value); 158 159 string[] tokens = node.InnerText.Split(';'); 151 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 152 // base.Populate(node, restoredObjects); 153 // Name = node.Attributes["Name"].Value; 154 // rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 155 // columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 156 157 // VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value); 158 159 // string[] tokens = node.InnerText.Split(';'); 160 // if(tokens.Length != rows * columns) throw new FormatException(); 161 // samples = new double[rows * columns]; 162 // for(int row = 0; row < rows; row++) { 163 // for(int column = 0; column < columns; column++) { 164 // if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 165 // throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 166 // } 167 // } 168 // } 169 // CreateDictionaries(); 170 //} 171 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 172 base.Populate(reader, restoredObjects); 173 Name = reader["Name"]; 174 rows = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 175 columns = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 176 VariableNames = ParseVariableNamesString(reader["VariableNames"]); 177 string[] tokens = reader.ReadString().Split(';'); 178 160 179 if(tokens.Length != rows * columns) throw new FormatException(); 161 180 samples = new double[rows * columns]; 162 181 for(int row = 0; row < rows; row++) { 163 182 for(int column = 0; column < columns; column++) { 164 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row *columns + column]) == false) {183 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 165 184 throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 166 185 } -
branches/XmlReaderWriterBranch/HeuristicLab.DistributedEngine/DistributedEngine.cs
r119 r125 192 192 writer.WriteAttributeString("ServerAddress", ServerAddress); 193 193 } 194 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 195 base.Populate(node, restoredObjects); 196 ServerAddress = node.Attributes["ServerAddress"].Value; 194 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 195 // base.Populate(node, restoredObjects); 196 // ServerAddress = node.Attributes["ServerAddress"].Value; 197 //} 198 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 199 ServerAddress = reader["ServerAddress"]; 200 base.Populate(reader, restoredObjects); 197 201 } 198 202 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.ES/ES.cs
r119 r125 610 610 PersistenceManager.Persist("Engine", Engine, writer, persistedObjects); 611 611 } 612 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 613 base.Populate(node, restoredObjects); 614 myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 612 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 613 // base.Populate(node, restoredObjects); 614 // myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 615 // SetReferences(); 616 //} 617 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 618 base.Populate(reader, restoredObjects); 619 reader.Read(); 620 myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects); 615 621 SetReferences(); 622 reader.Read(); 616 623 } 617 624 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Functions/Constant.cs
r2 r125 73 73 74 74 75 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {76 base.Populate(node, restoredObjects);75 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 76 // base.Populate(node, restoredObjects); 77 77 78 // value = GetVariable("Value"); 79 //} 80 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 81 base.Populate(reader, restoredObjects); 78 82 value = GetVariable("Value"); 79 83 } -
branches/XmlReaderWriterBranch/HeuristicLab.Functions/FunctionBase.cs
r119 r125 320 320 } 321 321 322 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 323 base.Populate(node, restoredObjects); 324 XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate"); 325 if (functionTemplateNode != null) { 326 metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects); 322 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 323 // base.Populate(node, restoredObjects); 324 // XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate"); 325 // if(functionTemplateNode != null) { 326 // metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects); 327 // } else { 328 // metaObject = this; 329 // } 330 // // don't need to explicitly load the sub-functions because that has already been done in OperatorBase.Populate() 331 332 // // load local variables 333 // XmlNode variablesNode = node.SelectSingleNode("LocalVariables"); 334 335 // // remove the variables that have been added in a constructor 336 // variables.Clear(); 337 // // load the persisted variables 338 // foreach(XmlNode variableNode in variablesNode.ChildNodes) 339 // variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 340 //} 341 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 342 base.Populate(reader, restoredObjects); 343 if(reader.Name == "FunctionTemplate") { 344 reader.Read(); 345 metaObject = (FunctionBase)PersistenceManager.Restore(reader, restoredObjects); 346 reader.Read(); 347 reader.ReadEndElement(); 327 348 } else { 328 349 metaObject = this; … … 331 352 332 353 // load local variables 333 XmlNode variablesNode = node.SelectSingleNode("LocalVariables"); 334 354 if(reader.Name!="LocalVariables") throw new XmlException("Expected: \"LocalVariables\", found: \""+reader.Name+"\""); 335 355 // remove the variables that have been added in a constructor 336 356 variables.Clear(); 337 357 // load the persisted variables 338 foreach (XmlNode variableNode in variablesNode.ChildNodes) 339 variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 358 if(!reader.IsEmptyElement) { 359 reader.Read(); 360 while(reader.IsStartElement()) { 361 variables.Add((IVariable)PersistenceManager.Restore(reader, restoredObjects)); 362 reader.Skip(); 363 } 364 reader.ReadEndElement(); 365 } else { 366 reader.Read(); 367 } 340 368 } 341 369 -
branches/XmlReaderWriterBranch/HeuristicLab.Functions/Variable.cs
r2 r125 28 28 using HeuristicLab.Constraints; 29 29 using HeuristicLab.DataAnalysis; 30 using System.Xml; 30 31 31 32 namespace HeuristicLab.Functions { … … 94 95 } 95 96 96 public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {97 base.Populate(node, restoredObjects);97 //public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 98 // base.Populate(node, restoredObjects); 98 99 100 // variable = (ConstrainedIntData)GetVariable("Variable").Value; 101 // weight = (ConstrainedDoubleData)GetVariable("Weight").Value; 102 // sampleOffset = (ConstrainedIntData)GetVariable("SampleOffset").Value; 103 //} 104 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 105 base.Populate(reader, restoredObjects); 99 106 variable = (ConstrainedIntData)GetVariable("Variable").Value; 100 107 weight = (ConstrainedDoubleData)GetVariable("Weight").Value; -
branches/XmlReaderWriterBranch/HeuristicLab.Grid/ProcessingEngine.cs
r119 r125 56 56 } 57 57 58 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 reader.Read(); 65 initialOperation = (AtomicOperation)PersistenceManager.Restore(reader, "InitialOperation", restoredObjects); 66 reader.Read(); 61 67 } 62 68 -
branches/XmlReaderWriterBranch/HeuristicLab.Logging/Linechart.cs
r119 r125 94 94 PersistenceManager.Persist("Values", Values, writer, persistedObjects); 95 95 } 96 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 97 base.Populate(node, restoredObjects); 98 myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects); 99 myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects); 96 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 97 // base.Populate(node, restoredObjects); 98 // myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects); 99 // myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects); 100 //} 101 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 102 base.Populate(reader, restoredObjects); 103 reader.Read(); 104 myNumberOfLines = (IntData)PersistenceManager.Restore(reader, "NumberOfLines", restoredObjects); 105 reader.Skip(); 106 myValues = (ItemList)PersistenceManager.Restore(reader, "Values", restoredObjects); 107 reader.Read(); 100 108 } 101 109 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Logging/Log.cs
r119 r125 68 68 PersistenceManager.Persist("Items", Items, writer, persistedObjects); 69 69 } 70 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 71 base.Populate(node, restoredObjects); 72 myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects); 70 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 71 // base.Populate(node, restoredObjects); 72 // myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects); 73 //} 74 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 75 base.Populate(reader, restoredObjects); 76 reader.Read(); 77 myItems = (ItemList)PersistenceManager.Restore(reader, "Items", restoredObjects); 78 reader.Read(); 73 79 } 74 80 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
r119 r125 211 211 writer.WriteEndElement(); 212 212 } 213 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 214 base.Populate(node, restoredObjects); 215 XmlNode descriptionNode = node.SelectSingleNode("Description"); 216 myDescription = descriptionNode.InnerText; 217 XmlNode codeNode = node.SelectSingleNode("Code"); 218 myCode = codeNode.InnerText; 213 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 214 // base.Populate(node, restoredObjects); 215 // XmlNode descriptionNode = node.SelectSingleNode("Description"); 216 // myDescription = descriptionNode.InnerText; 217 // XmlNode codeNode = node.SelectSingleNode("Code"); 218 // myCode = codeNode.InnerText; 219 //} 220 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 221 base.Populate(reader, restoredObjects); 222 myDescription = reader.ReadElementString("Description"); 223 myCode = reader.ReadElementString("Code"); 219 224 } 220 225 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Operators/CombinedOperator.cs
r119 r125 103 103 PersistenceManager.Persist("OperatorGraph", OperatorGraph, writer, persistedObjects); 104 104 } 105 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 106 base.Populate(node, restoredObjects); 107 XmlNode descriptionNode = node.SelectSingleNode("Description"); 108 if (descriptionNode != null) myDescription = descriptionNode.InnerText; 109 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 105 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 106 // base.Populate(node, restoredObjects); 107 // XmlNode descriptionNode = node.SelectSingleNode("Description"); 108 // if(descriptionNode != null) myDescription = descriptionNode.InnerText; 109 // myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 110 //} 111 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 112 base.Populate(reader, restoredObjects); 113 myDescription = reader.ReadElementString("Description"); 114 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects); 115 reader.Read(); 110 116 } 111 117 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Random/MersenneTwister.cs
r119 r125 148 148 writer.WriteEndElement(); // </Init> 149 149 } 150 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 151 base.Populate(node, restoredObjects); 152 153 string stateString = node.SelectSingleNode("State").InnerText; 150 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 151 // base.Populate(node, restoredObjects); 152 153 // string stateString = node.SelectSingleNode("State").InnerText; 154 // string[] tokens = stateString.Split(';'); 155 // for(int i = 0; i < tokens.Length; i++) 156 // state[i] = uint.Parse(tokens[i]); 157 // p = int.Parse(node.SelectSingleNode("P").InnerText); 158 // init = bool.Parse(node.SelectSingleNode("Init").InnerText); 159 //} 160 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 161 base.Populate(reader, restoredObjects); 162 reader.Read(); 163 string stateString = reader.ReadElementString("State"); 154 164 string[] tokens = stateString.Split(';'); 155 165 for(int i = 0; i < tokens.Length; i++) 156 166 state[i] = uint.Parse(tokens[i]); 157 p = int.Parse( node.SelectSingleNode("P").InnerText);158 init = bool.Parse( node.SelectSingleNode("Init").InnerText);167 p = int.Parse(reader.ReadElementString("P")); 168 init = bool.Parse(reader.ReadElementString("Init")); 159 169 } 160 170 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Random/NormalDistributedRandom.cs
r119 r125 539 539 } 540 540 541 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 542 base.Populate(node, restoredObjects); 543 544 mu = double.Parse(node.SelectSingleNode("Mu").InnerText); 545 sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText); 546 uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects); 541 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 542 // base.Populate(node, restoredObjects); 543 544 // mu = double.Parse(node.SelectSingleNode("Mu").InnerText); 545 // sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText); 546 // uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects); 547 //} 548 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 549 base.Populate(reader, restoredObjects); 550 mu = double.Parse(reader.ReadElementString("Mu")); 551 sigma = double.Parse(reader.ReadElementString("Sigma")); 552 uniform = (IRandom)PersistenceManager.Restore(reader, "UniformRandom", restoredObjects); 553 reader.Read(); 547 554 } 548 555 -
branches/XmlReaderWriterBranch/HeuristicLab.Routing.TSP/TSPTour.cs
r119 r125 83 83 PersistenceManager.Persist("Tour", Tour, writer, persistedObjects); 84 84 } 85 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(node, restoredObjects); 87 myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects); 88 myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects); 85 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 86 // base.Populate(node, restoredObjects); 87 // myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects); 88 // myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects); 89 //} 90 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 91 base.Populate(reader, restoredObjects); 92 reader.Read(); 93 myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(reader, "Coordinates", restoredObjects); 94 reader.Skip(); 95 myTour = (Permutation.Permutation)PersistenceManager.Restore(reader, "Tour", restoredObjects); 96 reader.Read(); 89 97 } 90 98 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.SGA/SGA.cs
r119 r125 515 515 PersistenceManager.Persist("Engine", Engine, writer, persistedObjects); 516 516 } 517 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 518 base.Populate(node, restoredObjects); 519 myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 517 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 518 // base.Populate(node, restoredObjects); 519 // myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 520 // SetReferences(); 521 //} 522 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 523 base.Populate(reader, restoredObjects); 524 reader.Read(); 525 myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects); 520 526 SetReferences(); 527 reader.Read(); 521 528 } 522 529 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs
r119 r125 94 94 PersistenceManager.Persist("Operations", operations, writer, persistedObjects); 95 95 } 96 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 97 base.Populate(node, restoredObjects); 98 operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects); 99 jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects); 100 machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 96 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 97 // base.Populate(node, restoredObjects); 98 // operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects); 99 // jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects); 100 // machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 101 //} 102 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 103 base.Populate(reader, restoredObjects); 104 reader.Read(); 105 operations = (ItemList)PersistenceManager.Restore(reader, "Operations", restoredObjects); 106 reader.Skip(); 107 jobs = (IntData)PersistenceManager.Restore(reader, "Jobs", restoredObjects); 108 reader.Skip(); 109 machines = (IntData)PersistenceManager.Restore(reader, "Machines", restoredObjects); 110 reader.Read(); 101 111 } 102 112 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/Operation.cs
r119 r125 159 159 } 160 160 161 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 162 base.Populate(node, restoredObjects); 163 job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects); 164 operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects); 165 start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects); 166 duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects); 167 predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects); 168 machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 161 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 162 // base.Populate(node, restoredObjects); 163 // job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects); 164 // operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects); 165 // start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects); 166 // duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects); 167 // predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects); 168 // machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 169 //} 170 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 171 base.Populate(reader, restoredObjects); 172 reader.Read(); 173 job = (IntData)PersistenceManager.Restore(reader, "Job", restoredObjects); 174 reader.Skip(); 175 operationIndex = (IntData)PersistenceManager.Restore(reader, "OperationIndex", restoredObjects); 176 reader.Skip(); 177 start = (IntData)PersistenceManager.Restore(reader, "Start", restoredObjects); 178 reader.Skip(); 179 duration = (IntData)PersistenceManager.Restore(reader, "Duration", restoredObjects); 180 reader.Skip(); 181 predecessors = (ItemList)PersistenceManager.Restore(reader, "Predecessors", restoredObjects); 182 reader.Skip(); 183 machines = (IntArrayData)PersistenceManager.Restore(reader, "Machines", restoredObjects); 184 reader.Read(); 169 185 } 170 186 -
branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs
r119 r125 83 83 } 84 84 85 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(node, restoredObjects); 87 int machines = int.Parse(node.Attributes["Machines"].Value); 85 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 86 // base.Populate(node, restoredObjects); 87 // int machines = int.Parse(node.Attributes["Machines"].Value); 88 // schedule = new ScheduleTree[machines]; 89 // for(int i = 0; i < machines; i++) { 90 // schedule[i] = (ScheduleTree)PersistenceManager.Restore(node.SelectSingleNode("Machine" + i.ToString()), restoredObjects); 91 // } 92 //} 93 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 94 int machines = int.Parse(reader["Machines"]); 95 base.Populate(reader, restoredObjects); 88 96 schedule = new ScheduleTree[machines]; 89 97 for(int i = 0; i < machines; i++) { 90 schedule[i] = (ScheduleTree)PersistenceManager.Restore(node.SelectSingleNode("Machine" + i.ToString()), restoredObjects); 98 schedule[i] = (ScheduleTree)PersistenceManager.Restore(reader, "Machine" + i.ToString(), restoredObjects); 99 reader.Skip(); 91 100 } 92 101 } -
branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs
r119 r125 76 76 PersistenceManager.Persist("Schedule", schedule, writer, persistedObjects); 77 77 } 78 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 79 base.Populate(node, restoredObjects); 80 XmlNode scheduleNode = node.SelectSingleNode("Schedule"); 81 if(scheduleNode != null) { 82 schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects); 78 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 79 // base.Populate(node, restoredObjects); 80 // XmlNode scheduleNode = node.SelectSingleNode("Schedule"); 81 // if(scheduleNode != null) { 82 // schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects); 83 // } 84 //} 85 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(reader, restoredObjects); 87 88 if(reader.Name == "Schedule") { 89 schedule = (Schedule)PersistenceManager.Restore(reader, "Schedule", restoredObjects); 90 reader.Read(); 83 91 } 84 92 } -
branches/XmlReaderWriterBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs
r119 r125 218 218 } 219 219 220 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 221 base.Populate(node, restoredObjects); 222 string[] tokens = node.InnerText.Split(';'); 220 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 221 // base.Populate(node, restoredObjects); 222 // string[] tokens = node.InnerText.Split(';'); 223 // for(int i = 0; i < tokens.Length - 1; i++) { 224 // TimeSlot t = new TimeSlot(tokens[i]); 225 // if(t.job > -1) { 226 // this.InsertOperation(t); 227 // } 228 // } 229 //} 230 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 231 base.Populate(reader, restoredObjects); 232 string[] tokens = reader.ReadString().Split(';'); 223 233 for(int i = 0; i < tokens.Length - 1; i++) { 224 234 TimeSlot t = new TimeSlot(tokens[i]); -
branches/XmlReaderWriterBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs
r119 r125 77 77 } 78 78 79 public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 80 base.Populate(node, restoredObjects); 81 group = (GPOperatorGroup) PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects); 79 //public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 80 // base.Populate(node, restoredObjects); 81 // group = (GPOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects); 82 //} 83 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 84 base.Populate(reader, restoredObjects); 85 reader.Read(); 86 group = (GPOperatorGroup)PersistenceManager.Restore(reader, "Group", restoredObjects); 87 reader.Read(); 82 88 } 83 89 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab.ThreadParallelEngine/ThreadParallelEngine.cs
r119 r125 187 187 writer.WriteAttributeString("Workers", Workers.ToString()); 188 188 } 189 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 190 base.Populate(node, restoredObjects); 191 myWorkers = int.Parse(node.Attributes["Workers"].Value); 189 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 190 // base.Populate(node, restoredObjects); 191 // myWorkers = int.Parse(node.Attributes["Workers"].Value); 192 //} 193 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 194 myWorkers = int.Parse(reader["Workers"]); 195 base.Populate(reader, restoredObjects); 192 196 } 193 197 #endregion -
branches/XmlReaderWriterBranch/HeuristicLab/UpdateLocalInstallation.cmd
r45 r125 1 set target= C:\Program Files\HeuristicLab 3.01 set target=G:\Program Files\HeuristicLab 3.0 2 2 3 3 copy "HeuristicLab.exe" "%target%"
Note: See TracChangeset
for help on using the changeset viewer.