- Timestamp:
- 05/07/19 15:38:16 (6 years ago)
- Location:
- branches/2994-AutoDiffForIntervals
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2994-AutoDiffForIntervals
- Property svn:mergeinfo changed
-
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs
r16565 r16911 22 22 using System; 23 23 using System.Linq; 24 using HEAL.Attic; 24 25 using HeuristicLab.Collections; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Parameters { … … 47 47 public ConstrainedValueParameter() : base() { } 48 48 public ConstrainedValueParameter(string name) : base(name) { } 49 public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }50 49 public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { } 51 public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }52 50 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { } 53 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { }54 51 public ConstrainedValueParameter(string name, string description) : base(name, description) { } 55 public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }56 52 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { } 57 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { }58 53 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { } 59 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { }60 54 61 55 public override IDeepCloneable Clone(Cloner cloner) { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/FixedValueParameter.cs
r16565 r16911 21 21 22 22 using System; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Parameters { … … 31 31 [Item("FixedValueParameter", "A parameter whose value is defined in the parameter itself and cannot be set.")] 32 32 [StorableType("7787B99D-5F32-4639-B47A-76CB4D204392")] 33 public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() {33 public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() { 34 34 35 35 public override T Value { … … 46 46 public FixedValueParameter() : base() { } 47 47 public FixedValueParameter(string name) : base(name) { } 48 public FixedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }49 48 public FixedValueParameter(string name, T value) : base(name, value) { } 50 public FixedValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }51 49 public FixedValueParameter(string name, string description) : base(name, description) { } 52 public FixedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }53 50 public FixedValueParameter(string name, string description, T value) : base(name, description, value) { } 54 public FixedValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }55 51 56 52 public override IDeepCloneable Clone(Cloner cloner) { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OperatorParameter.cs
r16565 r16911 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HEAL.Attic;25 25 26 26 namespace HeuristicLab.Parameters { … … 36 36 public OperatorParameter() : base("Anonymous") { } 37 37 public OperatorParameter(string name) : base(name) { } 38 public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { }39 38 public OperatorParameter(string name, IOperator value) : base(name, value) { } 40 public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { }41 39 public OperatorParameter(string name, string description) : base(name, description) { } 42 public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }43 40 public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { } 44 public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { }45 41 46 42 public override IDeepCloneable Clone(Cloner cloner) { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r16565 r16911 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Collections; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Parameters { … … 40 40 } 41 41 } 42 42 43 43 [Storable] 44 44 private ItemSet<T> validValues; … … 52 52 get { return this.value; } 53 53 set { 54 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 54 55 if (value != this.value) { 55 56 if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value."); … … 74 75 } 75 76 77 [Storable(DefaultValue = false)] 78 private bool readOnly; 79 public bool ReadOnly { 80 get { return readOnly; } 81 set { 82 if (value == readOnly) return; 83 readOnly = value; 84 OnReadOnlyChanged(); 85 } 86 } 87 76 88 [Storable(DefaultValue = true)] 77 89 private bool getsCollected; … … 93 105 validValues = cloner.Clone(original.validValues); 94 106 value = cloner.Clone(original.value); 107 readOnly = original.readOnly; 95 108 getsCollected = original.getsCollected; 96 109 Initialize(); … … 99 112 : base("Anonymous", typeof(T)) { 100 113 this.validValues = new ItemSet<T>(); 114 this.readOnly = false; 101 115 this.getsCollected = true; 102 116 Initialize(); … … 105 119 : base(name, typeof(T)) { 106 120 this.validValues = new ItemSet<T>(); 107 this.getsCollected = true; 108 Initialize(); 109 } 110 public OptionalConstrainedValueParameter(string name, bool getsCollected) 111 : base(name, typeof(T)) { 112 this.validValues = new ItemSet<T>(); 113 this.getsCollected = getsCollected; 121 this.readOnly = false; 122 this.getsCollected = true; 114 123 Initialize(); 115 124 } … … 117 126 : base(name, typeof(T)) { 118 127 this.validValues = validValues; 119 this.getsCollected = true; 120 Initialize(); 121 } 122 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) 123 : base(name, typeof(T)) { 124 this.validValues = validValues; 125 this.getsCollected = getsCollected; 128 this.readOnly = false; 129 this.getsCollected = true; 126 130 Initialize(); 127 131 } … … 130 134 this.validValues = validValues; 131 135 this.value = value; 132 this.getsCollected = true; 133 Initialize(); 134 } 135 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) 136 : base(name, typeof(T)) { 137 this.validValues = validValues; 138 this.value = value; 139 this.getsCollected = getsCollected; 136 this.readOnly = false; 137 this.getsCollected = true; 140 138 Initialize(); 141 139 } … … 143 141 : base(name, description, typeof(T)) { 144 142 this.validValues = new ItemSet<T>(); 145 this.getsCollected = true; 146 Initialize(); 147 } 148 public OptionalConstrainedValueParameter(string name, string description, bool getsCollected) 149 : base(name, description, typeof(T)) { 150 this.validValues = new ItemSet<T>(); 151 this.getsCollected = getsCollected; 143 this.readOnly = false; 144 this.getsCollected = true; 152 145 Initialize(); 153 146 } … … 155 148 : base(name, description, typeof(T)) { 156 149 this.validValues = validValues; 157 this.getsCollected = true; 158 Initialize(); 159 } 160 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) 161 : base(name, description, typeof(T)) { 162 this.validValues = validValues; 163 this.getsCollected = getsCollected; 150 this.readOnly = false; 151 this.getsCollected = true; 164 152 Initialize(); 165 153 } … … 168 156 this.validValues = validValues; 169 157 this.value = value; 170 this.getsCollected = true; 171 Initialize(); 172 } 173 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) 174 : base(name, description, typeof(T)) { 175 this.validValues = validValues; 176 this.value = value; 177 this.getsCollected = getsCollected; 158 this.readOnly = false; 159 this.getsCollected = true; 178 160 Initialize(); 179 161 } … … 212 194 OnToStringChanged(); 213 195 } 196 public event EventHandler ReadOnlyChanged; 197 protected virtual void OnReadOnlyChanged() { 198 EventHandler handler = ReadOnlyChanged; 199 if (handler != null) handler(this, EventArgs.Empty); 200 } 214 201 public event EventHandler GetsCollectedChanged; 215 202 protected virtual void OnGetsCollectedChanged() { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs
r16565 r16911 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 45 45 get { return this.value; } 46 46 set { 47 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 47 48 if (value != this.value) { 48 49 DeregisterValueEvents(); … … 63 64 ); 64 65 Value = val; 66 } 67 } 68 69 [Storable(DefaultValue = false)] 70 private bool readOnly; 71 public bool ReadOnly { 72 get { return readOnly; } 73 set { 74 if (value == readOnly) return; 75 readOnly = value; 76 OnReadOnlyChanged(); 65 77 } 66 78 } … … 108 120 : base(original, cloner) { 109 121 value = cloner.Clone(original.value); 122 readOnly = original.readOnly; 110 123 getsCollected = original.getsCollected; 111 124 reactOnValueToStringChangedAndValueItemImageChanged = original.reactOnValueToStringChangedAndValueItemImageChanged; … … 114 127 public OptionalValueParameter() 115 128 : base("Anonymous", typeof(T)) { 129 this.readOnly = false; 116 130 this.getsCollected = true; 117 131 this.reactOnValueToStringChangedAndValueItemImageChanged = true; … … 119 133 public OptionalValueParameter(string name) 120 134 : base(name, typeof(T)) { 121 this.getsCollected = true; 122 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 123 } 124 public OptionalValueParameter(string name, bool getsCollected) 125 : base(name, typeof(T)) { 126 this.getsCollected = getsCollected; 135 this.readOnly = false; 136 this.getsCollected = true; 127 137 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 128 138 } … … 130 140 : base(name, typeof(T)) { 131 141 this.value = value; 132 this.getsCollected = true; 133 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 134 RegisterValueEvents(); 135 } 136 public OptionalValueParameter(string name, T value, bool getsCollected) 137 : base(name, typeof(T)) { 138 this.value = value; 139 this.getsCollected = getsCollected; 142 this.readOnly = false; 143 this.getsCollected = true; 140 144 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 141 145 RegisterValueEvents(); … … 143 147 public OptionalValueParameter(string name, string description) 144 148 : base(name, description, typeof(T)) { 145 this.getsCollected = true; 146 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 147 } 148 public OptionalValueParameter(string name, string description, bool getsCollected) 149 : base(name, description, typeof(T)) { 150 this.getsCollected = getsCollected; 151 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 152 } 149 this.readOnly = false; 150 this.getsCollected = true; 151 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 152 } 153 153 154 public OptionalValueParameter(string name, string description, T value) 154 155 : base(name, description, typeof(T)) { 155 156 this.value = value; 156 this.getsCollected = true; 157 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 158 RegisterValueEvents(); 159 } 160 public OptionalValueParameter(string name, string description, T value, bool getsCollected) 161 : base(name, description, typeof(T)) { 162 this.value = value; 163 this.getsCollected = getsCollected; 157 this.readOnly = false; 158 this.getsCollected = true; 164 159 this.reactOnValueToStringChangedAndValueItemImageChanged = true; 165 160 RegisterValueEvents(); … … 197 192 OnToStringChanged(); 198 193 } 194 195 public event EventHandler ReadOnlyChanged; 196 protected virtual void OnReadOnlyChanged() { 197 EventHandler handler = ReadOnlyChanged; 198 if (handler != null) handler(this, EventArgs.Empty); 199 } 199 200 public event EventHandler GetsCollectedChanged; 200 201 protected virtual void OnGetsCollectedChanged() { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r16565 r16911 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 45 45 get { return this.value; } 46 46 set { 47 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 47 48 if (value != this.value) { 48 49 DeregisterValueEvents(); … … 66 67 } 67 68 69 [Storable(DefaultValue = false)] 70 private bool readOnly; 71 public bool ReadOnly { 72 get { return readOnly; } 73 set { 74 if (value == readOnly) return; 75 readOnly = value; 76 OnReadOnlyChanged(); 77 } 78 } 79 68 80 [Storable(DefaultValue = true)] 69 81 private bool getsCollected; … … 84 96 : base(original, cloner) { 85 97 value = cloner.Clone(original.value); 98 readOnly = original.readOnly; 86 99 getsCollected = original.getsCollected; 87 100 RegisterValueEvents(); … … 89 102 public ValueLookupParameter() 90 103 : base() { 104 this.readOnly = false; 91 105 this.Hidden = false; 92 106 this.getsCollected = true; … … 94 108 public ValueLookupParameter(string name) 95 109 : base(name) { 110 this.readOnly = false; 96 111 this.Hidden = false; 97 112 this.getsCollected = true; 98 }99 public ValueLookupParameter(string name, bool getsCollected)100 : base(name) {101 this.Hidden = false;102 this.getsCollected = getsCollected;103 113 } 104 114 public ValueLookupParameter(string name, T value) 105 115 : base(name) { 106 116 this.value = value; 117 this.readOnly = false; 107 118 this.Hidden = false; 108 119 this.getsCollected = true; 109 120 RegisterValueEvents(); 110 121 } 111 public ValueLookupParameter(string name, T value, bool getsCollected)112 : base(name) {113 this.value = value;114 this.Hidden = false;115 this.getsCollected = getsCollected;116 RegisterValueEvents();117 }118 122 public ValueLookupParameter(string name, string description) 119 123 : base(name, description) { 124 this.readOnly = false; 120 125 this.Hidden = false; 121 126 this.getsCollected = true; 122 }123 public ValueLookupParameter(string name, string description, bool getsCollected)124 : base(name, description) {125 this.Hidden = false;126 this.getsCollected = getsCollected;127 127 } 128 128 public ValueLookupParameter(string name, string description, T value) 129 129 : base(name, description) { 130 130 this.value = value; 131 this.readOnly = false; 131 132 this.Hidden = false; 132 133 this.getsCollected = true; 133 134 RegisterValueEvents(); 134 135 } 135 public ValueLookupParameter(string name, string description, T value, bool getsCollected)136 : base(name, description) {137 this.value = value;138 this.Hidden = false;139 this.getsCollected = getsCollected;140 RegisterValueEvents();141 }142 136 public ValueLookupParameter(string name, string description, string actualName) 143 137 : base(name, description, actualName) { 138 this.readOnly = false; 144 139 this.Hidden = false; 145 140 this.getsCollected = true; 146 }147 public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)148 : base(name, description, actualName) {149 this.Hidden = false;150 this.getsCollected = getsCollected;151 141 } 152 142 #endregion … … 177 167 OnToStringChanged(); 178 168 } 169 public event EventHandler ReadOnlyChanged; 170 protected virtual void OnReadOnlyChanged() { 171 EventHandler handler = ReadOnlyChanged; 172 if (handler != null) handler(this, EventArgs.Empty); 173 } 179 174 public event EventHandler GetsCollectedChanged; 180 175 protected virtual void OnGetsCollectedChanged() { -
branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ValueParameter.cs
r16565 r16911 22 22 using System; 23 23 using System.Reflection; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Parameters { … … 47 47 public ValueParameter() : base() { } 48 48 public ValueParameter(string name) : base(name) { base.Value = CreateDefaultValue(); } 49 public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { base.Value = CreateDefaultValue(); }50 49 public ValueParameter(string name, T value) : base(name, value) { } 51 public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }52 50 public ValueParameter(string name, string description) : base(name, description) { base.Value = CreateDefaultValue(); } 53 public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { base.Value = CreateDefaultValue(); }54 51 public ValueParameter(string name, string description, T value) : base(name, description, value) { } 55 public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { } 56 52 57 53 protected T CreateDefaultValue() { 58 54 Type type = typeof(T);
Note: See TracChangeset
for help on using the changeset viewer.