Changeset 121 for branches/XmlTextReaderBranch
- Timestamp:
- 04/14/08 21:51:15 (17 years ago)
- Location:
- branches/XmlTextReaderBranch
- Files:
-
- 60 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/XmlTextReaderBranch/HeuristicLab.Constraints/AllSubOperatorsTypeConstraint.cs
r2 r121 92 92 } 93 93 94 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 95 base.Populate(node, restoredObjects); 96 groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects); 94 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 95 // base.Populate(node, restoredObjects); 96 // groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorsGroupConstraint"), restoredObjects); 97 //} 98 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 99 base.Populate(reader, restoredObjects); 100 groupConstraint = (SubOperatorTypeConstraint)PersistenceManager.Restore(reader, "SubOperatorsGroupConstraint", restoredObjects); 97 101 } 98 102 #endregion persistence -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/AndConstraint.cs
r40 r121 81 81 } 82 82 83 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 84 base.Populate(node, restoredObjects); 85 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 83 //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 84 // base.Populate(node, restoredObjects); 85 // clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 86 //} 87 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 88 base.Populate(reader, restoredObjects); 89 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects); 86 90 } 87 91 #endregion persistence -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/DoubleBoundedConstraint.cs
r2 r121 155 155 } 156 156 157 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 158 base.Populate(node, restoredObjects); 159 lowerBound = double.Parse(node.Attributes["LowerBound"].Value); 160 if (node.Attributes["LowerBoundIncluded"] != null) { 161 lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 157 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 158 // base.Populate(node, restoredObjects); 159 // lowerBound = double.Parse(node.Attributes["LowerBound"].Value); 160 // if(node.Attributes["LowerBoundIncluded"] != null) { 161 // lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 162 // } else { 163 // lowerBoundIncluded = true; 164 // } 165 // if(node.Attributes["LowerBoundEnabled"] != null) { 166 // lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value); 167 // } else { 168 // lowerBoundEnabled = true; 169 // } 170 171 // upperBound = double.Parse(node.Attributes["UpperBound"].Value); 172 // if(node.Attributes["UpperBoundIncluded"] != null) { 173 // upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value); 174 // } else { 175 // upperBoundIncluded = true; 176 // } 177 // if(node.Attributes["UpperBoundEnabled"] != null) { 178 // upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value); 179 // } else { 180 // upperBoundEnabled = true; 181 // } 182 //} 183 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 184 base.Populate(reader, restoredObjects); 185 lowerBound = double.Parse(reader["LowerBound"]); 186 if(reader["LowerBoundIncluded"] != null) { 187 lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]); 162 188 } else { 163 189 lowerBoundIncluded = true; 164 190 } 165 if (node.Attributes["LowerBoundEnabled"] != null) {166 lowerBoundEnabled = bool.Parse( node.Attributes["LowerBoundEnabled"].Value);191 if(reader["LowerBoundEnabled"] != null) { 192 lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]); 167 193 } else { 168 194 lowerBoundEnabled = true; 169 195 } 170 196 171 upperBound = double.Parse( node.Attributes["UpperBound"].Value);172 if (node.Attributes["UpperBoundIncluded"] != null) {173 upperBoundIncluded = bool.Parse( node.Attributes["UpperBoundIncluded"].Value);197 upperBound = double.Parse(reader["UpperBound"]); 198 if(reader["UpperBoundIncluded"] != null) { 199 upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]); 174 200 } else { 175 201 upperBoundIncluded = true; 176 202 } 177 if (node.Attributes["UpperBoundEnabled"] != null) {178 upperBoundEnabled = bool.Parse( node.Attributes["UpperBoundEnabled"].Value);203 if(reader["UpperBoundEnabled"] != null) { 204 upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]); 179 205 } else { 180 206 upperBoundEnabled = true; -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/IntBoundedConstraint.cs
r2 r121 150 150 } 151 151 152 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 153 base.Populate(node, restoredObjects); 154 lowerBound = int.Parse(node.Attributes["LowerBound"].Value); 155 if (node.Attributes["LowerBoundIncluded"] != null) { 156 lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 152 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 153 // base.Populate(node, restoredObjects); 154 // lowerBound = int.Parse(node.Attributes["LowerBound"].Value); 155 // if (node.Attributes["LowerBoundIncluded"] != null) { 156 // lowerBoundIncluded = bool.Parse(node.Attributes["LowerBoundIncluded"].Value); 157 // } else { 158 // lowerBoundIncluded = true; 159 // } 160 // if (node.Attributes["LowerBoundEnabled"] != null) { 161 // lowerBoundEnabled = bool.Parse(node.Attributes["LowerBoundEnabled"].Value); 162 // } else { 163 // lowerBoundEnabled = true; 164 // } 165 166 // upperBound = int.Parse(node.Attributes["UpperBound"].Value); 167 // if (node.Attributes["UpperBoundIncluded"] != null) { 168 // upperBoundIncluded = bool.Parse(node.Attributes["UpperBoundIncluded"].Value); 169 // } else { 170 // upperBoundIncluded = true; 171 // } 172 // if (node.Attributes["UpperBoundEnabled"] != null) { 173 // upperBoundEnabled = bool.Parse(node.Attributes["UpperBoundEnabled"].Value); 174 // } else { 175 // upperBoundEnabled = true; 176 // } 177 //} 178 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 179 base.Populate(reader, restoredObjects); 180 lowerBound = int.Parse(reader["LowerBound"]); 181 if(reader["LowerBoundIncluded"] != null) { 182 lowerBoundIncluded = bool.Parse(reader["LowerBoundIncluded"]); 157 183 } else { 158 184 lowerBoundIncluded = true; 159 185 } 160 if (node.Attributes["LowerBoundEnabled"] != null) {161 lowerBoundEnabled = bool.Parse( node.Attributes["LowerBoundEnabled"].Value);186 if(reader["LowerBoundEnabled"] != null) { 187 lowerBoundEnabled = bool.Parse(reader["LowerBoundEnabled"]); 162 188 } else { 163 189 lowerBoundEnabled = true; 164 190 } 165 191 166 upperBound = int.Parse( node.Attributes["UpperBound"].Value);167 if (node.Attributes["UpperBoundIncluded"] != null) {168 upperBoundIncluded = bool.Parse( node.Attributes["UpperBoundIncluded"].Value);192 upperBound = int.Parse(reader["UpperBound"]); 193 if(reader["UpperBoundIncluded"] != null) { 194 upperBoundIncluded = bool.Parse(reader["UpperBoundIncluded"]); 169 195 } else { 170 196 upperBoundIncluded = true; 171 197 } 172 if (node.Attributes["UpperBoundEnabled"] != null) {173 upperBoundEnabled = bool.Parse( node.Attributes["UpperBoundEnabled"].Value);198 if(reader["UpperBoundEnabled"] != null) { 199 upperBoundEnabled = bool.Parse(reader["UpperBoundEnabled"]); 174 200 } else { 175 201 upperBoundEnabled = true; 176 202 } 177 203 } 204 178 205 #endregion 179 206 } -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/ItemTypeConstraint.cs
r40 r121 86 86 } 87 87 88 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 89 base.Populate(node, restoredObjects); 90 XmlAttribute itemTypeAttribute = node.Attributes["ItemType"]; 91 type = Type.GetType(itemTypeAttribute.Value); 88 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 89 // base.Populate(node, restoredObjects); 90 // XmlAttribute itemTypeAttribute = node.Attributes["ItemType"]; 91 // type = Type.GetType(itemTypeAttribute.Value); 92 //} 93 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 94 base.Populate(reader, restoredObjects); 95 type = Type.GetType(reader["ItemType"]); 92 96 } 93 97 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/NotConstraint.cs
r2 r121 75 75 } 76 76 77 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 78 base.Populate(node, restoredObjects); 79 subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects); 77 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 78 // base.Populate(node, restoredObjects); 79 // subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects); 80 //} 81 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 82 base.Populate(reader, restoredObjects); 83 subConstraint = (ConstraintBase)PersistenceManager.Restore(reader, "SubConstraint", restoredObjects); 80 84 } 81 85 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/NumberOfSubOperatorsConstraint.cs
r2 r121 88 88 } 89 89 90 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 91 base.Populate(node, restoredObjects); 92 minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects); 93 maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects); 90 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 91 // base.Populate(node, restoredObjects); 92 // minOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("min"), restoredObjects); 93 // maxOperators = (IntData)PersistenceManager.Restore(node.SelectSingleNode("max"), restoredObjects); 94 //} 95 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 96 base.Populate(reader, restoredObjects); 97 minOperators = (IntData)PersistenceManager.Restore(reader, "min", restoredObjects); 98 maxOperators = (IntData)PersistenceManager.Restore(reader, "max", restoredObjects); 94 99 } 95 100 #endregion persistence -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/OrConstraint.cs
r40 r121 82 82 } 83 83 84 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 85 base.Populate(node, restoredObjects); 86 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 84 //public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 85 // base.Populate(node, restoredObjects); 86 // clauses = (ItemList<IConstraint>)PersistenceManager.Restore(node.SelectSingleNode("Clauses"), restoredObjects); 87 //} 88 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 89 base.Populate(reader, restoredObjects); 90 clauses = (ItemList<IConstraint>)PersistenceManager.Restore(reader, "Clauses", restoredObjects); 87 91 } 88 92 #endregion persistence -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/SubOperatorsTypeConstraint.cs
r2 r121 121 121 } 122 122 123 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 124 base.Populate(node, restoredObjects); 125 subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); 123 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 124 // base.Populate(node, restoredObjects); 125 // subOperatorIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("SubOperatorIndex"), restoredObjects); 126 // subOperators = new List<IOperator>(); 127 // foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) { 128 // subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects)); 129 // } 130 //} 131 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 132 base.Populate(reader, restoredObjects); 133 subOperatorIndex = (IntData)PersistenceManager.Restore(reader, "SubOperatorIndex", restoredObjects); 126 134 subOperators = new List<IOperator>(); 127 foreach(XmlNode childNode in node.SelectSingleNode("AllowedSubOperators").ChildNodes) { 128 subOperators.Add((IOperator)PersistenceManager.Restore(childNode, restoredObjects)); 129 } 135 reader.ReadStartElement("AllowedSubOperators"); 136 while(reader.IsStartElement()) 137 subOperators.Add((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 138 reader.ReadEndElement(); 130 139 } 131 140 #endregion persistence -
branches/XmlTextReaderBranch/HeuristicLab.Constraints/VariableComparisonConstraint.cs
r2 r121 117 117 } 118 118 119 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 120 base.Populate(node, restoredObjects); 121 leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects); 122 rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects); 123 comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects); 119 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 120 // base.Populate(node, restoredObjects); 121 // leftVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("LeftVarName"), restoredObjects); 122 // rightVarName = (StringData)PersistenceManager.Restore(node.SelectSingleNode("RightVarName"), restoredObjects); 123 // comparer = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Comparer"), restoredObjects); 124 //} 125 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 126 base.Populate(reader, restoredObjects); 127 leftVarName = (StringData)PersistenceManager.Restore(reader, "LeftVarName", restoredObjects); 128 rightVarName = (StringData)PersistenceManager.Restore(reader, "RightVarName", restoredObjects); 129 comparer = (IntData)PersistenceManager.Restore(reader, "Comparer", restoredObjects); 124 130 } 125 131 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/AtomicOperation.cs
r2 r121 57 57 return node; 58 58 } 59 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 base.Populate(node, restoredObjects); 61 myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects); 62 myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects); 59 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 // base.Populate(node, restoredObjects); 61 // myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects); 62 // myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects); 63 //} 64 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 65 base.Populate(reader, restoredObjects); 66 myOperator = (IOperator)PersistenceManager.Restore(reader, "Operator", restoredObjects); 67 myScope = (IScope)PersistenceManager.Restore(reader, "Scope", restoredObjects); 63 68 } 64 69 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/CompositeOperation.cs
r2 r121 71 71 return node; 72 72 } 73 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {74 base.Populate(node, restoredObjects);73 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 74 // base.Populate(node, restoredObjects); 75 75 76 myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);76 // myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value); 77 77 78 XmlNode operationsNode = node.SelectSingleNode("Operations"); 79 for (int i = 0; i < operationsNode.ChildNodes.Count; i++) 80 AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects)); 78 // XmlNode operationsNode = node.SelectSingleNode("Operations"); 79 // for (int i = 0; i < operationsNode.ChildNodes.Count; i++) 80 // AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects)); 81 //} 82 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 83 base.Populate(reader, restoredObjects); 84 85 myExecuteInParallel = bool.Parse(reader["ExecuteInParallel"]); 86 87 reader.ReadStartElement("Operations"); 88 while(reader.IsStartElement()) 89 AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects)); 90 reader.ReadEndElement(); 81 91 } 82 92 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/ConstrainedItemBase.cs
r2 r121 97 97 return node; 98 98 } 99 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 100 base.Populate(node, restoredObjects); 101 XmlNode constraintsNode = node.SelectSingleNode("Constraints"); 102 if (constraintsNode != null) { 99 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 100 // base.Populate(node, restoredObjects); 101 // XmlNode constraintsNode = node.SelectSingleNode("Constraints"); 102 // if(constraintsNode != null) { 103 // myConstraints.Clear(); 104 // foreach(XmlNode constraintNode in constraintsNode.ChildNodes) 105 // AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects)); 106 // } 107 //} 108 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 109 base.Populate(reader, restoredObjects); 110 if(reader.IsStartElement()) { 111 reader.ReadToDescendant("Constraints"); 103 112 myConstraints.Clear(); 104 foreach (XmlNode constraintNode in constraintsNode.ChildNodes) 105 AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects)); 113 while(reader.IsStartElement()) 114 AddConstraint((IConstraint)PersistenceManager.Restore(reader, restoredObjects)); 115 reader.ReadEndElement(); 106 116 } 107 117 } -
branches/XmlTextReaderBranch/HeuristicLab.Core/EngineBase.cs
r47 r121 190 190 return node; 191 191 } 192 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 193 base.Populate(node, restoredObjects); 194 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 195 myGlobalScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("GlobalScope"), restoredObjects); 196 197 XmlNode stackNode = node.SelectSingleNode("ExecutionStack"); 198 for (int i = stackNode.ChildNodes.Count - 1; i >= 0; i--) 199 myExecutionStack.Push((IOperation)PersistenceManager.Restore(stackNode.ChildNodes[i], restoredObjects)); 200 201 XmlNode timeNode = node.SelectSingleNode("ExecutionTime"); 202 myExecutionTime = TimeSpan.Parse(timeNode.InnerText); 192 public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 193 base.Populate(reader, restoredObjects); 194 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects); 195 myGlobalScope = (IScope)PersistenceManager.Restore(reader, "GlobalScope", restoredObjects); 196 197 reader.ReadStartElement("ExecutionStack"); 198 List<IOperation> operationList = new List<IOperation>(); 199 while(reader.IsStartElement()) { 200 operationList.Insert(0, (IOperation)PersistenceManager.Restore(reader, restoredObjects)); 201 } 202 foreach(IOperation op in operationList) 203 myExecutionStack.Push(op); 204 reader.ReadEndElement(); 205 206 reader.ReadStartElement("ExecutionTime"); 207 myExecutionTime = TimeSpan.Parse(reader.ReadString()); 208 reader.ReadEndElement(); 203 209 } 204 210 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/Interfaces/IStorable.cs
r2 r121 33 33 34 34 XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects); 35 void Populate(Xml Node node, IDictionary<Guid, IStorable> restoredObjects);35 void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects); 36 36 } 37 37 } -
branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorBase.cs
r76 r121 461 461 return node; 462 462 } 463 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 464 base.Populate(node, restoredObjects); 465 myName = node.Attributes["Name"].Value; 466 if (node.Attributes["Breakpoint"] != null) 467 myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value); 468 XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators"); 469 for (int i = 0; i < subOperatorsNode.ChildNodes.Count; i++) 470 AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects)); 471 XmlNode infosNode = node.SelectSingleNode("VariableInfos"); 463 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 464 // base.Populate(node, restoredObjects); 465 // myName = node.Attributes["Name"].Value; 466 // if(node.Attributes["Breakpoint"] != null) 467 // myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value); 468 // XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators"); 469 // for(int i = 0; i < subOperatorsNode.ChildNodes.Count; i++) 470 // AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects)); 471 // XmlNode infosNode = node.SelectSingleNode("VariableInfos"); 472 // myVariableInfos.Clear(); 473 // foreach(XmlNode infoNode in infosNode.ChildNodes) 474 // AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects)); 475 // XmlNode variablesNode = node.SelectSingleNode("Variables"); 476 // myVariables.Clear(); 477 // foreach(XmlNode variableNode in variablesNode.ChildNodes) 478 // AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 479 //} 480 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 481 base.Populate(reader, restoredObjects); 482 myName = reader["Name"]; 483 if(reader["Breakpoint"] != null) 484 myBreakpoint = bool.Parse(reader["Breakpoint"]); 485 reader.ReadStartElement("SubOperators"); 486 while(reader.IsStartElement()) 487 AddSubOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 488 reader.ReadEndElement(); 489 reader.ReadStartElement("VariableInfos"); 472 490 myVariableInfos.Clear(); 473 foreach (XmlNode infoNode in infosNode.ChildNodes) 474 AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects)); 475 XmlNode variablesNode = node.SelectSingleNode("Variables"); 491 while(reader.IsStartElement()) 492 AddVariableInfo((IVariableInfo)PersistenceManager.Restore(reader, restoredObjects)); 493 reader.ReadEndElement(); 494 reader.ReadStartElement("Variables"); 476 495 myVariables.Clear(); 477 foreach (XmlNode variableNode in variablesNode.ChildNodes) 478 AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 496 while(reader.IsStartElement()) 497 AddVariable((IVariable)PersistenceManager.Restore(reader, restoredObjects)); 498 reader.ReadEndElement(); 479 499 } 480 500 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorGraph.cs
r47 r121 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 } 122 122 123 123 #region Persistence Methods 124 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {124 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 125 125 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 126 126 XmlNode ops = document.CreateNode(XmlNodeType.Element, "Operators", null); 127 foreach 127 foreach(IOperator op in myOperators.Values) 128 128 ops.AppendChild(PersistenceManager.Persist(op, document, persistedObjects)); 129 129 node.AppendChild(ops); 130 if 130 if(InitialOperator != null) 131 131 node.AppendChild(PersistenceManager.Persist("InitialOperator", InitialOperator, document, persistedObjects)); 132 132 return node; 133 133 } 134 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {135 base.Populate(node, restoredObjects);134 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 135 // base.Populate(node, restoredObjects); 136 136 137 XmlNode ops = node.SelectSingleNode("Operators"); 138 for (int i = 0; i < ops.ChildNodes.Count; i++) { 139 XmlNode opNode = ops.ChildNodes[i]; 140 IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects); 137 // XmlNode ops = node.SelectSingleNode("Operators"); 138 // for(int i = 0; i < ops.ChildNodes.Count; i++) { 139 // XmlNode opNode = ops.ChildNodes[i]; 140 // IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects); 141 // myOperators.Add(op.Guid, op); 142 // } 143 144 // XmlNode initial = node.SelectSingleNode("InitialOperator"); 145 // if(initial != null) 146 // myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects); 147 //} 148 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 149 base.Populate(reader, restoredObjects); 150 151 reader.ReadToDescendant("Operators"); 152 while(reader.IsStartElement()) { 153 IOperator op = (IOperator)PersistenceManager.Restore(reader, restoredObjects); 141 154 myOperators.Add(op.Guid, op); 142 155 } 143 144 XmlNode initial = node.SelectSingleNode("InitialOperator");145 if (initial != null)146 myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);156 reader.ReadEndElement(); 157 if(reader.IsStartElement()) { 158 myInitialOperator = (IOperator)PersistenceManager.Restore(reader, "InitialOperator", restoredObjects); 159 } 147 160 } 148 161 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorGroup.cs
r2 r121 98 98 return node; 99 99 } 100 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 101 base.Populate(node, restoredObjects); 102 myName = node.Attributes["Name"].Value; 103 XmlNode subGroupsNode = node.SelectSingleNode("SubGroups"); 104 foreach (XmlNode subGroupNode in subGroupsNode.ChildNodes) 105 AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects)); 106 XmlNode operatorsNode = node.SelectSingleNode("Operators"); 107 foreach (XmlNode operatorNode in operatorsNode.ChildNodes) 108 AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects)); 100 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 101 // base.Populate(node, restoredObjects); 102 // myName = node.Attributes["Name"].Value; 103 // XmlNode subGroupsNode = node.SelectSingleNode("SubGroups"); 104 // foreach(XmlNode subGroupNode in subGroupsNode.ChildNodes) 105 // AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects)); 106 // XmlNode operatorsNode = node.SelectSingleNode("Operators"); 107 // foreach(XmlNode operatorNode in operatorsNode.ChildNodes) 108 // AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects)); 109 //} 110 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 111 base.Populate(reader, restoredObjects); 112 myName = reader["Name"]; 113 reader.ReadStartElement("SubGroups"); 114 while(reader.IsStartElement()) 115 AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects)); 116 reader.ReadEndElement(); 117 reader.ReadStartElement("Operators"); 118 while(reader.IsStartElement()) 119 AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects)); 120 reader.ReadEndElement(); 109 121 } 110 122 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/OperatorLibrary.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(Xml Node node, IDictionary<Guid,IStorable> restoredObjects) {59 base.Populate( node, restoredObjects);60 myGroup = (IOperatorGroup)PersistenceManager.Restore( node.SelectSingleNode("OperatorGroup"), restoredObjects);58 public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(reader, restoredObjects); 60 myGroup = (IOperatorGroup)PersistenceManager.Restore(reader, "OperatorGroup", restoredObjects); 61 61 } 62 62 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/PersistenceManager.cs
r40 r121 49 49 } 50 50 } 51 public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 52 Guid guid = new Guid(node.Attributes["GUID"].Value); 53 if (restoredObjects.ContainsKey(guid)) { 51 52 public static IStorable Restore(XmlReader reader, string elementName, IDictionary<Guid, IStorable> restoredObjects) { 53 reader.ReadToDescendant(elementName); 54 return RestoreElement(reader, restoredObjects); 55 } 56 57 public static IStorable Restore(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 58 reader.Read(); 59 return RestoreElement(reader, restoredObjects); 60 } 61 private static IStorable RestoreElement(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 62 Guid guid = new Guid(reader["GUID"]); 63 if(restoredObjects.ContainsKey(guid)) { 64 reader.ReadEndElement(); 54 65 return restoredObjects[guid]; 55 66 } else { 56 Type type = Type.GetType( node.Attributes["Type"].Value, true);67 Type type = Type.GetType(reader["Type"], true); 57 68 IStorable instance = (IStorable)Activator.CreateInstance(type); 58 69 restoredObjects.Add(guid, instance); 59 instance.Populate(node, restoredObjects); 70 instance.Populate(reader, restoredObjects); 71 reader.ReadEndElement(); 60 72 return instance; 61 73 } … … 79 91 public static IStorable Load(Stream stream) { 80 92 XmlDocument doc = new XmlDocument(); 81 doc.Load(stream); 82 return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>()); 93 XmlTextReader reader = new XmlTextReader(stream); 94 reader.WhitespaceHandling = WhitespaceHandling.None; 95 reader.MoveToContent(); // read "<?xml version="1.0"?/> 96 return PersistenceManager.RestoreElement(reader, new Dictionary<Guid, IStorable>()); 83 97 } 84 98 -
branches/XmlTextReaderBranch/HeuristicLab.Core/Scope.cs
r63 r121 290 290 return node; 291 291 } 292 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 293 base.Populate(node, restoredObjects); 294 myName = node.Attributes["Name"].Value; 295 296 XmlNode variables = node.SelectSingleNode("Variables"); 297 foreach (XmlNode variableNode in variables.ChildNodes) { 298 IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects); 292 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 293 // base.Populate(node, restoredObjects); 294 // myName = node.Attributes["Name"].Value; 295 296 // XmlNode variables = node.SelectSingleNode("Variables"); 297 // foreach(XmlNode variableNode in variables.ChildNodes) { 298 // IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects); 299 // AddVariable(variable); 300 // } 301 302 // XmlNode aliases = node.SelectSingleNode("Aliases"); 303 // if(aliases != null) { 304 // foreach(XmlNode aliasNode in aliases.ChildNodes) 305 // AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value); 306 // } 307 308 // XmlNode subScopes = node.SelectSingleNode("SubScopes"); 309 // for(int i = 0; i < subScopes.ChildNodes.Count; i++) { 310 // IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects); 311 // AddSubScope(scope); 312 // } 313 //} 314 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 315 base.Populate(reader, restoredObjects); 316 myName = reader["Name"]; 317 318 reader.ReadStartElement("Variables"); 319 while(reader.IsStartElement()) { 320 IVariable variable = (IVariable)PersistenceManager.Restore(reader, restoredObjects); 299 321 AddVariable(variable); 300 322 } 301 302 XmlNode aliases = node.SelectSingleNode("Aliases"); 303 if (aliases != null) { 304 foreach (XmlNode aliasNode in aliases.ChildNodes) 305 AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value); 306 } 307 308 XmlNode subScopes = node.SelectSingleNode("SubScopes"); 309 for (int i = 0; i < subScopes.ChildNodes.Count; i++) { 310 IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects); 323 reader.ReadEndElement(); 324 325 if(reader.IsStartElement() && reader.Name=="Aliases") { 326 reader.ReadStartElement("Aliases"); 327 while(reader.IsStartElement()) 328 AddAlias(reader["Alias"], reader["Name"]); 329 reader.ReadEndElement(); 330 } 331 reader.ReadStartElement("SubScopes"); 332 while(reader.IsStartElement()) { 333 IScope scope = (IScope)PersistenceManager.Restore(reader, restoredObjects); 311 334 AddSubScope(scope); 312 335 } 336 reader.ReadEndElement(); 313 337 } 314 338 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/StorableBase.cs
r40 r121 55 55 return node; 56 56 } 57 public virtual void Populate(Xml Node node, IDictionary<Guid,IStorable> restoredObjects) {58 myGuid = new Guid( node.Attributes["GUID"].Value);57 public virtual void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) { 58 myGuid = new Guid(reader["GUID"]); 59 59 } 60 60 } -
branches/XmlTextReaderBranch/HeuristicLab.Core/Variable.cs
r2 r121 109 109 return node; 110 110 } 111 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 112 myName = node.Attributes["Name"].Value; 113 XmlNode valueNode = node.SelectSingleNode("Value"); 114 if (valueNode != null) 115 myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects); 111 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 112 // myName = node.Attributes["Name"].Value; 113 // XmlNode valueNode = node.SelectSingleNode("Value"); 114 // if(valueNode != null) 115 // myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects); 116 //} 117 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 118 myName = reader["Name"]; 119 if(reader.IsStartElement()) 120 myValue = (IItem)PersistenceManager.Restore(reader, "Value", restoredObjects); 116 121 } 117 122 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Core/VariableInfo.cs
r40 r121 137 137 return node; 138 138 } 139 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 140 myActualName = node.Attributes["ActualName"].Value; 141 myFormalName = node.Attributes["FormalName"].Value; 142 myDescription = node.Attributes["Description"].Value; 143 myDataType = Type.GetType(node.Attributes["DataType"].Value, true); 144 myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value); 145 myLocal = bool.Parse(node.Attributes["Local"].Value); 139 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 140 // myActualName = node.Attributes["ActualName"].Value; 141 // myFormalName = node.Attributes["FormalName"].Value; 142 // myDescription = node.Attributes["Description"].Value; 143 // myDataType = Type.GetType(node.Attributes["DataType"].Value, true); 144 // myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value); 145 // myLocal = bool.Parse(node.Attributes["Local"].Value); 146 //} 147 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 148 myActualName = reader["ActualName"]; 149 myFormalName = reader["FormalName"]; 150 myDescription = reader["Description"]; 151 myDataType = Type.GetType(reader["DataType"], true); 152 myKind = (VariableKind)Enum.Parse(typeof(VariableKind), reader["Kind"]); 153 myLocal = bool.Parse(reader["Local"]); 146 154 } 147 155 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolArrayData.cs
r2 r121 49 49 return node; 50 50 } 51 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 52 base.Populate(node, restoredObjects); 53 string[] tokens = node.InnerText.Split(';'); 51 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 52 // base.Populate(node, restoredObjects); 53 // string[] tokens = node.InnerText.Split(';'); 54 // bool[] data = new bool[tokens.Length]; 55 // for(int i = 0; i < data.Length; i++) 56 // data[i] = bool.Parse(tokens[i]); 57 // Data = data; 58 //} 59 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 60 base.Populate(reader, restoredObjects); 61 string[] tokens = reader.ReadString().Split(';'); 54 62 bool[] data = new bool[tokens.Length]; 55 for 63 for(int i = 0; i < data.Length; i++) 56 64 data[i] = bool.Parse(tokens[i]); 57 65 Data = data; -
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 Data = bool.Parse(node.InnerText); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // Data = bool.Parse(node.InnerText); 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 Data = bool.Parse(reader.ReadString()); 61 65 } 62 66 -
branches/XmlTextReaderBranch/HeuristicLab.Data/BoolMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // bool[,] data = new bool[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // data[i, j] = bool.Parse(tokens[i * dim2 + j]); 67 // } 68 // } 69 // Data = data; 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 74 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 75 string[] tokens = reader.ReadString().Split(';'); 63 76 bool[,] data = new bool[dim1, dim2]; 64 for 65 for 77 for(int i = 0; i < dim1; i++) { 78 for(int j = 0; j < dim2; j++) { 66 79 data[i, j] = bool.Parse(tokens[i * dim2 + j]); 67 80 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedDoubleData.cs
r2 r121 61 61 return node; 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // base.Data = (DoubleData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 66 //} 67 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 68 base.Populate(reader, restoredObjects); 69 base.Data = (DoubleData)PersistenceManager.Restore(reader, "Value", restoredObjects); 66 70 } 67 71 -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedIntData.cs
r2 r121 61 61 return node; 62 62 } 63 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 64 base.Populate(node, restoredObjects); 65 base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 63 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 64 // base.Populate(node, restoredObjects); 65 // base.Data = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Value"), restoredObjects); 66 //} 67 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 68 base.Populate(reader, restoredObjects); 69 base.Data = (IntData)PersistenceManager.Restore(reader, "Value", restoredObjects); 66 70 } 67 71 -
branches/XmlTextReaderBranch/HeuristicLab.Data/ConstrainedItemList.cs
r2 r121 67 67 } 68 68 69 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 70 base.Populate(node, restoredObjects); 71 XmlNode listNode = node.SelectSingleNode("ListItems"); 69 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 70 // base.Populate(node, restoredObjects); 71 // XmlNode listNode = node.SelectSingleNode("ListItems"); 72 // list = new List<IItem>(); 73 // for(int i = 0; i < listNode.ChildNodes.Count; i++) 74 // list.Add((IItem)PersistenceManager.Restore(listNode.ChildNodes[i], restoredObjects)); 75 // suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value); 76 //} 77 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 78 base.Populate(reader, restoredObjects); 79 reader.ReadStartElement("ListItems"); 80 suspendConstraintCheck = bool.Parse(reader["SuspendConstraintCheck"]); 72 81 list = new List<IItem>(); 73 for (int i = 0; i < listNode.ChildNodes.Count; i++)74 list.Add((IItem)PersistenceManager.Restore( listNode.ChildNodes[i], restoredObjects));75 suspendConstraintCheck = bool.Parse(listNode.Attributes["SuspendConstraintCheck"].Value);82 while(reader.IsStartElement()) 83 list.Add((IItem)PersistenceManager.Restore(reader, restoredObjects)); 84 reader.ReadEndElement(); 76 85 } 77 86 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleArrayData.cs
r2 r121 50 50 return node; 51 51 } 52 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 53 base.Populate(node, restoredObjects); 54 string[] tokens = node.InnerText.Split(';'); 52 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 53 // base.Populate(node, restoredObjects); 54 // string[] tokens = node.InnerText.Split(';'); 55 // double[] data = new double[tokens.Length]; 56 // for(int i = 0; i < data.Length; i++) 57 // if(double.TryParse(tokens[i], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i]) == false) { 58 // throw new FormatException("Can't parse " + tokens[i] + " as double value."); 59 // } 60 // Data = data; 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 string[] tokens = reader.ReadString().Split(';'); 55 65 double[] data = new double[tokens.Length]; 56 66 for(int i = 0; i < data.Length; i++) -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleData.cs
r2 r121 57 57 return node; 58 58 } 59 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 60 base.Populate(node, restoredObjects); 59 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 // base.Populate(node, restoredObjects); 61 // double data; 62 // if(double.TryParse(node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 63 // Data = data; 64 // } else { 65 // throw new FormatException("Can't parse " + node.InnerText + " as double value."); 66 // } 67 //} 68 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 69 base.Populate(reader, restoredObjects); 61 70 double data; 62 if(double.TryParse( node.InnerText, NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) {71 if(double.TryParse(reader.ReadString(), NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data) == true) { 63 72 Data = data; 64 73 } else { 65 throw new FormatException("Can't parse " + node.InnerText + " as double value.");74 throw new FormatException("Can't parse " + reader.ReadString() + " as double value."); 66 75 } 67 76 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/DoubleMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // double[,] data = new double[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 67 // throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 68 // } 69 // } 70 // } 71 // Data = data; 72 //} 73 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 74 base.Populate(reader, restoredObjects); 75 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 76 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 77 string[] tokens = reader.ReadString().Split(';'); 63 78 double[,] data = new double[dim1, dim2]; 64 for 65 for 66 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) ==false) {79 for(int i = 0; i < dim1; i++) { 80 for(int j = 0; j < dim2; j++) { 81 if(double.TryParse(tokens[i * dim2 + j], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out data[i, j]) == false) { 67 82 throw new FormatException("Can't parse " + tokens[i * dim2 + j] + " as double value."); 68 83 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntArrayData.cs
r2 r121 50 50 return node; 51 51 } 52 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 53 base.Populate(node, restoredObjects); 54 if (!node.InnerText.Equals("")) { 55 string[] tokens = node.InnerText.Split(';'); 52 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 53 // base.Populate(node, restoredObjects); 54 // if(!node.InnerText.Equals("")) { 55 // string[] tokens = node.InnerText.Split(';'); 56 // int[] data = new int[tokens.Length]; 57 // for(int i = 0; i < data.Length; i++) 58 // data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 59 // Data = data; 60 // } 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 string innerText = reader.ReadString(); 65 if(!innerText.Equals("")) { 66 string[] tokens = innerText.Split(';'); 56 67 int[] data = new int[tokens.Length]; 57 for 68 for(int i = 0; i < data.Length; i++) 58 69 data[i] = int.Parse(tokens[i], CultureInfo.InvariantCulture.NumberFormat); 59 70 Data = data; -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntData.cs
r2 r121 57 57 return node; 58 58 } 59 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 60 base.Populate(node, restoredObjects); 61 Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 59 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 60 // base.Populate(node, restoredObjects); 61 // Data = int.Parse(node.InnerText, CultureInfo.InvariantCulture.NumberFormat); 62 //} 63 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(reader, restoredObjects); 65 Data = int.Parse(reader.ReadString(), CultureInfo.InvariantCulture.NumberFormat); 62 66 } 63 67 -
branches/XmlTextReaderBranch/HeuristicLab.Data/IntMatrixData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 string[] tokens = node.InnerText.Split(';'); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // int dim1 = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 61 // int dim2 = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 62 // string[] tokens = node.InnerText.Split(';'); 63 // int[,] data = new int[dim1, dim2]; 64 // for(int i = 0; i < dim1; i++) { 65 // for(int j = 0; j < dim2; j++) { 66 // data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 67 // } 68 // } 69 // Data = data; 70 //} 71 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 72 base.Populate(reader, restoredObjects); 73 int dim1 = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 74 int dim2 = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 75 string[] tokens = reader.ReadString().Split(';'); 63 76 int[,] data = new int[dim1, dim2]; 64 for 65 for 77 for(int i = 0; i < dim1; i++) { 78 for(int j = 0; j < dim2; j++) { 66 79 data[i, j] = int.Parse(tokens[i * dim2 + j], CultureInfo.InvariantCulture.NumberFormat); 67 80 } -
branches/XmlTextReaderBranch/HeuristicLab.Data/ItemList_T.cs
r69 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 for (int i = 0; i < node.ChildNodes.Count; i++) 61 list.Add((T) PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // for(int i = 0; i < node.ChildNodes.Count; i++) 61 // list.Add((T)PersistenceManager.Restore(node.ChildNodes[i], restoredObjects)); 62 //} 63 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 64 base.Populate(reader, restoredObjects); 65 while(reader.IsStartElement()) 66 list.Add((T)PersistenceManager.Restore(reader, restoredObjects)); 62 67 } 63 68 -
branches/XmlTextReaderBranch/HeuristicLab.Data/StringData.cs
r2 r121 56 56 return node; 57 57 } 58 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 59 base.Populate(node, restoredObjects); 60 Data = node.InnerText; 58 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 59 // base.Populate(node, restoredObjects); 60 // Data = node.InnerText; 61 //} 62 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 63 base.Populate(reader, restoredObjects); 64 Data = reader.ReadString(); 61 65 } 62 66 -
branches/XmlTextReaderBranch/HeuristicLab.DataAnalysis/Dataset.cs
r2 r121 141 141 } 142 142 143 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 144 base.Populate(node, restoredObjects); 145 Name = node.Attributes["Name"].Value; 146 rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 147 columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 148 149 VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value); 150 151 string[] tokens = node.InnerText.Split(';'); 143 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 144 // base.Populate(node, restoredObjects); 145 // Name = node.Attributes["Name"].Value; 146 // rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat); 147 // columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat); 148 149 // VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value); 150 151 // string[] tokens = node.InnerText.Split(';'); 152 // if(tokens.Length != rows * columns) throw new FormatException(); 153 // samples = new double[rows * columns]; 154 // for(int row = 0; row < rows; row++) { 155 // for(int column = 0; column < columns; column++) { 156 // if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 157 // throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 158 // } 159 // } 160 // } 161 // CreateDictionaries(); 162 //} 163 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 164 base.Populate(reader, restoredObjects); 165 Name = reader["Name"]; 166 rows = int.Parse(reader["Dimension1"], CultureInfo.InvariantCulture.NumberFormat); 167 columns = int.Parse(reader["Dimension2"], CultureInfo.InvariantCulture.NumberFormat); 168 169 VariableNames = ParseVariableNamesString(reader["VariableNames"]); 170 171 string[] tokens = reader.ReadString().Split(';'); 152 172 if(tokens.Length != rows * columns) throw new FormatException(); 153 173 samples = new double[rows * columns]; 154 174 for(int row = 0; row < rows; row++) { 155 175 for(int column = 0; column < columns; column++) { 156 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row *columns + column]) == false) {176 if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) { 157 177 throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value."); 158 178 } -
branches/XmlTextReaderBranch/HeuristicLab.DistributedEngine/DistributedEngine.cs
r36 r121 188 188 return node; 189 189 } 190 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 191 base.Populate(node, restoredObjects); 192 ServerAddress = node.Attributes["ServerAddress"].Value; 190 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 191 // base.Populate(node, restoredObjects); 192 // ServerAddress = node.Attributes["ServerAddress"].Value; 193 //} 194 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 195 base.Populate(reader, restoredObjects); 196 ServerAddress = reader["ServerAddress"]; 193 197 } 194 198 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.ES/ES.cs
r98 r121 606 606 return node; 607 607 } 608 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 609 base.Populate(node, restoredObjects); 610 myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 608 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 609 // base.Populate(node, restoredObjects); 610 // myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 611 // SetReferences(); 612 //} 613 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 614 base.Populate(reader, restoredObjects); 615 myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects); 611 616 SetReferences(); 612 617 } -
branches/XmlTextReaderBranch/HeuristicLab.Functions/Constant.cs
r2 r121 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 78 // value = GetVariable("Value"); 79 //} 80 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 81 base.Populate(reader, restoredObjects); 77 82 78 83 value = GetVariable("Value"); -
branches/XmlTextReaderBranch/HeuristicLab.Functions/FunctionBase.cs
r2 r121 308 308 } 309 309 310 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 311 base.Populate(node, restoredObjects); 312 XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate"); 313 if (functionTemplateNode != null) { 314 metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects); 310 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 311 // base.Populate(node, restoredObjects); 312 // XmlNode functionTemplateNode = node.SelectSingleNode("FunctionTemplate"); 313 // if(functionTemplateNode != null) { 314 // metaObject = (FunctionBase)PersistenceManager.Restore(functionTemplateNode.ChildNodes[0], restoredObjects); 315 // } else { 316 // metaObject = this; 317 // } 318 // // don't need to explicitly load the sub-functions because that has already been done in OperatorBase.Populate() 319 320 // // load local variables 321 // XmlNode variablesNode = node.SelectSingleNode("LocalVariables"); 322 323 // // remove the variables that have been added in a constructor 324 // variables.Clear(); 325 // // load the persisted variables 326 // foreach(XmlNode variableNode in variablesNode.ChildNodes) 327 // variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 328 //} 329 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 330 base.Populate(reader, restoredObjects); 331 if(reader.IsStartElement() && reader.Name == "FunctionTemplate") { 332 metaObject = (FunctionBase)PersistenceManager.Restore(reader, restoredObjects); 315 333 } else { 316 334 metaObject = this; … … 319 337 320 338 // load local variables 321 XmlNode variablesNode = node.SelectSingleNode("LocalVariables"); 322 339 reader.ReadStartElement("LocalVariables"); 323 340 // remove the variables that have been added in a constructor 324 341 variables.Clear(); 325 342 // load the persisted variables 326 foreach (XmlNode variableNode in variablesNode.ChildNodes) 327 variables.Add((IVariable)PersistenceManager.Restore(variableNode, restoredObjects)); 343 while(reader.IsStartElement()) 344 variables.Add((IVariable)PersistenceManager.Restore(reader, restoredObjects)); 345 reader.ReadEndElement(); 328 346 } 329 347 -
branches/XmlTextReaderBranch/HeuristicLab.Functions/Variable.cs
r2 r121 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); 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); 98 106 99 107 variable = (ConstrainedIntData)GetVariable("Variable").Value; -
branches/XmlTextReaderBranch/HeuristicLab.Grid/ProcessingEngine.cs
r27 r121 52 52 } 53 53 54 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 55 base.Populate(node, restoredObjects); 56 initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 54 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 55 // base.Populate(node, restoredObjects); 56 // initialOperation = (AtomicOperation)PersistenceManager.Restore(node.SelectSingleNode("InitialOperation"), restoredObjects); 57 //} 58 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 59 base.Populate(reader, restoredObjects); 60 initialOperation = (AtomicOperation)PersistenceManager.Restore(reader, "InitialOperation", restoredObjects); 57 61 } 58 62 -
branches/XmlTextReaderBranch/HeuristicLab.Logging/Linechart.cs
r2 r121 89 89 return node; 90 90 } 91 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 92 base.Populate(node, restoredObjects); 93 myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects); 94 myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects); 91 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 92 // base.Populate(node, restoredObjects); 93 // myNumberOfLines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("NumberOfLines"), restoredObjects); 94 // myValues = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Values"), restoredObjects); 95 //} 96 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 97 base.Populate(reader, restoredObjects); 98 myNumberOfLines = (IntData)PersistenceManager.Restore(reader, "NumberOfLines", restoredObjects); 99 myValues = (ItemList)PersistenceManager.Restore(reader, "Values", restoredObjects); 95 100 } 96 101 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Logging/Log.cs
r2 r121 64 64 return node; 65 65 } 66 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 67 base.Populate(node, restoredObjects); 68 myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects); 66 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 67 // base.Populate(node, restoredObjects); 68 // myItems = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Items"), restoredObjects); 69 //} 70 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 71 base.Populate(reader, restoredObjects); 72 myItems = (ItemList)PersistenceManager.Restore(reader, "Items", restoredObjects); 69 73 } 70 74 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Operators.Programmable/ProgrammableOperator.cs
r117 r121 202 202 return node; 203 203 } 204 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 205 base.Populate(node, restoredObjects); 206 XmlNode descriptionNode = node.SelectSingleNode("Description"); 207 myDescription = descriptionNode.InnerText; 208 XmlNode codeNode = node.SelectSingleNode("Code"); 209 myCode = codeNode.InnerText; 204 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 205 // base.Populate(node, restoredObjects); 206 // XmlNode descriptionNode = node.SelectSingleNode("Description"); 207 // myDescription = descriptionNode.InnerText; 208 // XmlNode codeNode = node.SelectSingleNode("Code"); 209 // myCode = codeNode.InnerText; 210 //} 211 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 212 base.Populate(reader, restoredObjects); 213 reader.ReadStartElement("Description"); 214 myDescription = reader.ReadString(); 215 reader.ReadEndElement(); 216 reader.ReadStartElement("Code"); 217 myCode = reader.ReadString(); 218 reader.ReadEndElement(); 210 219 } 211 220 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Operators/CombinedOperator.cs
r89 r121 96 96 return node; 97 97 } 98 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 99 base.Populate(node, restoredObjects); 100 XmlNode descriptionNode = node.SelectSingleNode("Description"); 101 if (descriptionNode != null) myDescription = descriptionNode.InnerText; 102 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 98 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 99 // base.Populate(node, restoredObjects); 100 // XmlNode descriptionNode = node.SelectSingleNode("Description"); 101 // if(descriptionNode != null) myDescription = descriptionNode.InnerText; 102 // myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects); 103 //} 104 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 105 base.Populate(reader, restoredObjects); 106 if(reader.IsStartElement() && reader.Name == "Description") { 107 reader.ReadStartElement("Description"); 108 myDescription = reader.ReadString(); 109 reader.ReadEndElement(); 110 } 111 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects); 103 112 } 104 113 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Random/MersenneTwister.cs
r2 r121 130 130 return node; 131 131 } 132 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 133 base.Populate(node, restoredObjects); 134 135 string stateString = node.SelectSingleNode("State").InnerText; 132 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 133 // base.Populate(node, restoredObjects); 134 135 // string stateString = node.SelectSingleNode("State").InnerText; 136 // string[] tokens = stateString.Split(';'); 137 // for(int i = 0; i < tokens.Length; i++) 138 // state[i] = uint.Parse(tokens[i]); 139 // p = int.Parse(node.SelectSingleNode("P").InnerText); 140 // init = bool.Parse(node.SelectSingleNode("Init").InnerText); 141 //} 142 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 143 base.Populate(reader, restoredObjects); 144 145 reader.ReadStartElement("State"); 146 string stateString = reader.ReadString(); 147 reader.ReadEndElement(); 136 148 string[] tokens = stateString.Split(';'); 137 for 149 for(int i = 0; i < tokens.Length; i++) 138 150 state[i] = uint.Parse(tokens[i]); 139 p = int.Parse(node.SelectSingleNode("P").InnerText); 140 init = bool.Parse(node.SelectSingleNode("Init").InnerText); 151 reader.ReadStartElement("P"); 152 p = int.Parse(reader.ReadString()); 153 reader.ReadEndElement(); 154 reader.ReadStartElement("Init"); 155 init = bool.Parse(reader.ReadString()); 156 reader.ReadEndElement(); 141 157 } 142 158 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Random/NormalDistributedRandom.cs
r2 r121 529 529 } 530 530 531 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 532 base.Populate(node, restoredObjects); 533 534 mu = double.Parse(node.SelectSingleNode("Mu").InnerText); 535 sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText); 536 uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects); 531 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 532 // base.Populate(node, restoredObjects); 533 534 // mu = double.Parse(node.SelectSingleNode("Mu").InnerText); 535 // sigma = double.Parse(node.SelectSingleNode("Sigma").InnerText); 536 // uniform = (IRandom)PersistenceManager.Restore(node.SelectSingleNode("UniformRandom"), restoredObjects); 537 //} 538 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 539 base.Populate(reader, restoredObjects); 540 reader.ReadStartElement("Mu"); 541 mu = double.Parse(reader.ReadString()); 542 reader.ReadEndElement(); 543 reader.ReadStartElement("Sigma"); 544 sigma = double.Parse(reader.ReadString()); 545 reader.ReadEndElement(); 546 uniform = (IRandom)PersistenceManager.Restore(reader, "UniformRandom", restoredObjects); 537 547 } 538 548 -
branches/XmlTextReaderBranch/HeuristicLab.Routing.TSP/TSPTour.cs
r2 r121 78 78 return node; 79 79 } 80 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 81 base.Populate(node, restoredObjects); 82 myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects); 83 myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects); 80 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 81 // base.Populate(node, restoredObjects); 82 // myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(node.SelectSingleNode("Coordinates"), restoredObjects); 83 // myTour = (Permutation.Permutation)PersistenceManager.Restore(node.SelectSingleNode("Tour"), restoredObjects); 84 //} 85 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 86 base.Populate(reader, restoredObjects); 87 myCoordinates = (DoubleMatrixData)PersistenceManager.Restore(reader, "Coordinates", restoredObjects); 88 myTour = (Permutation.Permutation)PersistenceManager.Restore(reader, "Tour", restoredObjects); 84 89 } 85 90 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.SGA/SGA.cs
r65 r121 511 511 return node; 512 512 } 513 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 514 base.Populate(node, restoredObjects); 515 myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 513 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 514 // base.Populate(node, restoredObjects); 515 // myEngine = (IEngine)PersistenceManager.Restore(node.SelectSingleNode("Engine"), restoredObjects); 516 // SetReferences(); 517 //} 518 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 519 base.Populate(reader, restoredObjects); 520 myEngine = (IEngine)PersistenceManager.Restore(reader, "Engine", restoredObjects); 516 521 SetReferences(); 517 522 } -
branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/JSSPInjector.cs
r120 r121 88 88 return node; 89 89 } 90 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 91 base.Populate(node, restoredObjects); 92 operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects); 93 jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects); 94 machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 90 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 91 // base.Populate(node, restoredObjects); 92 // operations = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Operations"), restoredObjects); 93 // jobs = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Jobs"), restoredObjects); 94 // machines = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 95 //} 96 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 97 base.Populate(reader, restoredObjects); 98 operations = (ItemList)PersistenceManager.Restore(reader, "Operations", restoredObjects); 99 jobs = (IntData)PersistenceManager.Restore(reader, "Jobs", restoredObjects); 100 machines = (IntData)PersistenceManager.Restore(reader, "Machines", restoredObjects); 95 101 } 96 102 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/Operation.cs
r2 r121 150 150 } 151 151 152 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 153 base.Populate(node, restoredObjects); 154 job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects); 155 operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects); 156 start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects); 157 duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects); 158 predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects); 159 machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 152 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 153 // base.Populate(node, restoredObjects); 154 // job = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Job"), restoredObjects); 155 // operationIndex = (IntData)PersistenceManager.Restore(node.SelectSingleNode("OperationIndex"), restoredObjects); 156 // start = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Start"), restoredObjects); 157 // duration = (IntData)PersistenceManager.Restore(node.SelectSingleNode("Duration"), restoredObjects); 158 // predecessors = (ItemList)PersistenceManager.Restore(node.SelectSingleNode("Predecessors"), restoredObjects); 159 // machines = (IntArrayData)PersistenceManager.Restore(node.SelectSingleNode("Machines"), restoredObjects); 160 //} 161 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 162 base.Populate(reader, restoredObjects); 163 job = (IntData)PersistenceManager.Restore(reader, "Job", restoredObjects); 164 operationIndex = (IntData)PersistenceManager.Restore(reader, "OperationIndex", restoredObjects); 165 start = (IntData)PersistenceManager.Restore(reader, "Start", restoredObjects); 166 duration = (IntData)PersistenceManager.Restore(reader, "Duration", restoredObjects); 167 predecessors = (ItemList)PersistenceManager.Restore(reader, "Predecessors", restoredObjects); 168 machines = (IntArrayData)PersistenceManager.Restore(reader, "Machines", restoredObjects); 160 169 } 161 170 -
branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/Schedule.cs
r2 r121 77 77 } 78 78 79 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 80 base.Populate(node, restoredObjects); 81 int machines = int.Parse(node.Attributes["Machines"].Value); 79 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 80 // base.Populate(node, restoredObjects); 81 // int machines = int.Parse(node.Attributes["Machines"].Value); 82 // schedule = new ScheduleTree[machines]; 83 // for(int i = 0; i < machines; i++) { 84 // schedule[i] = (ScheduleTree)PersistenceManager.Restore(node.SelectSingleNode("Machine" + i.ToString()), restoredObjects); 85 // } 86 //} 87 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 88 base.Populate(reader, restoredObjects); 89 int machines = int.Parse(reader["Machines"]); 82 90 schedule = new ScheduleTree[machines]; 83 91 for(int i = 0; i < machines; i++) { 84 schedule[i] = (ScheduleTree)PersistenceManager.Restore( node.SelectSingleNode("Machine" + i.ToString()), restoredObjects);92 schedule[i] = (ScheduleTree)PersistenceManager.Restore(reader, "Machine" + i.ToString(), restoredObjects); 85 93 } 86 94 } -
branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/ScheduleInjector.cs
r77 r121 71 71 return node; 72 72 } 73 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 74 base.Populate(node, restoredObjects); 75 XmlNode scheduleNode = node.SelectSingleNode("Schedule"); 76 if(scheduleNode != null) { 77 schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects); 78 } 73 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 74 // base.Populate(node, restoredObjects); 75 // XmlNode scheduleNode = node.SelectSingleNode("Schedule"); 76 // if(scheduleNode != null) { 77 // schedule = (Schedule)PersistenceManager.Restore(scheduleNode, restoredObjects); 78 // } 79 //} 80 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 81 base.Populate(reader, restoredObjects); 82 if(reader.IsStartElement()) 83 schedule = (Schedule)PersistenceManager.Restore(reader, "Schedule", restoredObjects); 79 84 } 80 85 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.Scheduling.JSSP/ScheduleTree.cs
r2 r121 214 214 } 215 215 216 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 217 base.Populate(node, restoredObjects); 218 string[] tokens = node.InnerText.Split(';'); 216 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 217 // base.Populate(node, restoredObjects); 218 // string[] tokens = node.InnerText.Split(';'); 219 // for(int i = 0; i < tokens.Length - 1; i++) { 220 // TimeSlot t = new TimeSlot(tokens[i]); 221 // if(t.job > -1) { 222 // this.InsertOperation(t); 223 // } 224 // } 225 //} 226 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 227 base.Populate(reader, restoredObjects); 228 string[] tokens = reader.ReadString().Split(';'); 219 229 for(int i = 0; i < tokens.Length - 1; i++) { 220 230 TimeSlot t = new TimeSlot(tokens[i]); -
branches/XmlTextReaderBranch/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs
r2 r121 73 73 } 74 74 75 public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 76 base.Populate(node, restoredObjects); 77 group = (GPOperatorGroup) PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects); 75 //public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 76 // base.Populate(node, restoredObjects); 77 // group = (GPOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects); 78 //} 79 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 80 base.Populate(reader, restoredObjects); 81 group = (GPOperatorGroup)PersistenceManager.Restore(reader, "Group", restoredObjects); 78 82 } 79 83 #endregion -
branches/XmlTextReaderBranch/HeuristicLab.TestFunctions/HeuristicLab.TestFunctions.csproj
r106 r121 84 84 <EmbeddedResource Include="TestFunctionInjectorView.resx"> 85 85 <DependentUpon>TestFunctionInjectorView.cs</DependentUpon> 86 <SubType>Designer</SubType> 86 87 </EmbeddedResource> 87 88 </ItemGroup> -
branches/XmlTextReaderBranch/HeuristicLab.ThreadParallelEngine/ThreadParallelEngine.cs
r2 r121 183 183 return node; 184 184 } 185 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 186 base.Populate(node, restoredObjects); 187 myWorkers = int.Parse(node.Attributes["Workers"].Value); 185 //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 186 // base.Populate(node, restoredObjects); 187 // myWorkers = int.Parse(node.Attributes["Workers"].Value); 188 //} 189 public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) { 190 base.Populate(reader, restoredObjects); 191 myWorkers = int.Parse(reader["Workers"]); 188 192 } 189 193 #endregion
Note: See TracChangeset
for help on using the changeset viewer.