Changeset 4671
- Timestamp:
- 10/29/10 18:28:32 (14 years ago)
- Location:
- branches/CloningRefactoring
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs
r4668 r4671 53 53 protected CheckedItemCollection(CheckedItemCollection<T> original, Cloner cloner) 54 54 : base(original, cloner) { 55 list = new List<T>(original.Select(x => cloner.Clone <T>(x)));55 list = new List<T>(original.Select(x => cloner.Clone(x))); 56 56 checkedState = new Dictionary<T, bool>(); 57 57 foreach (var pair in original.checkedState) 58 checkedState.Add(cloner.Clone <T>(pair.Key), pair.Value);58 checkedState.Add(cloner.Clone(pair.Key), pair.Value); 59 59 } 60 60 /// <summary> -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/CheckedItemList.cs
r4668 r4671 60 60 checkedState = new Dictionary<T, bool>(); 61 61 foreach (var pair in original.checkedState) 62 checkedState.Add(cloner.Clone <T>(pair.Key), pair.Value);62 checkedState.Add(cloner.Clone(pair.Key), pair.Value); 63 63 } 64 64 /// <summary> -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemArray.cs
r4668 r4671 50 50 protected ItemArray(ItemArray<T> original, Cloner cloner) { 51 51 cloner.RegisterClonedObject(original, this); 52 array = original.Select(x => cloner.Clone <T>(x)).ToArray();52 array = original.Select(x => cloner.Clone(x)).ToArray(); 53 53 } 54 54 public ItemArray() : base() { } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemCollection.cs
r4668 r4671 50 50 protected ItemCollection(ItemCollection<T> original, Cloner cloner) { 51 51 cloner.RegisterClonedObject(original, this); 52 list = new List<T>(original.Select(x => cloner.Clone <T>(x)));52 list = new List<T>(original.Select(x => cloner.Clone(x))); 53 53 } 54 54 public ItemCollection() : base() { } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs
r4668 r4671 53 53 cloner.RegisterClonedObject(original, this); 54 54 foreach (TKey key in dict.Keys) 55 dict.Add(cloner.Clone <TKey>(key), cloner.Clone<TValue>(dict[key]));55 dict.Add(cloner.Clone(key), cloner.Clone(dict[key])); 56 56 } 57 57 public ItemDictionary() : base() { } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemList.cs
r4668 r4671 50 50 protected ItemList(ItemList<T> original, Cloner cloner) { 51 51 cloner.RegisterClonedObject(original, this); 52 list = new List<T>(original.Select(x => cloner.Clone <T>(x)));52 list = new List<T>(original.Select(x => cloner.Clone(x))); 53 53 } 54 54 public ItemList() : base() { } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ItemSet.cs
r4668 r4671 50 50 protected ItemSet(ItemSet<T> original, Cloner cloner) { 51 51 cloner.RegisterClonedObject(original, this); 52 set = new HashSet<T>(original.Select(x => cloner.Clone <T>(x)));52 set = new HashSet<T>(original.Select(x => cloner.Clone(x))); 53 53 } 54 54 public ItemSet() : base() { } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs
r4668 r4671 49 49 cloner.RegisterClonedObject(original, this); 50 50 foreach (TItem item in original.dict.Values) { 51 TItem clonedItem = cloner.Clone <TItem>(item);51 TItem clonedItem = cloner.Clone(item); 52 52 dict.Add(GetKeyForItem(clonedItem), clonedItem); 53 53 } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/OperationCollection.cs
r4668 r4671 42 42 private OperationCollection(OperationCollection original, Cloner cloner) 43 43 : base(original, cloner) { 44 operations = new List<IOperation>(original.Select(x => cloner.Clone <IOperation>(x)));44 operations = new List<IOperation>(original.Select(x => cloner.Clone(x))); 45 45 parallel = original.parallel; 46 46 } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs
r4668 r4671 48 48 protected ReadOnlyItemArray(ReadOnlyItemArray<T> original, Cloner cloner) { 49 49 cloner.RegisterClonedObject(original, this); 50 array = cloner.Clone <IItemArray<T>>((IItemArray<T>)original.array);50 array = cloner.Clone((IItemArray<T>)original.array); 51 51 RegisterEvents(); 52 52 } -
branches/CloningRefactoring/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs
r4668 r4671 48 48 protected ReadOnlyItemCollection(ReadOnlyItemCollection<T> original, Cloner cloner) { 49 49 cloner.RegisterClonedObject(original, this); 50 collection = cloner.Clone <IItemCollection<T>>((IItemCollection<T>)original.collection);50 collection = cloner.Clone((IItemCollection<T>)original.collection); 51 51 RegisterEvents(); 52 52 } -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs
r4332 r4671 23 23 using System.Linq; 24 24 using HeuristicLab.Collections; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 41 42 } 42 43 44 [StorableConstructor] 45 protected ConstrainedValueParameter(bool deserializing) : base(deserializing) { } 46 protected ConstrainedValueParameter(ConstrainedValueParameter<T> original, Cloner cloner) : base(original, cloner) { } 43 47 public ConstrainedValueParameter() : base() { } 44 48 public ConstrainedValueParameter(string name) : base(name) { } … … 54 58 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { } 55 59 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { } 56 [StorableConstructor] 57 protected ConstrainedValueParameter(bool deserializing) : base(deserializing) { } 60 61 public override IDeepCloneable Clone(Cloner cloner) { 62 return new ConstrainedValueParameter<T>(this, cloner); 63 } 58 64 59 65 protected override void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) { -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/LookupParameter.cs
r4332 r4671 62 62 } 63 63 64 [StorableConstructor] 65 protected LookupParameter(bool deserializing) : base(deserializing) { } 66 protected LookupParameter(LookupParameter<T> original, Cloner cloner) 67 : base(original, cloner) { 68 actualName = original.actualName; 69 } 64 70 public LookupParameter() 65 71 : base("Anonymous", typeof(T)) { … … 78 84 this.actualName = actualName == null ? string.Empty : actualName; 79 85 } 80 [StorableConstructor]81 protected LookupParameter(bool deserializing) : base(deserializing) { }82 86 83 87 public override IDeepCloneable Clone(Cloner cloner) { 84 LookupParameter<T> clone = (LookupParameter<T>)base.Clone(cloner); 85 clone.actualName = actualName; 86 return clone; 88 return new LookupParameter<T>(this, cloner); 87 89 } 88 90 -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/OperatorParameter.cs
r4477 r4671 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 30 31 [StorableClass] 31 32 public class OperatorParameter : OptionalValueParameter<IOperator> { 33 [StorableConstructor] 34 protected OperatorParameter(bool deserializing) : base(deserializing) { } 35 protected OperatorParameter(OperatorParameter original, Cloner cloner) : base(original, cloner) { } 32 36 public OperatorParameter() : base("Anonymous") { } 33 37 public OperatorParameter(string name) : base(name) { } … … 39 43 public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { } 40 44 public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { } 41 [StorableConstructor] 42 protected OperatorParameter(bool deserializing) : base(deserializing) { } 45 46 public override IDeepCloneable Clone(Cloner cloner) { 47 return new OperatorParameter(this, cloner); 48 } 43 49 } 44 50 } -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r4332 r4671 87 87 88 88 #region Constructors 89 [StorableConstructor] 90 protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { } 91 protected OptionalConstrainedValueParameter(OptionalConstrainedValueParameter<T> original, Cloner cloner) 92 : base(original, cloner) { 93 validValues = cloner.Clone(original.validValues); 94 value = cloner.Clone(original.value); 95 getsCollected = original.getsCollected; 96 Initialize(); 97 } 89 98 public OptionalConstrainedValueParameter() 90 99 : base("Anonymous", typeof(T)) { … … 169 178 Initialize(); 170 179 } 171 [StorableConstructor]172 protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { }173 180 #endregion 174 181 175 182 [StorableHook(HookType.AfterDeserialization)] 183 private void AfterDeserialization() { 184 Initialize(); 185 } 186 176 187 private void Initialize() { 177 188 RegisterValidValuesEvents(); … … 180 191 181 192 public override IDeepCloneable Clone(Cloner cloner) { 182 OptionalConstrainedValueParameter<T> clone = (OptionalConstrainedValueParameter<T>)base.Clone(cloner); 183 clone.validValues = (ItemSet<T>)cloner.Clone(validValues); 184 clone.value = (T)cloner.Clone(value); 185 clone.getsCollected = getsCollected; 186 clone.Initialize(); 187 return clone; 193 return new OptionalConstrainedValueParameter<T>(this, cloner); 188 194 } 189 195 -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs
r4332 r4671 79 79 80 80 #region Constructors 81 [StorableConstructor] 82 protected OptionalValueParameter(bool deserializing) : base(deserializing) { } 83 protected OptionalValueParameter(OptionalValueParameter<T> original, Cloner cloner) 84 : base(original, cloner) { 85 value = cloner.Clone(original.value); 86 getsCollected = original.getsCollected; 87 RegisterValueEvents(); 88 } 81 89 public OptionalValueParameter() 82 90 : base("Anonymous", typeof(T)) { … … 95 103 this.value = value; 96 104 this.getsCollected = true; 97 Initialize();105 RegisterValueEvents(); 98 106 } 99 107 public OptionalValueParameter(string name, T value, bool getsCollected) … … 101 109 this.value = value; 102 110 this.getsCollected = getsCollected; 103 Initialize();111 RegisterValueEvents(); 104 112 } 105 113 public OptionalValueParameter(string name, string description) … … 115 123 this.value = value; 116 124 this.getsCollected = true; 117 Initialize();125 RegisterValueEvents(); 118 126 } 119 127 public OptionalValueParameter(string name, string description, T value, bool getsCollected) … … 121 129 this.value = value; 122 130 this.getsCollected = getsCollected; 123 Initialize();131 RegisterValueEvents(); 124 132 } 125 [StorableConstructor]126 protected OptionalValueParameter(bool deserializing) : base(deserializing) { }127 133 #endregion 128 134 129 135 [StorableHook(HookType.AfterDeserialization)] 130 private void Initialize() {136 private void AfterDeserialization() { 131 137 RegisterValueEvents(); 132 138 } 133 139 134 140 public override IDeepCloneable Clone(Cloner cloner) { 135 OptionalValueParameter<T> clone = (OptionalValueParameter<T>)base.Clone(cloner); 136 clone.value = (T)cloner.Clone(value); 137 clone.getsCollected = getsCollected; 138 clone.Initialize(); 139 return clone; 141 return new OptionalValueParameter<T>(this, cloner); 140 142 } 141 143 -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/Parameter.cs
r4477 r4671 77 77 } 78 78 79 [StorableConstructor] 80 protected Parameter(bool deserializing) : base(deserializing) { } 81 protected Parameter(Parameter original, Cloner cloner) 82 : base(original, cloner) { 83 dataType = original.dataType; 84 executionContext = cloner.Clone(original.executionContext); 85 } 79 86 protected Parameter() 80 87 : base("Anonymous") { … … 91 98 this.dataType = dataType; 92 99 } 93 [StorableConstructor]94 protected Parameter(bool deserializing) : base(deserializing) { }95 96 public override IDeepCloneable Clone(Cloner cloner) {97 Parameter clone = (Parameter)base.Clone(cloner);98 clone.dataType = dataType;99 clone.executionContext = (IExecutionContext)cloner.Clone(executionContext);100 return clone;101 }102 100 103 101 public override string ToString() { -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/ScopeParameter.cs
r4332 r4671 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 35 36 } 36 37 38 [StorableConstructor] 39 protected ScopeParameter(bool deserializing) : base(deserializing) { } 40 protected ScopeParameter(ScopeParameter original, Cloner cloner) : base(original, cloner) { } 37 41 public ScopeParameter() 38 42 : base("Anonymous", typeof(IScope)) { … … 44 48 : base(name, description, typeof(IScope)) { 45 49 } 46 [StorableConstructor] 47 protected ScopeParameter(bool deserializing) : base(deserializing) { } 50 51 public override IDeepCloneable Clone(Cloner cloner) { 52 return new ScopeParameter(this, cloner); 53 } 48 54 49 55 public override string ToString() { -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/ScopeTreeLookupParameter.cs
r3822 r4671 47 47 } 48 48 49 [StorableConstructor] 50 protected ScopeTreeLookupParameter(bool deserializing) : base(deserializing) { } 51 protected ScopeTreeLookupParameter(ScopeTreeLookupParameter<T> original, Cloner cloner) 52 : base(original, cloner) { 53 depth = original.depth; 54 } 49 55 public ScopeTreeLookupParameter() 50 56 : base() { … … 75 81 this.depth = depth; 76 82 } 77 [StorableConstructor]78 protected ScopeTreeLookupParameter(bool deserializing) : base(deserializing) { }79 83 80 84 public override IDeepCloneable Clone(Cloner cloner) { 81 ScopeTreeLookupParameter<T> clone = (ScopeTreeLookupParameter<T>)base.Clone(cloner); 82 clone.depth = depth; 83 return clone; 85 return new ScopeTreeLookupParameter<T>(this, cloner); 84 86 } 85 87 -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r4477 r4671 79 79 80 80 #region Constructors 81 [StorableConstructor] 82 protected ValueLookupParameter(bool deserializing) : base(deserializing) { } 83 protected ValueLookupParameter(ValueLookupParameter<T> original, Cloner cloner) 84 : base(original, cloner) { 85 value = cloner.Clone(original.value); 86 getsCollected = original.getsCollected; 87 RegisterValueEvents(); 88 } 81 89 public ValueLookupParameter() 82 90 : base() { … … 95 103 this.value = value; 96 104 this.getsCollected = true; 97 Initialize();105 RegisterValueEvents(); 98 106 } 99 107 public ValueLookupParameter(string name, T value, bool getsCollected) … … 101 109 this.value = value; 102 110 this.getsCollected = getsCollected; 103 Initialize();111 RegisterValueEvents(); 104 112 } 105 113 public ValueLookupParameter(string name, string description) … … 115 123 this.value = value; 116 124 this.getsCollected = true; 117 Initialize();125 RegisterValueEvents(); 118 126 } 119 127 public ValueLookupParameter(string name, string description, T value, bool getsCollected) … … 121 129 this.value = value; 122 130 this.getsCollected = getsCollected; 123 Initialize();131 RegisterValueEvents(); 124 132 } 125 133 public ValueLookupParameter(string name, string description, string actualName) … … 131 139 this.getsCollected = getsCollected; 132 140 } 133 [StorableConstructor]134 protected ValueLookupParameter(bool deserializing) : base(deserializing) { }135 141 #endregion 136 142 137 143 [StorableHook(HookType.AfterDeserialization)] 138 private void Initialize() {144 private void AfterDeserialization() { 139 145 RegisterValueEvents(); 140 146 } 141 147 142 148 public override IDeepCloneable Clone(Cloner cloner) { 143 ValueLookupParameter<T> clone = (ValueLookupParameter<T>)base.Clone(cloner); 144 clone.value = (T)cloner.Clone(value); 145 clone.getsCollected = getsCollected; 146 clone.Initialize(); 147 return clone; 149 return new ValueLookupParameter<T>(this, cloner); 148 150 } 149 151 -
branches/CloningRefactoring/HeuristicLab.Parameters/3.3/ValueParameter.cs
r4332 r4671 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 39 40 } 40 41 42 [StorableConstructor] 43 protected ValueParameter(bool deserializing) : base(deserializing) { } 44 protected ValueParameter(ValueParameter<T> original, Cloner cloner) : base(original, cloner) { } 41 45 public ValueParameter() : base() { } 42 46 public ValueParameter(string name) : base(name) { } … … 48 52 public ValueParameter(string name, string description, T value) : base(name, description, value) { } 49 53 public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { } 50 [StorableConstructor] 51 protected ValueParameter(bool deserializing) : base(deserializing) { } 54 55 public override IDeepCloneable Clone(Cloner cloner) { 56 return new ValueParameter<T>(this, cloner); 57 } 52 58 } 53 59 }
Note: See TracChangeset
for help on using the changeset viewer.