Changeset 776 for trunk/sources/HeuristicLab.Core/OperatorGraph.cs
- Timestamp:
- 11/19/08 12:12:39 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/OperatorGraph.cs
r47 r776 26 26 27 27 namespace HeuristicLab.Core { 28 /// <summary> 29 /// Represents a graph of operators. 30 /// </summary> 28 31 public class OperatorGraph : ItemBase, IOperatorGraph { 29 32 private IDictionary<Guid, IOperator> myOperators; 33 /// <summary> 34 /// Gets all operators of the current instance. 35 /// </summary> 30 36 public ICollection<IOperator> Operators { 31 37 get { return myOperators.Values; } 32 38 } 33 39 private IOperator myInitialOperator; 40 /// <summary> 41 /// Gets or sets the initial operator (the starting one). 42 /// </summary> 43 /// <remarks>Calls <see cref="OnInitialOperatorChanged"/> in the setter.</remarks> 34 44 public IOperator InitialOperator { 35 45 get { return myInitialOperator; } … … 42 52 } 43 53 54 /// <summary> 55 /// Initializes a new instance of <see cref="OperatorGraph"/>. 56 /// </summary> 44 57 public OperatorGraph() { 45 58 myOperators = new Dictionary<Guid, IOperator>(); 46 59 } 47 60 61 /// <summary> 62 /// Creates a new instance of <see cref="OperatorGraphView"/> to represent the current instance 63 /// visually. 64 /// </summary> 65 /// <returns>The created view as <see cref="OperatorGraphView"/>.</returns> 48 66 public override IView CreateView() { 49 67 return new OperatorGraphView(this); 50 68 } 51 69 70 /// <summary> 71 /// Clones the current instance (deep clone). 72 /// </summary> 73 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 74 /// <see cref="Auxiliary"/>.</remarks> 75 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 76 /// <returns>The cloned object as <see cref="OperatorGraph"/>.</returns> 52 77 public override object Clone(IDictionary<Guid, object> clonedObjects) { 53 78 OperatorGraph clone = new OperatorGraph(); … … 60 85 } 61 86 87 /// <inheritdoc/> 88 /// <remarks>Calls <see cref="OnOperatorAdded"/>.</remarks> 62 89 public void AddOperator(IOperator op) { 63 90 if (!myOperators.ContainsKey(op.Guid)) { … … 69 96 } 70 97 } 98 /// <inheritdoc/> 99 /// <remarks>Calls <see cref="OnOperatorRemoved"/>.</remarks> 71 100 public void RemoveOperator(Guid guid) { 72 101 IOperator op = GetOperator(guid); … … 87 116 } 88 117 } 118 /// <inheritdoc/> 89 119 public IOperator GetOperator(Guid guid) { 90 120 IOperator op; … … 94 124 return null; 95 125 } 126 /// <inheritdoc/> 96 127 public void Clear() { 97 128 Guid[] guids = new Guid[Operators.Count]; … … 105 136 } 106 137 138 /// <inheritdoc/> 107 139 public event EventHandler<OperatorEventArgs> OperatorAdded; 140 /// <summary> 141 /// Fires a new <c>OperatorAdded</c> event. 142 /// </summary> 143 /// <param name="op">The operator that has been added.</param> 108 144 protected virtual void OnOperatorAdded(IOperator op) { 109 145 if (OperatorAdded != null) 110 146 OperatorAdded(this, new OperatorEventArgs(op)); 111 147 } 148 /// <inheritdoc/> 112 149 public event EventHandler<OperatorEventArgs> OperatorRemoved; 150 /// <summary> 151 /// Fires a new <c>OperatorRemoved</c> event. 152 /// </summary> 153 /// <param name="op">The operator that has been removed.</param> 113 154 protected virtual void OnOperatorRemoved(IOperator op) { 114 155 if (OperatorRemoved != null) 115 156 OperatorRemoved(this, new OperatorEventArgs(op)); 116 157 } 158 /// <inheritdoc/> 117 159 public event EventHandler InitialOperatorChanged; 160 /// <summary> 161 /// Fires a new <c>InitialOperatorChanged</c> event. 162 /// </summary> 118 163 protected virtual void OnInitialOperatorChanged() { 119 164 if (InitialOperatorChanged != null) … … 122 167 123 168 #region Persistence Methods 169 /// <summary> 170 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 171 /// </summary> 172 /// <remarks>Calls <see cref="StorableBase.GetXmlNode"/> of base class <see cref="ItemBase"/>.<br/> 173 /// To save the operators of the current instance a child node is created with the tag name 174 /// <c>Operators</c>. Beyond this child node all operators are saved as child nodes themselves.<br/> 175 /// The initial operator is saved as child node with the tag name <c>InitialOperator</c>.</remarks> 176 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 177 /// <param name="document">The <see cref="XmlDocument"/> where to save the data.</param> 178 /// <param name="persistedObjects">The dictionary of all already persisted objects. 179 /// (Needed to avoid cycles.)</param> 180 /// <returns>The saved <see cref="XmlNode"/>.</returns> 124 181 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { 125 182 XmlNode node = base.GetXmlNode(name, document, persistedObjects); … … 132 189 return node; 133 190 } 191 /// <summary> 192 /// Loads the persisted operator graph from the specified <paramref name="node"/>. 193 /// </summary> 194 /// <remarks>See <see cref="GetXmlNode"/> to get more information about how the graph must be saved. <br/> 195 /// Calls <see cref="StorableBase.Populate"/> of base class <see cref="ItemBase"/>.</remarks> 196 /// <param name="node">The <see cref="XmlNode"/> where the operator graph is saved.</param> 197 /// <param name="restoredObjects">The dictionary of all already restored objects. 198 /// (Needed to avoid cycles.)</param> 134 199 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 135 200 base.Populate(node, restoredObjects);
Note: See TracChangeset
for help on using the changeset viewer.