Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/27/10 03:10:17 (14 years ago)
Author:
swagner
Message:

Enabled users to choose whether a parameter should be collected in each run or not (#1113)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r3822 r4332  
    6666    }
    6767
     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
    6881    public ValueLookupParameter()
    6982      : base() {
     83      this.getsCollected = true;
    7084    }
    7185    public ValueLookupParameter(string name)
    7286      : base(name) {
     87      this.getsCollected = true;
     88    }
     89    public ValueLookupParameter(string name, bool getsCollected)
     90      : base(name) {
     91      this.getsCollected = getsCollected;
    7392    }
    7493    public ValueLookupParameter(string name, T value)
    7594      : base(name) {
    7695      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;
    77103      Initialize();
    78104    }
    79105    public ValueLookupParameter(string name, string description)
    80106      : 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;
    81112    }
    82113    public ValueLookupParameter(string name, string description, T value)
    83114      : base(name, description) {
    84115      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;
    85123      Initialize();
    86124    }
    87125    public ValueLookupParameter(string name, string description, string actualName)
    88126      : 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;
    89132    }
    90133    [StorableConstructor]
    91134    protected ValueLookupParameter(bool deserializing) : base(deserializing) { }
     135    #endregion
    92136
    93137    [StorableHook(HookType.AfterDeserialization)]
     
    99143      ValueLookupParameter<T> clone = (ValueLookupParameter<T>)base.Clone(cloner);
    100144      clone.value = (T)cloner.Clone(value);
     145      clone.getsCollected = getsCollected;
    101146      clone.Initialize();
    102147      return clone;
     
    113158
    114159    public event EventHandler ValueChanged;
    115     private void 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);
    118163      OnItemImageChanged();
    119164      OnToStringChanged();
     165    }
     166    public event EventHandler GetsCollectedChanged;
     167    protected virtual void OnGetsCollectedChanged() {
     168      EventHandler handler = GetsCollectedChanged;
     169      if (handler != null) handler(this, EventArgs.Empty);
    120170    }
    121171
Note: See TracChangeset for help on using the changeset viewer.