- Timestamp:
- 06/23/20 04:23:45 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs
r17614 r17625 55 55 set { 56 56 if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter."); 57 DoSetValue(value); 58 } 59 } 60 public virtual void ForceValue(T value) { 61 DoSetValue(value); 62 } 63 private void DoSetValue(T value) { 64 if (value != this.value) { 65 if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value."); 66 DeregisterValueEvents(); 67 this.value = value; 68 RegisterValueEvents(); 69 OnValueChanged(); 70 } 71 } 57 if (value != this.value) { 58 if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value."); 59 DeregisterValueEvents(); 60 this.value = value; 61 RegisterValueEvents(); 62 OnValueChanged(); 63 } 64 } 65 } 66 72 67 IItem IValueParameter.Value { 73 68 get { return Value; } … … 170 165 #endregion 171 166 172 public v oid Populate(IEnumerable<IItem> items) {167 public virtual void Populate(IEnumerable<IItem> items) { 173 168 ValidValues.Clear(); 174 169 ValidValues.UnionWith(items.OfType<T>()); … … 187 182 if (item != null) Value = item; 188 183 } 184 } 185 186 public virtual IItem SetValueToFirstOf(Type itemType) { 187 var item = ValidValues.Where(i => itemType.IsAssignableFrom(i.GetType())).FirstOrDefault(); 188 if (item != null) Value = item; 189 return item; 189 190 } 190 191 -
branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/ScopeTreeLookupParameter.cs
r17257 r17625 133 133 j++; 134 134 } 135 CachedActualValue = values; 135 136 } 136 137
Note: See TracChangeset
for help on using the changeset viewer.