Changeset 2033 for branches/Operator Architecture Refactoring
- Timestamp:
- 06/09/09 00:57:49 (15 years ago)
- Location:
- branches/Operator Architecture Refactoring
- Files:
-
- 10 added
- 7 deleted
- 26 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/Operator Architecture Refactoring/HeuristicLab.AdvancedOptimizationFrontend/3.3/MainForm.cs
r1921 r2033 41 41 private class Task { 42 42 public string filename; 43 public IStorable storable;43 public object instance; 44 44 public IEditor editor; 45 45 46 46 private Task() { } 47 public Task(string filename, IStorable storable, IEditor editor) {47 public Task(string filename, object instance, IEditor editor) { 48 48 this.filename = filename; 49 this. storable = storable;49 this.instance = instance; 50 50 this.editor = editor; 51 51 } … … 154 154 Task task = (Task)state; 155 155 try { 156 task. storable = PersistenceManager.Load(task.filename);156 task.instance = PersistenceManager.Load(task.filename); 157 157 } catch (FileNotFoundException fileNotFoundEx) { 158 158 MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe file or plugin \"" + fileNotFoundEx.FileName + "\" is not available.\nPlease make sure you have all necessary plugins installed.", … … 175 175 else { 176 176 IEditor editor = null; 177 if (task. storable != null) {178 IEditable editable = task. storable as IEditable;177 if (task.instance != null) { 178 IEditable editable = task.instance as IEditable; 179 179 if (editable != null) 180 180 editor = editable.CreateEditor(); -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/AtomicOperation.cs
r1823 r2033 72 72 /// <param name="clonedObjects">All already cloned objects. (Needed to avoid cycles.)</param> 73 73 /// <returns>The cloned object as <see cref="AtomicOperation"/>.</returns> 74 public override object Clone(IDictionary< Guid, object> clonedObjects) {74 public override object Clone(IDictionary<long, object> clonedObjects) { 75 75 AtomicOperation clone = new AtomicOperation(); 76 clonedObjects.Add( Guid, clone);76 clonedObjects.Add(clone.Id, clone); 77 77 clone.myOperator = (IOperator)Auxiliary.Clone(Operator, clonedObjects); 78 78 clone.myScope = (IScope)Auxiliary.Clone(Scope, clonedObjects); -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Auxiliary.cs
r1529 r2033 38 38 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 39 39 /// <returns>The cloned object.</returns> 40 public static object Clone(I Storable obj, IDictionary<Guid, object> clonedObjects) {40 public static object Clone(ICloneable obj, IDictionary<long, object> clonedObjects) { 41 41 object clone; 42 if (clonedObjects.TryGetValue(obj. Guid, out clone))42 if (clonedObjects.TryGetValue(obj.Id, out clone)) 43 43 return clone; 44 44 else … … 84 84 } 85 85 #endregion 86 87 #region Constraint Violation Messages88 /// <summary>89 /// Shows a warning message box with an OK-Button, indicating that the given constraints were violated and so90 /// the operation could not be completed.91 /// </summary>92 /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>93 public static void ShowConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {94 string message = BuildConstraintViolationMessage(violatedConstraints);95 MessageBox.Show("The following constraints are violated. The operation could not be completed.\n\n" + message,96 "Constraint Violation",97 MessageBoxButtons.OK,98 MessageBoxIcon.Warning);99 }100 /// <summary>101 /// Shows a question message box with a yes-no option, where to choose whether to ignore102 /// the given violated constraints and to complete the operation or not.103 /// </summary>104 /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>105 /// <returns>The result of the choice ("Yes" = 6, "No" = 7).</returns>106 public static DialogResult ShowIgnoreConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {107 string message = BuildConstraintViolationMessage(violatedConstraints);108 return MessageBox.Show("The following constraints are violated. Do you want to complete the operation anyhow?\n\n" + message,109 "Constraint Violation",110 MessageBoxButtons.YesNo,111 MessageBoxIcon.Question);112 }113 /// <summary>114 /// Builds a message out of a given collection of violated constraints,115 /// including the constraints type and description.116 /// </summary>117 /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>118 /// <returns>The message to display.</returns>119 private static string BuildConstraintViolationMessage(ICollection<IConstraint> violatedConstraints) {120 StringBuilder sb = new StringBuilder();121 foreach (IConstraint constraint in violatedConstraints) {122 sb.AppendLine(constraint.GetType().Name);123 sb.AppendLine(constraint.Description);124 sb.AppendLine();125 }126 return sb.ToString();127 }128 #endregion129 86 } 130 87 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/CloneableBase.cs
r2032 r2033 23 23 using System.Collections.Generic; 24 24 using System.Text; 25 using System. Xml;25 using System.Runtime.InteropServices; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 27 28 28 namespace HeuristicLab.Core { 29 29 /// <summary> 30 /// The base class for all storable objects.30 /// The base class for all cloneable objects. 31 31 /// </summary> 32 public abstract class StorableBase : IStorable { 33 34 [Storable] 35 private Guid myGuid; 32 public abstract class CloneableBase : ICloneable { 36 33 /// <summary> 37 /// Gets the Guid of the item. 34 /// Gets a unique id (memory address) of the current instance. The id is used to 35 /// detect, if an object has already been cloned or not. 38 36 /// </summary> 39 public Guid Guid { 40 get { return myGuid; } 41 } 42 43 /// <summary> 44 /// Initializes a new instance of the class <see cref="StorableBase"/> with a new <see cref="Guid"/>. 45 /// </summary> 46 protected StorableBase() { 47 myGuid = Guid.NewGuid(); 37 public long Id { 38 get { 39 GCHandle handle = new GCHandle(); 40 handle.Target = this; 41 return GCHandle.ToIntPtr(handle).ToInt64(); 42 } 48 43 } 49 44 … … 54 49 /// <returns>The clone.</returns> 55 50 public object Clone() { 56 return Auxiliary.Clone(this, new Dictionary< Guid, object>());51 return Auxiliary.Clone(this, new Dictionary<long, object>()); 57 52 } 58 53 /// <summary> … … 62 57 /// <param name="clonedObjects">All already cloned objects.</param> 63 58 /// <returns>The clone.</returns> 64 public virtual object Clone(IDictionary< Guid, object> clonedObjects) {65 object clone =Activator.CreateInstance(this.GetType());66 clonedObjects.Add( Guid, clone);59 public virtual object Clone(IDictionary<long, object> clonedObjects) { 60 CloneableBase clone = (CloneableBase)Activator.CreateInstance(this.GetType()); 61 clonedObjects.Add(clone.Id, clone); 67 62 return clone; 68 63 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/CompositeOperation.cs
r1823 r2033 84 84 /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 85 85 /// <returns>The cloned operation as <see cref="CompositeOperation"/>.</returns> 86 public override object Clone(IDictionary< Guid, object> clonedObjects) {86 public override object Clone(IDictionary<long, object> clonedObjects) { 87 87 CompositeOperation clone = new CompositeOperation(); 88 clonedObjects.Add( Guid, clone);88 clonedObjects.Add(clone.Id, clone); 89 89 clone.myExecuteInParallel = ExecuteInParallel; 90 90 for (int i = 0; i < Operations.Count; i++) -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/EngineBase.cs
r1823 r2033 130 130 /// <param name="clonedObjects">Dictionary of all already clone objects. (Needed to avoid cycles.)</param> 131 131 /// <returns>The cloned object as <see cref="EngineBase"/>.</returns> 132 public override object Clone(IDictionary< Guid, object> clonedObjects) {132 public override object Clone(IDictionary<long, object> clonedObjects) { 133 133 EngineBase clone = (EngineBase)base.Clone(clonedObjects); 134 134 clone.myOperatorGraph = (IOperatorGraph)Auxiliary.Clone(OperatorGraph, clonedObjects); -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj
r1667 r2033 113 113 <DependentUpon>ChooseOperatorDialog.cs</DependentUpon> 114 114 </Compile> 115 <Compile Include="ConstrainedItemBase.cs" /> 116 <Compile Include="ConstrainedItemBaseView.cs"> 117 <SubType>UserControl</SubType> 118 </Compile> 119 <Compile Include="ConstrainedItemBaseView.Designer.cs"> 120 <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon> 121 </Compile> 122 <Compile Include="ConstraintEventArgs.cs" /> 115 <Compile Include="CloneableBase.cs" /> 123 116 <Compile Include="AtomicOperation.cs" /> 124 117 <Compile Include="CompositeOperation.cs" /> … … 130 123 </Compile> 131 124 <Compile Include="AliasEventArgs.cs" /> 125 <Compile Include="CallGraph.cs" /> 126 <Compile Include="CallNode.cs" /> 127 <Compile Include="ParameterView.cs"> 128 <SubType>UserControl</SubType> 129 </Compile> 130 <Compile Include="ParameterView.Designer.cs"> 131 <DependentUpon>ParameterView.cs</DependentUpon> 132 </Compile> 133 <Compile Include="Parameter.cs" /> 134 <Compile Include="ParameterType.cs" /> 135 <Compile Include="Interfaces\IParameter.cs" /> 136 <Compile Include="Interfaces\ICallNode.cs" /> 137 <Compile Include="Interfaces\ICallGraph.cs" /> 138 <Compile Include="Interfaces\ICloneable.cs" /> 132 139 <Compile Include="KeyValueEventArgs.cs" /> 133 140 <Compile Include="OperatorBaseDescriptionView.cs"> … … 155 162 </Compile> 156 163 <Compile Include="ExceptionEventArgs.cs" /> 157 <Compile Include="Interfaces\IConstrainedItem.cs" />158 <Compile Include="Interfaces\IConstraint.cs" />159 164 <Compile Include="Interfaces\IItem.cs" /> 160 165 <Compile Include="ItemBase.cs" /> … … 248 253 <Compile Include="Interfaces\IRandom.cs" /> 249 254 <Compile Include="OperatorGraph.cs" /> 250 <Compile Include="StorableBase.cs" />251 255 <Compile Include="Scope.cs" /> 252 256 <Compile Include="EngineBase.cs" /> 253 257 <Compile Include="Interfaces\IEngine.cs" /> 254 258 <Compile Include="Interfaces\IOperator.cs" /> 255 <Compile Include="Interfaces\IStorable.cs" />256 259 <Compile Include="PersistenceManager.cs" /> 257 260 <Compile Include="HeuristicLabCorePlugin.cs" /> … … 290 293 <SubType>Designer</SubType> 291 294 </EmbeddedResource> 292 <EmbeddedResource Include="ConstrainedItemBaseView.resx">293 <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon>294 <SubType>Designer</SubType>295 </EmbeddedResource>296 295 <EmbeddedResource Include="ChooseTypeDialog.resx"> 297 296 <DependentUpon>ChooseTypeDialog.cs</DependentUpon> 297 <SubType>Designer</SubType> 298 </EmbeddedResource> 299 <EmbeddedResource Include="ParameterView.resx"> 300 <DependentUpon>ParameterView.cs</DependentUpon> 298 301 <SubType>Designer</SubType> 299 302 </EmbeddedResource> -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/ICloneable.cs
r2032 r2033 26 26 27 27 namespace HeuristicLab.Core { 28 29 28 /// <summary> 30 /// Interface to represent objects that are de- and serializeable.29 /// Interface to represent objects that are cloneable. 31 30 /// </summary> 32 public interface IStorable { 33 31 public interface ICloneable : System.ICloneable { 34 32 /// <summary> 35 /// Gets the objects unique identifier. 33 /// Gets a unique id representing the current object. This id is used to check, if an object has 34 /// already been cloned (to avoid cycles). 36 35 /// </summary> 37 Guid Guid { get; } 38 39 /// <summary> 40 /// Clones the current instance (deep clone). 41 /// </summary> 42 /// <returns>The cloned object.</returns> 43 object Clone(); 44 36 long Id { get; } 45 37 /// <summary> 46 38 /// Clones the current instance, considering already cloned objects. … … 48 40 /// <param name="clonedObjects">All already cloned objects. (Needed to avoid cycles.)</param> 49 41 /// <returns>The cloned object.</returns> 50 object Clone(IDictionary< Guid, object> clonedObjects);42 object Clone(IDictionary<long, object> clonedObjects); 51 43 } 52 44 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IItem.cs
r776 r2033 28 28 /// Interface to represent (almost) every HeuristicLab object (an object, an operator,...). 29 29 /// </summary> 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; 30 public interface IItem : ICloneable, IViewable { 40 31 } 41 32 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IOperator.cs
r776 r2033 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. … … 67 67 void AddSubOperator(IOperator op); 68 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 be80 /// 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 69 /// Adds the given sub operator at a the specified <paramref name="index"/>. 86 70 /// </summary> … … 89 73 void AddSubOperator(IOperator op, int index); 90 74 /// <summary> 91 /// Adds the given operator at the specified <paramref name="index"/> to the current instance92 /// 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 instance101 /// 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 be106 /// 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 75 /// Removes a sub operator at the specified <paramref name="index"/>. 112 76 /// </summary> 113 77 /// <param name="index">The position where to delete the operator.</param> 114 78 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 be128 /// 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);132 79 133 80 /// <summary> … … 143 90 void AddVariableInfo(IVariableInfo variableInfo); 144 91 /// <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 be156 /// 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);160 /// <summary>161 92 /// Removes the variable info with the given formal name. 162 93 /// </summary> 163 94 /// <param name="formalName">The formal name of the variable info to remove.</param> 164 95 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 be179 /// 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 96 184 97 /// <summary> … … 194 107 void AddVariable(IVariable variable); 195 108 /// <summary> 196 /// Adds the specified <paramref name="variable"/> to the current instance if all constraints can197 /// 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 can205 /// be fulfilled.206 /// </summary>207 /// <param name="variable">The variable to add.</param>208 /// <param name="violatedConstraints">Output parameter; contains all constraints that could209 /// 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 109 /// Deletes the variable with the specified <paramref name="name"/>. 215 110 /// </summary> 216 111 /// <param name="name">The name of the variable to delete.</param> 217 112 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 113 237 114 /// <inheritdoc cref="GetVariableValue(string, HeuristicLab.Core.IScope, bool)"/> 238 115 /// <typeparam name="T">The type of the value that is searched.</typeparam> -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IOperatorGraph.cs
r776 r2033 45 45 void AddOperator(IOperator op); 46 46 /// <summary> 47 /// Removes an operator with the specified <paramref name="guid"/>from the current instance.47 /// Removes an operator from the current instance. 48 48 /// </summary> 49 /// <param name="guid">The unique id of the operator to remove.</param> 50 void RemoveOperator(Guid guid); 51 /// <summary> 52 /// Gets the operator with the specified <paramref name="guid"/>. 53 /// </summary> 54 /// <param name="guid">The unique id of the operator.</param> 55 /// <returns>The searched operator.</returns> 56 IOperator GetOperator(Guid guid); 49 /// <param name="op">The operator that should be removed.</param> 50 void RemoveOperator(IOperator op); 57 51 /// <summary> 58 52 /// Clears the current instance. -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IOperatorGroup.cs
r776 r2033 29 29 /// Interface to represent a group of operators. 30 30 /// </summary> 31 public interface IOperatorGroup : I Storable {31 public interface IOperatorGroup : ICloneable { 32 32 /// <summary> 33 33 /// Gets or sets the name of the current instance. -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IScope.cs
r801 r2033 129 129 void ReorderSubScopes(int[] sequence); 130 130 /// <summary> 131 /// Gets the sub scope with the given <paramref name="guid"/>.132 /// </summary>133 /// <param name="guid">The unique identifier of the sub scope.</param>134 /// <returns>The sub scope with the given <paramref name="guid"/>.</returns>135 IScope GetScope(Guid guid);136 /// <summary>137 131 /// Gets the sub scope with the given <paramref name="name"/>. 138 132 /// </summary> -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Interfaces/IViewable.cs
r776 r2033 34 34 /// <returns>The created view.</returns> 35 35 IView CreateView(); 36 37 /// <summary> 38 /// Fires a new <c>Changed</c> event. 39 /// </summary> 40 void FireChanged(); 41 /// <summary> 42 /// Occurs when the current instance has changed. 43 /// </summary> 44 event EventHandler Changed; 36 45 } 37 46 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/ItemBase.cs
r1853 r2033 31 31 /// </summary> 32 32 [EmptyStorableClass] 33 public abstract class ItemBase : StorableBase, IItem {33 public abstract class ItemBase : CloneableBase, IItem { 34 34 /// <summary> 35 35 /// Creates a new instance of <see cref="ItemBaseView"/> for -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorBase.cs
r1823 r2033 30 30 /// The base class for all operators. 31 31 /// </summary> 32 public abstract class OperatorBase : ConstrainedItemBase, IOperator {32 public abstract class OperatorBase : ItemBase, IOperator { 33 33 34 34 [Storable] … … 130 130 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 131 131 /// <returns>The cloned object as <see cref="OperatorBase"/>.</returns> 132 public override object Clone(IDictionary< Guid, object> clonedObjects) {132 public override object Clone(IDictionary<long, object> clonedObjects) { 133 133 OperatorBase clone = (OperatorBase)base.Clone(clonedObjects); 134 134 clone.myName = Name; … … 162 162 OnSubOperatorAdded(subOperator, mySubOperators.Count - 1); 163 163 } 164 /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator)"/>165 /// <param name="subOperator">The sub operator to add.</param>166 /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>167 public virtual bool TryAddSubOperator(IOperator subOperator) {168 mySubOperators.Add(subOperator);169 if (IsValid()) {170 OnSubOperatorAdded(subOperator, mySubOperators.Count - 1);171 return true;172 } else {173 mySubOperators.RemoveAt(mySubOperators.Count - 1);174 return false;175 }176 }177 /// <inheritdoc cref="HeuristicLab.Core.IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator,178 /// out System.Collections.Generic.ICollection<HeuristicLab.Core.IConstraint>)"/>179 /// <param name="subOperator">The sub operator to add.</param>180 /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>181 public virtual bool TryAddSubOperator(IOperator subOperator, out ICollection<IConstraint> violatedConstraints) {182 mySubOperators.Add(subOperator);183 if (IsValid(out violatedConstraints)) {184 OnSubOperatorAdded(subOperator, mySubOperators.Count - 1);185 return true;186 } else {187 mySubOperators.RemoveAt(mySubOperators.Count - 1);188 return false;189 }190 }191 164 /// <inheritdoc cref="HeuristicLab.Core.IOperator.AddSubOperator(HeuristicLab.Core.IOperator, int)"/> 192 165 /// <param name="subOperator">The sub operator to add.</param> … … 196 169 OnSubOperatorAdded(subOperator, index); 197 170 } 198 /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator, int)"/>199 /// <param name="subOperator">The sub operator to add.</param>200 /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>201 public virtual bool TryAddSubOperator(IOperator subOperator, int index) {202 mySubOperators.Insert(index, subOperator);203 if (IsValid()) {204 OnSubOperatorAdded(subOperator, index);205 return true;206 } else {207 mySubOperators.RemoveAt(index);208 return false;209 }210 }211 /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator, int, out212 /// System.Collections.Generic.ICollection<HeuristicLab.Core.IConstraint>)"/>213 /// <param name="subOperator">The sub operator to add.</param>214 /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>215 public virtual bool TryAddSubOperator(IOperator subOperator, int index, out ICollection<IConstraint> violatedConstraints) {216 mySubOperators.Insert(index, subOperator);217 if (IsValid(out violatedConstraints)) {218 OnSubOperatorAdded(subOperator, index);219 return true;220 } else {221 mySubOperators.RemoveAt(index);222 return false;223 }224 }225 171 /// <inheritdoc/> 226 172 /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks> … … 229 175 mySubOperators.RemoveAt(index); 230 176 OnSubOperatorRemoved(op, index); 231 }232 /// <inheritdoc/>233 /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks>234 public virtual bool TryRemoveSubOperator(int index) {235 IOperator op = mySubOperators[index];236 mySubOperators.RemoveAt(index);237 if (IsValid()) {238 OnSubOperatorRemoved(op, index);239 return true;240 } else {241 mySubOperators.Insert(index, op);242 return false;243 }244 }245 /// <inheritdoc/>246 /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks>247 public virtual bool TryRemoveSubOperator(int index, out ICollection<IConstraint> violatedConstraints) {248 IOperator op = mySubOperators[index];249 mySubOperators.RemoveAt(index);250 if (IsValid(out violatedConstraints)) {251 OnSubOperatorRemoved(op, index);252 return true;253 } else {254 mySubOperators.Insert(index, op);255 return false;256 }257 177 } 258 178 #endregion … … 274 194 } 275 195 /// <inheritdoc/> 276 /// <remarks>Calls <see cref="OnVariableInfoAdded"/>.</remarks>277 public virtual bool TryAddVariableInfo(IVariableInfo variableInfo) {278 myVariableInfos.Add(variableInfo.FormalName, variableInfo);279 if (IsValid()) {280 OnVariableInfoAdded(variableInfo);281 return true;282 } else {283 myVariableInfos.Remove(variableInfo.FormalName);284 return false;285 }286 }287 /// <inheritdoc/>288 /// <remarks>Calls <see cref="OnVariableInfoAdded"/>.</remarks>289 public virtual bool TryAddVariableInfo(IVariableInfo variableInfo, out ICollection<IConstraint> violatedConstraints) {290 myVariableInfos.Add(variableInfo.FormalName, variableInfo);291 if (IsValid(out violatedConstraints)) {292 OnVariableInfoAdded(variableInfo);293 return true;294 } else {295 myVariableInfos.Remove(variableInfo.FormalName);296 return false;297 }298 }299 /// <inheritdoc/>300 196 /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks> 301 197 public virtual void RemoveVariableInfo(string formalName) { … … 305 201 OnVariableInfoRemoved(variableInfo); 306 202 } 307 }308 /// <inheritdoc/>309 /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks>310 public virtual bool TryRemoveVariableInfo(string formalName) {311 IVariableInfo variableInfo;312 if (myVariableInfos.TryGetValue(formalName, out variableInfo)) {313 myVariableInfos.Remove(formalName);314 if (IsValid()) {315 OnVariableInfoRemoved(variableInfo);316 return true;317 } else {318 myVariableInfos.Add(formalName, variableInfo);319 return false;320 }321 }322 return true;323 }324 /// <inheritdoc/>325 /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks>326 public virtual bool TryRemoveVariableInfo(string formalName, out ICollection<IConstraint> violatedConstraints) {327 IVariableInfo variableInfo;328 if (myVariableInfos.TryGetValue(formalName, out variableInfo)) {329 myVariableInfos.Remove(formalName);330 if (IsValid(out violatedConstraints)) {331 OnVariableInfoRemoved(variableInfo);332 return true;333 } else {334 myVariableInfos.Add(formalName, variableInfo);335 return false;336 }337 }338 violatedConstraints = new List<IConstraint>();339 return true;340 203 } 341 204 #endregion … … 358 221 variable.NameChanged += new EventHandler(Variable_NameChanged); 359 222 OnVariableAdded(variable); 360 }361 /// <inheritdoc/>362 /// <remarks>Calls <see cref="OnVariableAdded"/> and adds <c>NameChanging</c> and <c>NameChanged</c>363 /// event handlers.</remarks>364 public virtual bool TryAddVariable(IVariable variable) {365 myVariables.Add(variable.Name, variable);366 if (IsValid()) {367 variable.NameChanging += new EventHandler<NameChangingEventArgs>(Variable_NameChanging);368 variable.NameChanged += new EventHandler(Variable_NameChanged);369 OnVariableAdded(variable);370 return true;371 } else {372 myVariableInfos.Remove(variable.Name);373 return false;374 }375 }376 /// <inheritdoc/>377 /// <remarks>Calls <see cref="OnVariableAdded"/> and adds <c>NameChanging</c> and <c>NameChanged</c>378 /// event handlers.</remarks>379 public virtual bool TryAddVariable(IVariable variable, out ICollection<IConstraint> violatedConstraints) {380 myVariables.Add(variable.Name, variable);381 if (IsValid(out violatedConstraints)) {382 variable.NameChanging += new EventHandler<NameChangingEventArgs>(Variable_NameChanging);383 variable.NameChanged += new EventHandler(Variable_NameChanged);384 OnVariableAdded(variable);385 return true;386 } else {387 myVariableInfos.Remove(variable.Name);388 return false;389 }390 223 } 391 224 /// <inheritdoc/> … … 400 233 OnVariableRemoved(variable); 401 234 } 402 }403 /// <inheritdoc/>404 /// <remarks>Calls <see cref="OnVariableRemoved"/> and removes <c>NameChanging</c> and <c>NameChanged</c>405 /// event handlers.</remarks>406 public virtual bool TryRemoveVariable(string name) {407 IVariable variable;408 if (myVariables.TryGetValue(name, out variable)) {409 myVariables.Remove(name);410 if (IsValid()) {411 variable.NameChanging -= new EventHandler<NameChangingEventArgs>(Variable_NameChanging);412 variable.NameChanged -= new EventHandler(Variable_NameChanged);413 OnVariableRemoved(variable);414 return true;415 } else {416 myVariables.Add(name, variable);417 return false;418 }419 }420 return true;421 }422 /// <inheritdoc/>423 /// <remarks>Calls <see cref="OnVariableRemoved"/> and removes <c>NameChanging</c> and <c>NameChanged</c>424 /// event handlers.</remarks>425 public virtual bool TryRemoveVariable(string name, out ICollection<IConstraint> violatedConstraints) {426 IVariable variable;427 if (myVariables.TryGetValue(name, out variable)) {428 myVariables.Remove(name);429 if (IsValid(out violatedConstraints)) {430 variable.NameChanging -= new EventHandler<NameChangingEventArgs>(Variable_NameChanging);431 variable.NameChanged -= new EventHandler(Variable_NameChanged);432 OnVariableRemoved(variable);433 return true;434 } else {435 myVariables.Add(name, variable);436 return false;437 }438 }439 violatedConstraints = new List<IConstraint>();440 return true;441 235 } 442 236 private void Variable_NameChanging(object sender, NameChangingEventArgs e) { … … 489 283 } 490 284 #endregion 285 491 286 /// <inheritdoc/> 492 287 public virtual IOperation Execute(IScope scope) { -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorBaseView.Designer.cs
r1529 r2033 54 54 this.operatorBaseVariablesView = new HeuristicLab.Core.OperatorBaseVariablesView(); 55 55 this.constraintsTabPage = new System.Windows.Forms.TabPage(); 56 this.constrainedItemBaseView = new HeuristicLab.Core.ConstrainedItemBaseView();57 56 this.descriptionTabPage = new System.Windows.Forms.TabPage(); 58 57 this.operatorBaseDescriptionView = new HeuristicLab.Core.OperatorBaseDescriptionView(); … … 121 120 // constraintsTabPage 122 121 // 123 this.constraintsTabPage.Controls.Add(this.constrainedItemBaseView);124 122 this.constraintsTabPage.Location = new System.Drawing.Point(4, 22); 125 123 this.constraintsTabPage.Name = "constraintsTabPage"; … … 129 127 this.constraintsTabPage.Text = "Constraints"; 130 128 this.constraintsTabPage.UseVisualStyleBackColor = true; 131 //132 // constrainedItemBaseView133 //134 this.constrainedItemBaseView.Caption = "Constrained Data";135 this.constrainedItemBaseView.ConstrainedItem = null;136 this.constrainedItemBaseView.Dock = System.Windows.Forms.DockStyle.Fill;137 this.constrainedItemBaseView.Location = new System.Drawing.Point(3, 3);138 this.constrainedItemBaseView.Name = "constrainedItemBaseView";139 this.constrainedItemBaseView.Size = new System.Drawing.Size(409, 301);140 this.constrainedItemBaseView.TabIndex = 0;141 129 // 142 130 // descriptionTabPage … … 184 172 protected TabPage variablesTabPage; 185 173 private TabPage constraintsTabPage; 186 protected ConstrainedItemBaseView constrainedItemBaseView;187 174 protected OperatorBaseVariableInfosView operatorBaseVariableInfosView; 188 175 protected OperatorBaseVariablesView operatorBaseVariablesView; -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorBaseView.cs
r1529 r2033 68 68 operatorBaseVariableInfosView.Operator = null; 69 69 operatorBaseVariablesView.Operator = null; 70 constrainedItemBaseView.ConstrainedItem = null;71 70 operatorBaseDescriptionView.Operator = null; 72 71 base.RemoveItemEvents(); … … 79 78 operatorBaseVariableInfosView.Operator = Operator; 80 79 operatorBaseVariablesView.Operator = Operator; 81 constrainedItemBaseView.ConstrainedItem = Operator;82 80 operatorBaseDescriptionView.Operator = Operator; 83 81 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorGraph.cs
r1823 r2033 33 33 34 34 [Storable] 35 private I Dictionary<Guid,IOperator> myOperators;35 private IList<IOperator> myOperators; 36 36 /// <summary> 37 37 /// Gets all operators of the current instance. 38 38 /// </summary> 39 39 public ICollection<IOperator> Operators { 40 get { return myOperators .Values; }40 get { return myOperators; } 41 41 } 42 42 … … 61 61 /// </summary> 62 62 public OperatorGraph() { 63 myOperators = new Dictionary<Guid,IOperator>();63 myOperators = new List<IOperator>(); 64 64 } 65 65 … … 80 80 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 81 81 /// <returns>The cloned object as <see cref="OperatorGraph"/>.</returns> 82 public override object Clone(IDictionary< Guid, object> clonedObjects) {82 public override object Clone(IDictionary<long, object> clonedObjects) { 83 83 OperatorGraph clone = new OperatorGraph(); 84 clonedObjects.Add( Guid, clone);84 clonedObjects.Add(clone.Id, clone); 85 85 foreach (IOperator op in Operators) 86 86 clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects)); … … 93 93 /// <remarks>Calls <see cref="OnOperatorAdded"/>.</remarks> 94 94 public void AddOperator(IOperator op) { 95 if (!myOperators.Contains Key(op.Guid)) {96 myOperators.Add(op .Guid, op);95 if (!myOperators.Contains(op)) { 96 myOperators.Add(op); 97 97 OnOperatorAdded(op); 98 98 … … 103 103 /// <inheritdoc/> 104 104 /// <remarks>Calls <see cref="OnOperatorRemoved"/>.</remarks> 105 public void RemoveOperator(Guid guid) { 106 IOperator op = GetOperator(guid); 107 if (op != null) { 105 public void RemoveOperator(IOperator op) { 106 if (Operators.Contains(op)) { 108 107 foreach (IOperator o in Operators) { 109 108 int i = 0; … … 117 116 if (InitialOperator == op) 118 117 InitialOperator = null; 119 myOperators.Remove(op .Guid);118 myOperators.Remove(op); 120 119 OnOperatorRemoved(op); 121 120 } 122 121 } 123 122 /// <inheritdoc/> 124 public IOperator GetOperator(Guid guid) {125 IOperator op;126 if (myOperators.TryGetValue(guid, out op))127 return op;128 else129 return null;130 }131 /// <inheritdoc/>132 123 public void Clear() { 133 Guid[] guids = new Guid[Operators.Count]; 134 int i = 0; 135 foreach (IOperator op in Operators) { 136 guids[i] = op.Guid; 137 i++; 138 } 139 for (int j = 0; j < guids.Length; j++) 140 RemoveOperator(guids[j]); 124 while (myOperators.Count > 0) 125 RemoveOperator(myOperators[0]); 141 126 } 142 127 -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorGraphView.cs
r1529 r2033 218 218 if (operatorsListView.SelectedItems.Count > 0) { 219 219 foreach (ListViewItem item in operatorsListView.SelectedItems) 220 OperatorGraph.RemoveOperator(( (IOperator)item.Tag).Guid);220 OperatorGraph.RemoveOperator((IOperator)item.Tag); 221 221 } 222 222 } … … 258 258 if (operatorsListView.SelectedItems.Count > 0) { 259 259 foreach (ListViewItem item in operatorsListView.SelectedItems) 260 OperatorGraph.RemoveOperator(( (IOperator)item.Tag).Guid);260 OperatorGraph.RemoveOperator((IOperator)item.Tag); 261 261 } 262 262 } … … 350 350 IOperator newParent = (IOperator)node.Parent.Tag; 351 351 int newIndex = node.Index; 352 ICollection<IConstraint> violatedConstraints; 353 ICollection<IConstraint> violatedConstraints2; 354 oldParent.TryRemoveSubOperator(oldIndex, out violatedConstraints); 355 newParent.TryAddSubOperator(op, newIndex, out violatedConstraints2); 356 if ((violatedConstraints.Count == 0) && (violatedConstraints2.Count == 0)) { 357 graphTreeView.SelectedNode = parentNode.Nodes[newIndex]; 358 } else { 359 List<IConstraint> allViolatedConstraints = new List<IConstraint>(violatedConstraints); 360 allViolatedConstraints.AddRange(violatedConstraints2); 361 if (Auxiliary.ShowIgnoreConstraintViolationMessageBox(allViolatedConstraints) == DialogResult.Yes) { 362 if (violatedConstraints.Count > 0) 363 oldParent.RemoveSubOperator(oldIndex); 364 if (violatedConstraints2.Count > 0) 365 newParent.AddSubOperator(op, newIndex); 366 graphTreeView.SelectedNode = parentNode.Nodes[newIndex]; 367 } else { 368 if (violatedConstraints.Count == 0) 369 oldParent.AddSubOperator(op, oldIndex); 370 if (violatedConstraints2.Count == 0) 371 newParent.RemoveSubOperator(newIndex); 372 } 373 } 352 oldParent.RemoveSubOperator(oldIndex); 353 newParent.AddSubOperator(op, newIndex); 354 graphTreeView.SelectedNode = parentNode.Nodes[newIndex]; 374 355 } 375 356 } else { 376 357 if (node != null) { 377 358 IOperator parent = (IOperator)node.Tag; 378 ICollection<IConstraint> violatedConstraints; 379 if (parent.TryAddSubOperator(op, out violatedConstraints)) { 380 graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1]; 381 } else if (Auxiliary.ShowIgnoreConstraintViolationMessageBox(violatedConstraints) == DialogResult.Yes) { 382 parent.AddSubOperator(op); 383 graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1]; 384 } 359 parent.AddSubOperator(op); 360 graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1]; 385 361 } 386 362 } -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorGroup.cs
r1823 r2033 30 30 /// Representation of a group of operators (can also include subgroups). 31 31 /// </summary> 32 public class OperatorGroup : StorableBase, IOperatorGroup {32 public class OperatorGroup : CloneableBase, IOperatorGroup { 33 33 34 34 [Storable] … … 84 84 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 85 85 /// <returns>The cloned object as <see cref="OperatorGroup"/>.</returns> 86 public override object Clone(IDictionary< Guid, object> clonedObjects) {86 public override object Clone(IDictionary<long, object> clonedObjects) { 87 87 OperatorGroup clone = (OperatorGroup)base.Clone(clonedObjects); 88 88 clone.myName = Name; -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/OperatorLibrary.cs
r1823 r2033 70 70 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 71 71 /// <returns>The cloned object as <see cref="OperatorLibrary"/>.</returns> 72 public override object Clone(IDictionary< Guid, object> clonedObjects) {72 public override object Clone(IDictionary<long, object> clonedObjects) { 73 73 OperatorLibrary clone = new OperatorLibrary(); 74 clonedObjects.Add( Guid, clone);74 clonedObjects.Add(clone.Id, clone); 75 75 clone.myGroup = (IOperatorGroup)Auxiliary.Clone(Group, clonedObjects); 76 76 return clone; -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/PersistenceManager.cs
r1895 r2033 41 41 /// <param name="instance">The object that should be saved.</param> 42 42 /// <param name="filename">The name of the file where the <paramref name="object"/> should be saved.</param> 43 public static void Save( IStorableinstance, string filename) {43 public static void Save(object instance, string filename) { 44 44 XmlGenerator.Serialize(instance, filename, 0); 45 45 } 46 46 47 public static void SaveCompressed( IStorableinstance, string filename) {47 public static void SaveCompressed(object instance, string filename) { 48 48 XmlGenerator.Serialize(instance, filename, 9); 49 49 } … … 55 55 /// <param name="instance">The object that should be saved.</param> 56 56 /// <param name="stream">The (file) stream where the object should be saved.</param> 57 public static void Save( IStorableinstance, Stream stream) {57 public static void Save(object instance, Stream stream) { 58 58 XmlGenerator.Serialize(instance, stream, ConfigurationService.Instance.GetConfiguration(new XmlFormat())); 59 59 } … … 65 65 /// <param name="filename">The filename of the file where the data is saved.</param> 66 66 /// <returns>The loaded object.</returns> 67 public static IStorableLoad(string filename) {68 return (IStorable)XmlParser.Deserialize(filename);67 public static object Load(string filename) { 68 return XmlParser.Deserialize(filename); 69 69 } 70 70 /// <summary> … … 75 75 /// <param name="stream">The stream from where to load the data.</param> 76 76 /// <returns>The loaded object.</returns> 77 public static IStorableLoad(Stream stream) {78 return (IStorable)XmlParser.Deserialize(stream);77 public static object Load(Stream stream) { 78 return XmlParser.Deserialize(stream); 79 79 } 80 80 -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Scope.cs
r1823 r2033 45 45 46 46 private IDictionary<string, IVariable> myVariables; 47 /// <inheritdoc/> 47 /// <inheritdoc/> 48 48 public ICollection<IVariable> Variables { 49 49 get { return myVariables.Values; } … … 224 224 } 225 225 /// <inheritdoc/> 226 public IScope GetScope(Guid guid) {227 if (Guid == guid) return this;228 else {229 for (int i = 0; i < mySubScopes.Count; i++) {230 IScope s = mySubScopes[i].GetScope(guid);231 if (s != null) return s;232 }233 }234 return null;235 }236 /// <inheritdoc/>237 226 public IScope GetScope(string name) { 238 227 if (Name == name) return this; … … 267 256 268 257 /// <inheritdoc/> 269 public override object Clone(IDictionary< Guid, object> clonedObjects) {258 public override object Clone(IDictionary<long, object> clonedObjects) { 270 259 Scope clone = (Scope)base.Clone(clonedObjects); 271 260 clone.myName = Name; -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/Variable.cs
r1823 r2033 102 102 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 103 103 /// <returns>The cloned object as <see cref="Variable"/>.</returns> 104 public override object Clone(IDictionary< Guid, object> clonedObjects) {104 public override object Clone(IDictionary<long, object> clonedObjects) { 105 105 Variable clone = new Variable(); 106 clonedObjects.Add( Guid, clone);106 clonedObjects.Add(clone.Id, clone); 107 107 clone.myName = Name; 108 108 if (Value != null) -
branches/Operator Architecture Refactoring/HeuristicLab.Core/3.3/VariableInfo.cs
r1823 r2033 145 145 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 146 146 /// <returns>The cloned object as <see cref="VariableInfo"/>.</returns> 147 public override object Clone(IDictionary< Guid, object> clonedObjects) {147 public override object Clone(IDictionary<long, object> clonedObjects) { 148 148 VariableInfo clone = new VariableInfo(); 149 clonedObjects.Add( Guid, clone);149 clonedObjects.Add(clone.Id, clone); 150 150 clone.myActualName = ActualName; 151 151 clone.myFormalName = FormalName; -
branches/Operator Architecture Refactoring/HeuristicLab.OptimizationFrontend/3.3/MainForm.cs
r1530 r2033 37 37 private class Task { 38 38 public string filename; 39 public IStorable storable;39 public object instance; 40 40 public IEditor editor; 41 41 42 42 private Task() { } 43 public Task(string filename, IStorable storable, IEditor editor) {43 public Task(string filename, object instance, IEditor editor) { 44 44 this.filename = filename; 45 this. storable = storable;45 this.instance = instance; 46 46 this.editor = editor; 47 47 } … … 145 145 Task task = (Task)state; 146 146 try { 147 task. storable = PersistenceManager.Load(task.filename);147 task.instance = PersistenceManager.Load(task.filename); 148 148 } catch(FileNotFoundException ex) { 149 149 MessageBox.Show("Sorry couldn't open file \"" + task.filename + "\".\nThe file or plugin \"" + ex.FileName + "\" is not available.\nPlease make sure you have all necessary plugins installed.", … … 162 162 else { 163 163 IEditor editor = null; 164 if(task. storable != null) {165 IEditable editable = task. storable as IEditable;164 if(task.instance != null) { 165 IEditable editable = task.instance as IEditable; 166 166 if(editable != null) 167 167 editor = editable.CreateEditor(); … … 200 200 private void AsynchronousSave(object state) { 201 201 Task task = (Task)state; 202 PersistenceManager.Save(task. storable, task.filename);202 PersistenceManager.Save(task.instance, task.filename); 203 203 SaveFinished(task); 204 204 } -
branches/Operator Architecture Refactoring/HeuristicLab.ThreadParallelEngine/3.3/ThreadParallelEngine.cs
r1872 r2033 73 73 /// <inheritdoc/> 74 74 /// <returns>The cloned object as <see cref="ThreadParallelEngine"/>.</returns> 75 public override object Clone(IDictionary< Guid, object> clonedObjects) {75 public override object Clone(IDictionary<long, object> clonedObjects) { 76 76 ThreadParallelEngine clone = (ThreadParallelEngine)base.Clone(clonedObjects); 77 77 clone.myWorkers = Workers;
Note: See TracChangeset
for help on using the changeset viewer.