Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/25/19 23:14:06 (5 years ago)
Author:
mkommend
Message:

#2435: Updated branch with most recent trunk changes.

Location:
branches/2435-alglib_3_15
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2435-alglib_3_15

  • branches/2435-alglib_3_15/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r16565 r17034  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Parameters {
     
    4545      get { return this.value; }
    4646      set {
     47        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    4748        if (value != this.value) {
    4849          DeregisterValueEvents();
     
    6667    }
    6768
     69    [Storable(DefaultValue = false)]
     70    private bool readOnly;
     71    public bool ReadOnly {
     72      get { return readOnly; }
     73      set {
     74        if (value == readOnly) return;
     75        readOnly = value;
     76        OnReadOnlyChanged();
     77      }
     78    }
     79
    6880    [Storable(DefaultValue = true)]
    6981    private bool getsCollected;
     
    8496      : base(original, cloner) {
    8597      value = cloner.Clone(original.value);
     98      readOnly = original.readOnly;
    8699      getsCollected = original.getsCollected;
    87100      RegisterValueEvents();
     
    89102    public ValueLookupParameter()
    90103      : base() {
     104      this.readOnly = false;
    91105      this.Hidden = false;
    92106      this.getsCollected = true;
     
    94108    public ValueLookupParameter(string name)
    95109      : base(name) {
     110      this.readOnly = false;
    96111      this.Hidden = false;
    97112      this.getsCollected = true;
    98     }
    99     public ValueLookupParameter(string name, bool getsCollected)
    100       : base(name) {
    101       this.Hidden = false;
    102       this.getsCollected = getsCollected;
    103113    }
    104114    public ValueLookupParameter(string name, T value)
    105115      : base(name) {
    106116      this.value = value;
     117      this.readOnly = false;
    107118      this.Hidden = false;
    108119      this.getsCollected = true;
    109120      RegisterValueEvents();
    110121    }
    111     public ValueLookupParameter(string name, T value, bool getsCollected)
    112       : base(name) {
    113       this.value = value;
    114       this.Hidden = false;
    115       this.getsCollected = getsCollected;
    116       RegisterValueEvents();
    117     }
    118122    public ValueLookupParameter(string name, string description)
    119123      : base(name, description) {
     124      this.readOnly = false;
    120125      this.Hidden = false;
    121126      this.getsCollected = true;
    122     }
    123     public ValueLookupParameter(string name, string description, bool getsCollected)
    124       : base(name, description) {
    125       this.Hidden = false;
    126       this.getsCollected = getsCollected;
    127127    }
    128128    public ValueLookupParameter(string name, string description, T value)
    129129      : base(name, description) {
    130130      this.value = value;
     131      this.readOnly = false;
    131132      this.Hidden = false;
    132133      this.getsCollected = true;
    133134      RegisterValueEvents();
    134135    }
    135     public ValueLookupParameter(string name, string description, T value, bool getsCollected)
    136       : base(name, description) {
    137       this.value = value;
    138       this.Hidden = false;
    139       this.getsCollected = getsCollected;
    140       RegisterValueEvents();
    141     }
    142136    public ValueLookupParameter(string name, string description, string actualName)
    143137      : base(name, description, actualName) {
     138      this.readOnly = false;
    144139      this.Hidden = false;
    145140      this.getsCollected = true;
    146     }
    147     public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)
    148       : base(name, description, actualName) {
    149       this.Hidden = false;
    150       this.getsCollected = getsCollected;
    151141    }
    152142    #endregion
     
    177167      OnToStringChanged();
    178168    }
     169    public event EventHandler ReadOnlyChanged;
     170    protected virtual void OnReadOnlyChanged() {
     171      EventHandler handler = ReadOnlyChanged;
     172      if (handler != null) handler(this, EventArgs.Empty);
     173    }
    179174    public event EventHandler GetsCollectedChanged;
    180175    protected virtual void OnGetsCollectedChanged() {
Note: See TracChangeset for help on using the changeset viewer.