- Timestamp:
- 07/30/09 19:41:58 (15 years ago)
- Location:
- branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/BaseClasses
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionBase.cs
r2212 r2216 101 101 } 102 102 103 public virtual IEnumerable<string> LocalParameterNames {104 get { return new string[0]; }105 }106 107 103 public virtual IFunctionTree GetTreeNode() { 108 104 return new FunctionTreeBase(this); … … 158 154 minTreeHeight = height + 1; 159 155 } 156 157 public override object Clone(IDictionary<Guid, object> clonedObjects) { 158 throw new NotSupportedException(); 159 } 160 161 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) { 162 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 163 XmlAttribute minSubTreesAttr = document.CreateAttribute("MinSubTrees"); 164 minSubTreesAttr.Value = XmlConvert.ToString(MinSubTrees); 165 XmlAttribute maxSubTreesAttr = document.CreateAttribute("MaxSubTrees"); 166 maxSubTreesAttr.Value = XmlConvert.ToString(MaxSubTrees); 167 node.Attributes.Append(minSubTreesAttr); 168 node.Attributes.Append(maxSubTreesAttr); 169 for (int i = 0; i < MaxSubTrees; i++) { 170 XmlNode slotNode = document.CreateElement("AllowedSubFunctions"); 171 XmlAttribute slotAttr = document.CreateAttribute("Slot"); 172 slotAttr.Value = XmlConvert.ToString(i); 173 slotNode.Attributes.Append(slotAttr); 174 node.AppendChild(slotNode); 175 foreach (IFunction f in GetAllowedSubFunctions(i)) { 176 slotNode.AppendChild(PersistenceManager.Persist(f, document, persistedObjects)); 177 } 178 } 179 return node; 180 } 181 182 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 183 base.Populate(node, restoredObjects); 184 MinSubTrees = XmlConvert.ToInt32(node.Attributes["MinSubTrees"].Value); 185 MaxSubTrees = XmlConvert.ToInt32(node.Attributes["MaxSubTrees"].Value); 186 foreach (XmlNode allowedSubFunctionsNode in node.SelectNodes("AllowedSubFunctions")) { 187 int slot = XmlConvert.ToInt32(allowedSubFunctionsNode.Attributes["Slot"].Value); 188 foreach (XmlNode fNode in allowedSubFunctionsNode.ChildNodes) { 189 AddAllowedSubFunction((IFunction)PersistenceManager.Restore(fNode, restoredObjects), slot); 190 } 191 } 192 } 160 193 } 161 194 } -
branches/GP-Refactoring-713/sources/HeuristicLab.GP/3.3/BaseClasses/FunctionTreeBase.cs
r2211 r2216 58 58 public IFunction Function { 59 59 get { return function; } 60 protected set { 61 function = value; 62 } 60 protected set { function = value; } 63 61 } 64 62
Note: See TracChangeset
for help on using the changeset viewer.