Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/04/19 16:03:51 (5 years ago)
Author:
abeham
Message:

#2521: refactored multi-objective problems' maximization

  • Add ForceValue method to IValueParameter to perform changes even when it is read-only
  • Add MaximizationChanged event handler
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r17226 r17317  
    5353      set {
    5454        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    55         if (value != this.value) {
    56           if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value.");
    57           DeregisterValueEvents();
    58           this.value = value;
    59           RegisterValueEvents();
    60           OnValueChanged();
    61         }
     55        DoSetValue(value);
     56      }
     57    }
     58    public virtual void ForceValue(T value) {
     59      DoSetValue(value);
     60    }
     61    private void DoSetValue(T value) {
     62      if (value != this.value) {
     63        if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value.");
     64        DeregisterValueEvents();
     65        this.value = value;
     66        RegisterValueEvents();
     67        OnValueChanged();
    6268      }
    6369    }
Note: See TracChangeset for help on using the changeset viewer.