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)

Location:
trunk/sources/HeuristicLab.Parameters/3.3
Files:
8 edited

Legend:

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

    r4068 r4332  
    4343    public ConstrainedValueParameter() : base() { }
    4444    public ConstrainedValueParameter(string name) : base(name) { }
     45    public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4546    public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { }
     47    public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }
    4648    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) { }
    4750    public ConstrainedValueParameter(string name, string description) : base(name, description) { }
     51    public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4852    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) { }
    4954    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) { }
    5058
    5159    protected override void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) {
  • trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs

    r3822 r4332  
    173173
    174174    public event EventHandler ActualNameChanged;
    175     private void 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);
    178178      OnToStringChanged();
    179179    }
  • trunk/sources/HeuristicLab.Parameters/3.3/OperatorParameter.cs

    r4068 r4332  
    3030  [StorableClass]
    3131  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) { }
    4943  }
    5044}
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r3822 r4332  
    6161      }
    6262    }
    63 
    6463    IItem IValueParameter.Value {
    6564      get { return Value; }
     
    7574    }
    7675
     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
    7789    public OptionalConstrainedValueParameter()
    7890      : base("Anonymous", typeof(T)) {
    7991      this.validValues = new ItemSet<T>();
     92      this.getsCollected = true;
    8093      Initialize();
    8194    }
     
    8396      : base(name, typeof(T)) {
    8497      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;
    85105      Initialize();
    86106    }
     
    88108      : base(name, typeof(T)) {
    89109      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;
    90117      Initialize();
    91118    }
     
    94121      this.validValues = validValues;
    95122      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;
    96131      Initialize();
    97132    }
     
    99134      : base(name, description, typeof(T)) {
    100135      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;
    101143      Initialize();
    102144    }
     
    104146      : base(name, description, typeof(T)) {
    105147      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;
    106155      Initialize();
    107156    }
     
    110159      this.validValues = validValues;
    111160      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;
    112169      Initialize();
    113170    }
    114171    [StorableConstructor]
    115172    protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { }
     173    #endregion
    116174
    117175    [StorableHook(HookType.AfterDeserialization)]
     
    125183      clone.validValues = (ItemSet<T>)cloner.Clone(validValues);
    126184      clone.value = (T)cloner.Clone(value);
     185      clone.getsCollected = getsCollected;
    127186      clone.Initialize();
    128187      return clone;
     
    142201    public event EventHandler ValueChanged;
    143202    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);
    146205      OnItemImageChanged();
    147206      OnToStringChanged();
     207    }
     208    public event EventHandler GetsCollectedChanged;
     209    protected virtual void OnGetsCollectedChanged() {
     210      EventHandler handler = GetsCollectedChanged;
     211      if (handler != null) handler(this, EventArgs.Empty);
    148212    }
    149213
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.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 OptionalValueParameter()
    6982      : base("Anonymous", typeof(T)) {
     83      this.getsCollected = true;
    7084    }
    7185    public OptionalValueParameter(string name)
    7286      : 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;
    7392    }
    7493    public OptionalValueParameter(string name, T value)
    7594      : base(name, typeof(T)) {
    7695      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;
    77103      Initialize();
    78104    }
    79105    public OptionalValueParameter(string name, string description)
    80106      : 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;
    81112    }
    82113    public OptionalValueParameter(string name, string description, T value)
    83114      : base(name, description, typeof(T)) {
    84115      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;
    85123      Initialize();
    86124    }
    87125    [StorableConstructor]
    88126    protected OptionalValueParameter(bool deserializing) : base(deserializing) { }
     127    #endregion
    89128
    90129    [StorableHook(HookType.AfterDeserialization)]
     
    96135      OptionalValueParameter<T> clone = (OptionalValueParameter<T>)base.Clone(cloner);
    97136      clone.value = (T)cloner.Clone(value);
     137      clone.getsCollected = getsCollected;
    98138      clone.Initialize();
    99139      return clone;
     
    112152
    113153    public event EventHandler ValueChanged;
    114     private void 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);
    117157      OnItemImageChanged();
    118158      OnToStringChanged();
     159    }
     160    public event EventHandler GetsCollectedChanged;
     161    protected virtual void OnGetsCollectedChanged() {
     162      EventHandler handler = GetsCollectedChanged;
     163      if (handler != null) handler(this, EventArgs.Empty);
    119164    }
    120165
  • trunk/sources/HeuristicLab.Parameters/3.3/ScopeParameter.cs

    r4068 r4332  
    4444      : base(name, description, typeof(IScope)) {
    4545    }
     46    [StorableConstructor]
     47    protected ScopeParameter(bool deserializing) : base(deserializing) { }
    4648
    4749    public override string ToString() {
  • 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
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs

    r4068 r4332  
    4141    public ValueParameter() : base() { }
    4242    public ValueParameter(string name) : base(name) { }
     43    public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4344    public ValueParameter(string name, T value) : base(name, value) { }
     45    public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    4446    public ValueParameter(string name, string description) : base(name, description) { }
     47    public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4548    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) { }
    4652  }
    4753}
Note: See TracChangeset for help on using the changeset viewer.