Changeset 4332 for trunk/sources/HeuristicLab.Parameters/3.3
- Timestamp:
- 08/27/10 03:10:17 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Parameters/3.3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs
r4068 r4332 43 43 public ConstrainedValueParameter() : base() { } 44 44 public ConstrainedValueParameter(string name) : base(name) { } 45 public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { } 45 46 public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { } 47 public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { } 46 48 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { } 49 public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { } 47 50 public ConstrainedValueParameter(string name, string description) : base(name, description) { } 51 public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { } 48 52 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { } 53 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { } 49 54 public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { } 55 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) { } 50 58 51 59 protected override void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) { -
trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs
r3822 r4332 173 173 174 174 public event EventHandler ActualNameChanged; 175 pr ivatevoid OnActualNameChanged() {176 if (ActualNameChanged != null)177 ActualNameChanged(this, EventArgs.Empty);175 protected virtual void OnActualNameChanged() { 176 EventHandler handler = ActualNameChanged; 177 if (handler != null) handler(this, EventArgs.Empty); 178 178 OnToStringChanged(); 179 179 } -
trunk/sources/HeuristicLab.Parameters/3.3/OperatorParameter.cs
r4068 r4332 30 30 [StorableClass] 31 31 public class OperatorParameter : OptionalValueParameter<IOperator> { 32 public OperatorParameter() 33 : base("Anonymous") { 34 } 35 public OperatorParameter(string name) 36 : base(name) { 37 } 38 public OperatorParameter(string name, IOperator value) 39 : base(name, value) { 40 Value = value; 41 } 42 public OperatorParameter(string name, string description) 43 : base(name, description) { 44 } 45 public OperatorParameter(string name, string description, IOperator value) 46 : base(name, description, value) { 47 Value = value; 48 } 32 public OperatorParameter() : base("Anonymous") { } 33 public OperatorParameter(string name) : base(name) { } 34 public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { } 35 public OperatorParameter(string name, IOperator value) : base(name, value) { } 36 public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { } 37 public OperatorParameter(string name, string description) : base(name, description) { } 38 public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { } 39 public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { } 40 public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { } 41 [StorableConstructor] 42 protected OperatorParameter(bool deserializing) : base(deserializing) { } 49 43 } 50 44 } -
trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r3822 r4332 61 61 } 62 62 } 63 64 63 IItem IValueParameter.Value { 65 64 get { return Value; } … … 75 74 } 76 75 76 [Storable(DefaultValue = true)] 77 private bool getsCollected; 78 public bool GetsCollected { 79 get { return getsCollected; } 80 set { 81 if (value != getsCollected) { 82 getsCollected = value; 83 OnGetsCollectedChanged(); 84 } 85 } 86 } 87 88 #region Constructors 77 89 public OptionalConstrainedValueParameter() 78 90 : base("Anonymous", typeof(T)) { 79 91 this.validValues = new ItemSet<T>(); 92 this.getsCollected = true; 80 93 Initialize(); 81 94 } … … 83 96 : base(name, typeof(T)) { 84 97 this.validValues = new ItemSet<T>(); 98 this.getsCollected = true; 99 Initialize(); 100 } 101 public OptionalConstrainedValueParameter(string name, bool getsCollected) 102 : base(name, typeof(T)) { 103 this.validValues = new ItemSet<T>(); 104 this.getsCollected = getsCollected; 85 105 Initialize(); 86 106 } … … 88 108 : base(name, typeof(T)) { 89 109 this.validValues = validValues; 110 this.getsCollected = true; 111 Initialize(); 112 } 113 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) 114 : base(name, typeof(T)) { 115 this.validValues = validValues; 116 this.getsCollected = getsCollected; 90 117 Initialize(); 91 118 } … … 94 121 this.validValues = validValues; 95 122 this.value = value; 123 this.getsCollected = true; 124 Initialize(); 125 } 126 public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) 127 : base(name, typeof(T)) { 128 this.validValues = validValues; 129 this.value = value; 130 this.getsCollected = getsCollected; 96 131 Initialize(); 97 132 } … … 99 134 : base(name, description, typeof(T)) { 100 135 this.validValues = new ItemSet<T>(); 136 this.getsCollected = true; 137 Initialize(); 138 } 139 public OptionalConstrainedValueParameter(string name, string description, bool getsCollected) 140 : base(name, description, typeof(T)) { 141 this.validValues = new ItemSet<T>(); 142 this.getsCollected = getsCollected; 101 143 Initialize(); 102 144 } … … 104 146 : base(name, description, typeof(T)) { 105 147 this.validValues = validValues; 148 this.getsCollected = true; 149 Initialize(); 150 } 151 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) 152 : base(name, description, typeof(T)) { 153 this.validValues = validValues; 154 this.getsCollected = getsCollected; 106 155 Initialize(); 107 156 } … … 110 159 this.validValues = validValues; 111 160 this.value = value; 161 this.getsCollected = true; 162 Initialize(); 163 } 164 public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) 165 : base(name, description, typeof(T)) { 166 this.validValues = validValues; 167 this.value = value; 168 this.getsCollected = getsCollected; 112 169 Initialize(); 113 170 } 114 171 [StorableConstructor] 115 172 protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { } 173 #endregion 116 174 117 175 [StorableHook(HookType.AfterDeserialization)] … … 125 183 clone.validValues = (ItemSet<T>)cloner.Clone(validValues); 126 184 clone.value = (T)cloner.Clone(value); 185 clone.getsCollected = getsCollected; 127 186 clone.Initialize(); 128 187 return clone; … … 142 201 public event EventHandler ValueChanged; 143 202 protected virtual void OnValueChanged() { 144 if (ValueChanged != null)145 ValueChanged(this, EventArgs.Empty);203 EventHandler handler = ValueChanged; 204 if (handler != null) handler(this, EventArgs.Empty); 146 205 OnItemImageChanged(); 147 206 OnToStringChanged(); 207 } 208 public event EventHandler GetsCollectedChanged; 209 protected virtual void OnGetsCollectedChanged() { 210 EventHandler handler = GetsCollectedChanged; 211 if (handler != null) handler(this, EventArgs.Empty); 148 212 } 149 213 -
trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs
r3822 r4332 66 66 } 67 67 68 [Storable(DefaultValue = true)] 69 private bool getsCollected; 70 public bool GetsCollected { 71 get { return getsCollected; } 72 set { 73 if (value != getsCollected) { 74 getsCollected = value; 75 OnGetsCollectedChanged(); 76 } 77 } 78 } 79 80 #region Constructors 68 81 public OptionalValueParameter() 69 82 : base("Anonymous", typeof(T)) { 83 this.getsCollected = true; 70 84 } 71 85 public OptionalValueParameter(string name) 72 86 : base(name, typeof(T)) { 87 this.getsCollected = true; 88 } 89 public OptionalValueParameter(string name, bool getsCollected) 90 : base(name, typeof(T)) { 91 this.getsCollected = getsCollected; 73 92 } 74 93 public OptionalValueParameter(string name, T value) 75 94 : base(name, typeof(T)) { 76 95 this.value = value; 96 this.getsCollected = true; 97 Initialize(); 98 } 99 public OptionalValueParameter(string name, T value, bool getsCollected) 100 : base(name, typeof(T)) { 101 this.value = value; 102 this.getsCollected = getsCollected; 77 103 Initialize(); 78 104 } 79 105 public OptionalValueParameter(string name, string description) 80 106 : base(name, description, typeof(T)) { 107 this.getsCollected = true; 108 } 109 public OptionalValueParameter(string name, string description, bool getsCollected) 110 : base(name, description, typeof(T)) { 111 this.getsCollected = getsCollected; 81 112 } 82 113 public OptionalValueParameter(string name, string description, T value) 83 114 : base(name, description, typeof(T)) { 84 115 this.value = value; 116 this.getsCollected = true; 117 Initialize(); 118 } 119 public OptionalValueParameter(string name, string description, T value, bool getsCollected) 120 : base(name, description, typeof(T)) { 121 this.value = value; 122 this.getsCollected = getsCollected; 85 123 Initialize(); 86 124 } 87 125 [StorableConstructor] 88 126 protected OptionalValueParameter(bool deserializing) : base(deserializing) { } 127 #endregion 89 128 90 129 [StorableHook(HookType.AfterDeserialization)] … … 96 135 OptionalValueParameter<T> clone = (OptionalValueParameter<T>)base.Clone(cloner); 97 136 clone.value = (T)cloner.Clone(value); 137 clone.getsCollected = getsCollected; 98 138 clone.Initialize(); 99 139 return clone; … … 112 152 113 153 public event EventHandler ValueChanged; 114 pr ivatevoid OnValueChanged() {115 if (ValueChanged != null)116 ValueChanged(this, EventArgs.Empty);154 protected virtual void OnValueChanged() { 155 EventHandler handler = ValueChanged; 156 if (handler != null) handler(this, EventArgs.Empty); 117 157 OnItemImageChanged(); 118 158 OnToStringChanged(); 159 } 160 public event EventHandler GetsCollectedChanged; 161 protected virtual void OnGetsCollectedChanged() { 162 EventHandler handler = GetsCollectedChanged; 163 if (handler != null) handler(this, EventArgs.Empty); 119 164 } 120 165 -
trunk/sources/HeuristicLab.Parameters/3.3/ScopeParameter.cs
r4068 r4332 44 44 : base(name, description, typeof(IScope)) { 45 45 } 46 [StorableConstructor] 47 protected ScopeParameter(bool deserializing) : base(deserializing) { } 46 48 47 49 public override string ToString() { -
trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs
r3822 r4332 66 66 } 67 67 68 [Storable(DefaultValue = true)] 69 private bool getsCollected; 70 public bool GetsCollected { 71 get { return getsCollected; } 72 set { 73 if (value != getsCollected) { 74 getsCollected = value; 75 OnGetsCollectedChanged(); 76 } 77 } 78 } 79 80 #region Constructors 68 81 public ValueLookupParameter() 69 82 : base() { 83 this.getsCollected = true; 70 84 } 71 85 public ValueLookupParameter(string name) 72 86 : base(name) { 87 this.getsCollected = true; 88 } 89 public ValueLookupParameter(string name, bool getsCollected) 90 : base(name) { 91 this.getsCollected = getsCollected; 73 92 } 74 93 public ValueLookupParameter(string name, T value) 75 94 : base(name) { 76 95 this.value = value; 96 this.getsCollected = true; 97 Initialize(); 98 } 99 public ValueLookupParameter(string name, T value, bool getsCollected) 100 : base(name) { 101 this.value = value; 102 this.getsCollected = getsCollected; 77 103 Initialize(); 78 104 } 79 105 public ValueLookupParameter(string name, string description) 80 106 : base(name, description) { 107 this.getsCollected = true; 108 } 109 public ValueLookupParameter(string name, string description, bool getsCollected) 110 : base(name, description) { 111 this.getsCollected = getsCollected; 81 112 } 82 113 public ValueLookupParameter(string name, string description, T value) 83 114 : base(name, description) { 84 115 this.value = value; 116 this.getsCollected = true; 117 Initialize(); 118 } 119 public ValueLookupParameter(string name, string description, T value, bool getsCollected) 120 : base(name, description) { 121 this.value = value; 122 this.getsCollected = getsCollected; 85 123 Initialize(); 86 124 } 87 125 public ValueLookupParameter(string name, string description, string actualName) 88 126 : base(name, description, actualName) { 127 this.getsCollected = true; 128 } 129 public ValueLookupParameter(string name, string description, string actualName, bool getsCollected) 130 : base(name, description, actualName) { 131 this.getsCollected = getsCollected; 89 132 } 90 133 [StorableConstructor] 91 134 protected ValueLookupParameter(bool deserializing) : base(deserializing) { } 135 #endregion 92 136 93 137 [StorableHook(HookType.AfterDeserialization)] … … 99 143 ValueLookupParameter<T> clone = (ValueLookupParameter<T>)base.Clone(cloner); 100 144 clone.value = (T)cloner.Clone(value); 145 clone.getsCollected = getsCollected; 101 146 clone.Initialize(); 102 147 return clone; … … 113 158 114 159 public event EventHandler ValueChanged; 115 pr ivatevoid OnValueChanged() {116 if (ValueChanged != null)117 ValueChanged(this, EventArgs.Empty);160 protected virtual void OnValueChanged() { 161 EventHandler handler = ValueChanged; 162 if (handler != null) handler(this, EventArgs.Empty); 118 163 OnItemImageChanged(); 119 164 OnToStringChanged(); 165 } 166 public event EventHandler GetsCollectedChanged; 167 protected virtual void OnGetsCollectedChanged() { 168 EventHandler handler = GetsCollectedChanged; 169 if (handler != null) handler(this, EventArgs.Empty); 120 170 } 121 171 -
trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs
r4068 r4332 41 41 public ValueParameter() : base() { } 42 42 public ValueParameter(string name) : base(name) { } 43 public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { } 43 44 public ValueParameter(string name, T value) : base(name, value) { } 45 public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { } 44 46 public ValueParameter(string name, string description) : base(name, description) { } 47 public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { } 45 48 public ValueParameter(string name, string description, T value) : base(name, description, value) { } 49 public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { } 50 [StorableConstructor] 51 protected ValueParameter(bool deserializing) : base(deserializing) { } 46 52 } 47 53 }
Note: See TracChangeset
for help on using the changeset viewer.