Changeset 125 for branches/XmlReaderWriterBranch/HeuristicLab.Constraints
- Timestamp:
- 04/15/08 16:41:18 (16 years ago)
- Location:
- branches/XmlReaderWriterBranch
- Files:
-
- 10 edited
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.