- Timestamp:
- 04/27/09 16:16:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Operators/3.3/CombinedOperator.cs
r1530 r1673 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Data; 28 using HeuristicLab.Persistence.Default.Decomposers.Storable; 28 29 29 30 namespace HeuristicLab.Operators { … … 33 34 /// </summary> 34 35 public class CombinedOperator : DelegatingOperator { 36 37 [Storable] 35 38 private string myDescription; 36 39 /// <summary> … … 40 43 get { return myDescription; } 41 44 } 45 46 [Storable] 42 47 private IOperatorGraph myOperatorGraph; 43 48 /// <summary> … … 131 136 DescriptionChanged(this, new EventArgs()); 132 137 } 133 134 #region Persistence Methods135 /// <summary>136 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>.137 /// </summary>138 /// <remarks>The description and the operator graph of the current instance are saved as child139 /// nodes with tag names <c>Description</c> <c>OperatorGraph</c>.<br/>140 /// Calls <see cref="OperatorBase.GetXmlNode"/> of base class <see cref="DelegatingOperator"/>.</remarks>141 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param>142 /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param>143 /// <param name="persistedObjects">The dictionary of all already persisted objects. (Needed to avoid cycles.)</param>144 /// <returns>The saved <see cref="XmlNode"/>.</returns>145 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {146 XmlNode node = base.GetXmlNode(name, document, persistedObjects);147 XmlNode descriptionNode = document.CreateNode(XmlNodeType.Element, "Description", null);148 descriptionNode.InnerText = myDescription;149 node.AppendChild(descriptionNode);150 node.AppendChild(PersistenceManager.Persist("OperatorGraph", OperatorGraph, document, persistedObjects));151 return node;152 }153 /// <summary>154 /// Loads the persisted instance from the specified <paramref name="node"/>.155 /// </summary>156 /// <remarks>Calls <see cref="OperatorBase.Populate"/> of base class <see cref="DelegatingOperator"/>.157 /// <br/> See <see cref="GetXmlNode"/> for further information on how the data must be saved.</remarks>158 /// <param name="node">The <see cref="XmlNode"/> where the operator is saved.</param>159 /// <param name="restoredObjects">The dictionary of all already restored objects.160 /// (Needed to avoid cycles.)</param>161 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {162 base.Populate(node, restoredObjects);163 XmlNode descriptionNode = node.SelectSingleNode("Description");164 if (descriptionNode != null) myDescription = descriptionNode.InnerText;165 myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);166 }167 #endregion168 138 } 169 139 }
Note: See TracChangeset
for help on using the changeset viewer.