Changeset 3280 for trunk/sources/HeuristicLab.Core
- Timestamp:
- 04/07/10 05:22:33 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Core/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/DeepCloneable.cs
r3017 r3280 29 29 [StorableClass] 30 30 public abstract class DeepCloneable : IDeepCloneable { 31 protected DeepCloneable() { } 32 [StorableConstructor] 33 protected DeepCloneable(bool deserializing) { } 34 31 35 /// <summary> 32 36 /// Creates a deep clone of this instance. -
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r3265 r3280 49 49 50 50 public override IDeepCloneable Clone(Cloner cloner) { 51 if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState)); 51 52 Engine clone = (Engine)base.Clone(cloner); 52 53 IOperation[] contexts = executionStack.ToArray(); -
trunk/sources/HeuristicLab.Core/3.3/Item.cs
r3017 r3280 42 42 } 43 43 44 protected Item() : base() { } 45 [StorableConstructor] 46 protected Item(bool deserializing) : base(deserializing) { } 47 48 44 49 /// <summary> 45 50 /// Gets the string representation of the current instance. -
trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs
r3017 r3280 91 91 else this.description = description; 92 92 } 93 [StorableConstructor] 94 protected NamedItem(bool deserializing) : base(deserializing) { } 93 95 94 96 /// <summary> -
trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs
r3260 r3280 32 32 [StorableClass] 33 33 public abstract class ParameterizedNamedItem : NamedItem, IParameterizedNamedItem { 34 [Storable] 34 35 private ParameterCollection parameters; 35 [Storable]36 36 protected ParameterCollection Parameters { 37 37 get { return parameters; } 38 private set {39 parameters = value;40 readOnlyParameters = null;41 }42 38 } 43 39 private ReadOnlyObservableKeyedCollection<string, IParameter> readOnlyParameters; … … 53 49 name = ItemName; 54 50 description = ItemDescription; 55 Parameters = new ParameterCollection();51 parameters = new ParameterCollection(); 56 52 readOnlyParameters = null; 57 53 } … … 59 55 : base(name) { 60 56 description = ItemDescription; 61 Parameters = new ParameterCollection();57 parameters = new ParameterCollection(); 62 58 readOnlyParameters = null; 63 59 } … … 65 61 : base(name) { 66 62 description = ItemDescription; 67 Parameters = parameters;63 this.parameters = parameters; 68 64 readOnlyParameters = null; 69 65 } 70 66 protected ParameterizedNamedItem(string name, string description) 71 67 : base(name, description) { 72 Parameters = new ParameterCollection();68 parameters = new ParameterCollection(); 73 69 readOnlyParameters = null; 74 70 } 75 71 protected ParameterizedNamedItem(string name, string description, ParameterCollection parameters) 76 72 : base(name, description) { 77 Parameters = parameters;73 this.parameters = parameters; 78 74 readOnlyParameters = null; 79 75 } 76 [StorableConstructor] 77 protected ParameterizedNamedItem(bool deserializing) : base(deserializing) { } 80 78 81 79 public override IDeepCloneable Clone(Cloner cloner) { 82 80 ParameterizedNamedItem clone = (ParameterizedNamedItem)base.Clone(cloner); 83 clone.Parameters = (ParameterCollection)cloner.Clone(parameters); 81 clone.parameters = (ParameterCollection)cloner.Clone(parameters); 82 clone.readOnlyParameters = null; 84 83 return clone; 85 84 } … … 87 86 public virtual void CollectParameterValues(IDictionary<string, IItem> values) { 88 87 foreach (IValueParameter param in parameters.OfType<IValueParameter>()) { 89 values.Add(param.Name, param.Value != null ? (IItem)param.Value.Clone() : null);88 values.Add(param.Name, param.Value); 90 89 if (param.Value is IParameterizedItem) { 91 90 Dictionary<string, IItem> children = new Dictionary<string, IItem>(); -
trunk/sources/HeuristicLab.Core/3.3/Scope.cs
r3160 r3280 35 35 get { return parent; } 36 36 set { 37 if (parent != null) parent.SubScopes.Remove(this); 38 parent = value; 39 if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this); 37 if (parent != value) { 38 IScope oldParent = parent; 39 parent = null; 40 if (oldParent != null) oldParent.SubScopes.Remove(this); 41 parent = value; 42 if ((parent != null) && !parent.SubScopes.Contains(this)) parent.SubScopes.Add(this); 43 } 40 44 } 41 45 } … … 97 101 clone.Description = Description; 98 102 if (variables.Count > 0) clone.variables = (VariableCollection)cloner.Clone(variables); 99 if (subScopes.Count > 0) clone.SubScopes = (ScopeList)cloner.Clone(subScopes); 103 if (subScopes.Count > 0) { 104 clone.SubScopes = (ScopeList)cloner.Clone(subScopes); 105 foreach (IScope child in clone.SubScopes) 106 child.Parent = clone; 107 } 100 108 return clone; 101 109 }
Note: See TracChangeset
for help on using the changeset viewer.