- Timestamp:
- 06/03/09 02:40:39 (15 years ago)
- Location:
- branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2
- Files:
-
- 5 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/AtomicOperation.cs
r1529 r1994 37 37 get { return myOperator; } 38 38 } 39 private IScope myScope; 39 private IEnvironment myEnvironment; 40 /// <summary> 41 /// Gets the current environment as <see cref="IEnvironment"/>. 42 /// </summary> 43 public IEnvironment Environment { 44 get { return myEnvironment; } 45 } 46 private IScope myScope; 40 47 /// <summary> 41 48 /// Gets the current scope as <see cref="IScope"/>. … … 54 61 /// </summary> 55 62 /// <param name="op">The operator to assign.</param> 63 /// <param name="environment">The environment to assign.</param> 56 64 /// <param name="scope">The scope to assign.</param> 57 public AtomicOperation(IOperator op, I Scope scope) {65 public AtomicOperation(IOperator op, IEnvironment environment, IScope scope) { 58 66 myOperator = op; 67 myEnvironment = environment; 59 68 myScope = scope; 60 69 } … … 71 80 clonedObjects.Add(Guid, clone); 72 81 clone.myOperator = (IOperator)Auxiliary.Clone(Operator, clonedObjects); 82 clone.myEnvironment = (IEnvironment)Auxiliary.Clone(Environment, clonedObjects); 73 83 clone.myScope = (IScope)Auxiliary.Clone(Scope, clonedObjects); 74 84 return clone; … … 83 93 /// class <see cref="ItemBase"/>. <br/> 84 94 /// The operator is saved as child node having the tag name <c>Operator</c>.<br/> 95 /// The environment is also saved as a child node having the tag name <c>Environment</c>.<br/> 85 96 /// The scope is also saved as a child node having the tag name <c>Scope</c>.</remarks> 86 97 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> … … 91 102 XmlNode node = base.GetXmlNode(name, document, persistedObjects); 92 103 node.AppendChild(PersistenceManager.Persist("Operator", Operator, document, persistedObjects)); 104 node.AppendChild(PersistenceManager.Persist("Environment", Environment, document, persistedObjects)); 93 105 node.AppendChild(PersistenceManager.Persist("Scope", Scope, document, persistedObjects)); 94 106 return node; … … 99 111 /// <remarks>Calls <see cref="HeuristicLab.Core.StorableBase.Populate"/> of base class 100 112 /// <see cref="ItemBase"/>.<br/> 101 /// The operator must be saved as a child node with the tag name <c>Operator</c>, also the scope must 113 /// The operator must be saved as a child node with the tag name <c>Operator</c>, the environment must be saved as 114 /// a child node with the tag name <c>Environment</c>, and also the scope must 102 115 /// be saved as a child node having the tag name <c>Scope</c> (see <see cref="GetXmlNode"/>).</remarks> 103 116 /// <param name="node">The <see cref="XmlNode"/> where the operation is saved.</param> … … 106 119 base.Populate(node, restoredObjects); 107 120 myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects); 121 myEnvironment = (IEnvironment)PersistenceManager.Restore(node.SelectSingleNode("Environment"), restoredObjects); 108 122 myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects); 109 123 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/HeuristicLab.Core-3.2.csproj
r1534 r1994 126 126 </Compile> 127 127 <Compile Include="AliasEventArgs.cs" /> 128 <Compile Include="Environment.cs" /> 129 <Compile Include="ParameterEventArgs.cs" /> 130 <Compile Include="ParameterType.cs" /> 131 <Compile Include="Interfaces\IParameter.cs" /> 132 <Compile Include="Interfaces\IEnvironment.cs" /> 128 133 <Compile Include="KeyValueEventArgs.cs" /> 129 134 <Compile Include="OperatorBaseDescriptionView.cs"> -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/Interfaces/IItem.cs
r776 r1994 29 29 /// </summary> 30 30 public interface IItem : IStorable, IViewable { 31 /// <summary>32 /// Fires a new <c>Changed</c> event.33 /// </summary>34 void FireChanged();35 36 /// <summary>37 /// Occurs when the current instance has changed.38 /// </summary>39 event EventHandler Changed;40 31 } 41 32 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/Interfaces/IOperator.cs
r1851 r1994 29 29 /// a basic instruction of an algorithm. 30 30 /// </summary> 31 public interface IOperator : I ConstrainedItem {31 public interface IOperator : IItem { 32 32 /// <summary> 33 33 /// Gets or sets the name of the current instance. … … 49 49 50 50 /// <summary> 51 /// Gets a list of all sub operators.52 /// </summary>53 IList<IOperator> SubOperators { get; }54 /// <summary>55 51 /// Gets a collection of all variable (parameter) infos. 56 52 /// </summary> 57 ICollection<IVariableInfo> VariableInfos { get; } 58 /// <summary> 59 /// Gets a collection of all variables of the current operator. 60 /// </summary> 61 ICollection<IVariable> Variables { get; } 62 63 /// <summary> 64 /// Adds the given sub operator to the current instance. 65 /// </summary> 66 /// <param name="op">The operator to add.</param> 67 void AddSubOperator(IOperator op); 68 /// <summary> 69 /// Adds the given sub operator to the current instance if all constraints can be fulfilled. 70 /// </summary> 71 /// <param name="op">The operator to add.</param> 72 /// <returns><c>true</c> if the operator could be added without violating constraints, 73 /// <c>false</c> otherwise.</returns> 74 bool TryAddSubOperator(IOperator op); 75 /// <summary> 76 /// Adds the given sub operator to the current instance if all constraints can be fulfilled. 77 /// </summary> 78 /// <param name="op">The operator to add.</param> 79 /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be 80 /// fulfilled.</param> 81 /// <returns><c>true</c> if the operator could be added without violating constraints, 82 /// <c>false</c> otherwise.</returns> 83 bool TryAddSubOperator(IOperator op, out ICollection<IConstraint> violatedConstraints); 84 /// <summary> 85 /// Adds the given sub operator at a the specified <paramref name="index"/>. 86 /// </summary> 87 /// <param name="op">The operator to add.</param> 88 /// <param name="index">The position where to add the operator.</param> 89 void AddSubOperator(IOperator op, int index); 90 /// <summary> 91 /// Adds the given operator at the specified <paramref name="index"/> to the current instance 92 /// if all constraints can be fulfilled. 93 /// </summary> 94 /// <param name="op">The operator to add.</param> 95 /// <param name="index">The position where to add the operator.</param> 96 /// <returns><c>true</c> if the operator could be added without violating constraints, 97 /// <c>false</c> otherwise.</returns> 98 bool TryAddSubOperator(IOperator op, int index); 99 /// <summary> 100 /// Adds the given operator at the specified <paramref name="index"/> to the current instance 101 /// if all constraints can be fulfilled. 102 /// </summary> 103 /// <param name="op">The operator to add.</param> 104 /// <param name="index">The position where to add the operator.</param> 105 /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be 106 /// fulfilled.</param> 107 /// <returns><c>true</c> if the operator could be added without violating constraints, 108 /// <c>false</c> otherwise.</returns> 109 bool TryAddSubOperator(IOperator op, int index, out ICollection<IConstraint> violatedConstraints); 110 /// <summary> 111 /// Removes a sub operator at the specified <paramref name="index"/>. 112 /// </summary> 113 /// <param name="index">The position where to delete the operator.</param> 114 void RemoveSubOperator(int index); 115 /// <summary> 116 /// Removes a sub operator at the specified <paramref name="index"/> if all constraint can be fulfilled. 117 /// </summary> 118 /// <param name="index">The position where to delete the operator.</param> 119 /// <returns><c>true</c> if the operator could be deleted without violating constraints, 120 /// <c>false</c> otherwise.</returns> 121 bool TryRemoveSubOperator(int index); 122 /// <summary> 123 /// Deletes the operator at the specified <paramref name="index"/> 124 /// if all constraints can be fulfilled. 125 /// </summary> 126 /// <param name="index">The position where to delete the operator.</param> 127 /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be 128 /// fulfilled.</param> 129 /// <returns><c>true</c> if the operator could be deleted without violating constraints, 130 /// <c>false</c> otherwise.</returns> 131 bool TryRemoveSubOperator(int index, out ICollection<IConstraint> violatedConstraints); 53 ICollection<IParameter> Parameters { get; } 132 54 133 55 /// <summary> … … 136 58 /// <param name="formalName">The formal name of the variable info.</param> 137 59 /// <returns>The variable info with the specified formal name.</returns> 138 I VariableInfo GetVariableInfo(string formalName);60 IParameter GetParameter(string name); 139 61 /// <summary> 140 62 /// Adds the specified variable info to the current instance. 141 63 /// </summary> 142 64 /// <param name="variableInfo">The variable info to add.</param> 143 void AddVariableInfo(IVariableInfo variableInfo); 144 /// <summary> 145 /// Adds the specified variable info to the current instance, if all constraints can be fulfilled. 146 /// </summary> 147 /// <param name="variableInfo">The variable info to add.</param> 148 /// <returns><c>true</c> if the variable info could be added without violating constraints, 149 /// <c>false</c> otherwise.</returns> 150 bool TryAddVariableInfo(IVariableInfo variableInfo); 151 /// <summary> 152 /// Adds the specified variable info to the current instance, if all constraints can be fulfilled. 153 /// </summary> 154 /// <param name="variableInfo">The variable info to add.</param> 155 /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be 156 /// fulfilled.</param> 157 /// <returns><c>true</c> if the variable info could be added without violating constraints, 158 /// <c>false</c> otherwise.</returns> 159 bool TryAddVariableInfo(IVariableInfo variableInfo, out ICollection<IConstraint> violatedConstraints); 65 void AddParameter(IParameter parameter); 160 66 /// <summary> 161 67 /// Removes the variable info with the given formal name. 162 68 /// </summary> 163 69 /// <param name="formalName">The formal name of the variable info to remove.</param> 164 void RemoveVariableInfo(string formalName); 165 /// <summary> 166 /// Deletes the variable info with the given formal name, 167 /// if all constraints can be fulfilled. 168 /// </summary> 169 /// <param name="formalName">The formal name of the variable info to remove.</param> 170 /// <returns><c>true</c> if the variable info could be deleted without violating constraints, 171 /// <c>false</c> otherwise.</returns> 172 bool TryRemoveVariableInfo(string formalName); 173 /// <summary> 174 /// Deletes the variable info with the given formal name, 175 /// if all constraints can be fulfilled. 176 /// </summary> 177 /// <param name="formalName">The formal name of the variable info to remove.</param> 178 /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be 179 /// fulfilled.</param> 180 /// <returns><c>true</c> if the variable info could be deleted without violating constraints, 181 /// <c>false</c> otherwise.</returns> 182 bool TryRemoveVariableInfo(string formalName, out ICollection<IConstraint> violatedConstraints); 183 184 /// <summary> 185 /// Gets a variable with the given <paramref name="name"/>. 186 /// </summary> 187 /// <param name="name">The name of the variable.</param> 188 /// <returns>The variable with the specified name.</returns> 189 IVariable GetVariable(string name); 190 /// <summary> 191 /// Adds the specified <paramref name="variable"/> to the current instance. 192 /// </summary> 193 /// <param name="variable">The variable to add.</param> 194 void AddVariable(IVariable variable); 195 /// <summary> 196 /// Adds the specified <paramref name="variable"/> to the current instance if all constraints can 197 /// be fulfilled. 198 /// </summary> 199 /// <param name="variable">The variable to add.</param> 200 /// <returns><c>true</c> if the variable could be added without violating constraints, 201 /// <c>false</c> otherwise.</returns> 202 bool TryAddVariable(IVariable variable); 203 /// <summary> 204 /// Adds the specified <paramref name="variable"/> to the current instance if all constraints can 205 /// be fulfilled. 206 /// </summary> 207 /// <param name="variable">The variable to add.</param> 208 /// <param name="violatedConstraints">Output parameter; contains all constraints that could 209 /// not be fulfillled.</param> 210 /// <returns><c>true</c> if the variable could be added without violating constraints, 211 /// <c>false</c> otherwise.</returns> 212 bool TryAddVariable(IVariable variable, out ICollection<IConstraint> violatedConstraints); 213 /// <summary> 214 /// Deletes the variable with the specified <paramref name="name"/>. 215 /// </summary> 216 /// <param name="name">The name of the variable to delete.</param> 217 void RemoveVariable(string name); 218 /// <summary> 219 /// Deletes the variable with the specified <paramref name="name"/> if all constraints can be 220 /// fulfilled. 221 /// </summary> 222 /// <param name="name">The name of the variable to remove.</param> 223 /// <returns><c>true</c> if the variable could be deleted without violating constraints, 224 /// <c>false</c> otherwise.</returns> 225 bool TryRemoveVariable(string name); 226 /// <summary> 227 /// Deletes the variable with the specified <paramref name="name"/> if all constraints can be 228 /// fulfilled. 229 /// </summary> 230 /// <param name="name">The name of the variable to remove.</param> 231 /// <param name="violatedConstraints">Output parameter; contains all constraints that could 232 /// not be fulfilled.</param> 233 /// <returns><c>true</c> if the variable could be deleted without violating constraints, 234 /// <c>false</c> otherwise.</returns> 235 bool TryRemoveVariable(string name, out ICollection<IConstraint> violatedConstraints); 236 237 /// <inheritdoc cref="GetVariableValue(string, HeuristicLab.Core.IScope, bool)"/> 238 /// <typeparam name="T">The type of the value that is searched.</typeparam> 239 T GetVariableValue<T>(string formalName, IScope scope, bool recursiveLookup) where T : class, IItem; 240 /// <inheritdoc cref="GetVariableValue(string, HeuristicLab.Core.IScope, bool, bool)"/> 241 /// <typeparam name="T">The type of the value that is searched.</typeparam> 242 T GetVariableValue<T>(string formalName, IScope scope, bool recursiveLookup, bool throwOnError) where T : class, IItem; 243 /// <inheritdoc cref="GetVariableValue(System.String, IScope, bool, bool)" 244 /// select="summary"/> 245 /// <param name="formalName">The formal name of the variable info whose variable value is searched.</param> 246 /// <param name="scope">The scope where to look for the variable.</param> 247 /// <param name="recursiveLookup">Boolean value, whether also the parent scopes shall be searched if 248 /// the variable is not found in the specified <paramref name="scope"/>.</param> 249 /// <returns>The value of the searched variable or null if it is not found.</returns> 250 IItem GetVariableValue(string formalName, IScope scope, bool recursiveLookup); 251 /// <summary> 252 /// Gets the value of the variable in the specified <paramref name="scope"/> 253 /// whose variable(parameter) info has the specified <paramref name="formalName"/>. 254 /// </summary> 255 /// <param name="formalName">The formal name of the variable info whose variable value is searched.</param> 256 /// <param name="scope">The scope where to look for the variable.</param> 257 /// <param name="recursiveLookup">Boolean value, whether also the parent scopes shall be searched if 258 /// the variable is not found in the specified <paramref name="scope"/>.</param> 259 /// <param name="throwOnError">Boolean value, whether an exception shall be thrown, if the variable 260 /// cannot be found or just <c>null</c> shall be returned.</param> 261 /// <returns>The value of the searched variable (or null if the variable is not 262 /// found and <paramref name="throwOnError"/> is set to false).</returns> 263 IItem GetVariableValue(string formalName, IScope scope, bool recursiveLookup, bool throwOnError); 70 void RemoveParameter(string name); 264 71 265 72 /// <summary> … … 268 75 /// <param name="scope">The scope where to execute the current instance.</param> 269 76 /// <returns>The next operation.</returns> 270 IOperation Execute(I Scope scope);77 IOperation Execute(IEnvironment environment, IScope scope); 271 78 /// <summary> 272 79 /// Aborts the current operator. … … 283 90 event EventHandler BreakpointChanged; 284 91 /// <summary> 285 /// Occurs when a sub operator has been added.286 /// </summary>287 event EventHandler<OperatorIndexEventArgs> SubOperatorAdded;288 /// <summary>289 /// Occurs when a sub operator has been deleted.290 /// </summary>291 event EventHandler<OperatorIndexEventArgs> SubOperatorRemoved;292 /// <summary>293 92 /// Occurs when a variable info has been added. 294 93 /// </summary> 295 event EventHandler< VariableInfoEventArgs> VariableInfoAdded;94 event EventHandler<ParameterEventArgs> ParameterAdded; 296 95 /// <summary> 297 96 /// Occurs when a variable info has been deleted. 298 97 /// </summary> 299 event EventHandler<VariableInfoEventArgs> VariableInfoRemoved; 300 /// <summary> 301 /// Occurs when a variable has been added. 302 /// </summary> 303 event EventHandler<VariableEventArgs> VariableAdded; 304 /// <summary> 305 /// Occurs when a variable has been deleted. 306 /// </summary> 307 event EventHandler<VariableEventArgs> VariableRemoved; 98 event EventHandler<ParameterEventArgs> ParameterRemoved; 308 99 /// <summary> 309 100 /// Occurs when the current instance is executed. -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/Interfaces/IScope.cs
r801 r1994 39 39 /// </summary> 40 40 ICollection<IVariable> Variables { get; } 41 /// <summary>42 /// Gets all aliases of the current scope.43 /// </summary>44 IEnumerable<KeyValuePair<string, string>> Aliases { get; }45 41 /// <summary> 46 42 /// Gets all subscopes in the current scope. … … 96 92 97 93 /// <summary> 98 /// Gets the actual name of the given alias.99 /// </summary>100 /// <param name="name">The alias whose actual name is searched.</param>101 /// <returns>The actual name.</returns>102 string TranslateName(string name);103 /// <summary>104 /// Adds an alias to the current instance.105 /// </summary>106 /// <param name="alias">The alias to add.</param>107 /// <param name="name">The actual name of the alias.</param>108 void AddAlias(string alias, string name);109 /// <summary>110 /// Deletes the specified <paramref name="alias"/> from the current instance.111 /// </summary>112 /// <param name="alias">The alias to delete.</param>113 void RemoveAlias(string alias);114 115 /// <summary>116 94 /// Adds the specified sub scope to the current instance. 117 95 /// </summary> … … 155 133 event EventHandler<VariableEventArgs> VariableRemoved; 156 134 /// <summary> 157 /// Occurs when an alias has been added to the current instance.158 /// </summary>159 event EventHandler<AliasEventArgs> AliasAdded;160 /// <summary>161 /// Occurs when an alias has been removed from the current instance.162 /// </summary>163 event EventHandler<AliasEventArgs> AliasRemoved;164 /// <summary>165 135 /// Occurs when a sub scope has been added to the current instance. 166 136 /// </summary> -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.2/Interfaces/IViewable.cs
r776 r1994 30 30 public interface IViewable { 31 31 /// <summary> 32 /// Fires a new <c>Changed</c> event. 33 /// </summary> 34 void FireChanged(); 35 /// <summary> 36 /// Occurs when the current instance has changed. 37 /// </summary> 38 event EventHandler Changed; 39 40 /// <summary> 32 41 /// Creates a view to display the current instance. 33 42 /// </summary>
Note: See TracChangeset
for help on using the changeset viewer.