Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/19 15:38:16 (6 years ago)
Author:
gkronber
Message:

#2994: merged r16839:16910 from trunk to branch

Location:
branches/2994-AutoDiffForIntervals
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2994-AutoDiffForIntervals

  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs

    r16565 r16911  
    2222using System;
    2323using System.Linq;
     24using HEAL.Attic;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Parameters {
     
    4747    public ConstrainedValueParameter() : base() { }
    4848    public ConstrainedValueParameter(string name) : base(name) { }
    49     public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    5049    public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { }
    51     public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }
    5250    public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { }
    53     public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { }
    5451    public ConstrainedValueParameter(string name, string description) : base(name, description) { }
    55     public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    5652    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { }
    57     public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { }
    5853    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { }
    59     public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { }
    6054
    6155    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/FixedValueParameter.cs

    r16565 r16911  
    2121
    2222using System;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    25 using HEAL.Attic;
    2626
    2727namespace HeuristicLab.Parameters {
     
    3131  [Item("FixedValueParameter", "A parameter whose value is defined in the parameter itself and cannot be set.")]
    3232  [StorableType("7787B99D-5F32-4639-B47A-76CB4D204392")]
    33   public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class,IItem, new() {
     33  public class FixedValueParameter<T> : ValueParameter<T>, IFixedValueParameter<T> where T : class, IItem, new() {
    3434
    3535    public override T Value {
     
    4646    public FixedValueParameter() : base() { }
    4747    public FixedValueParameter(string name) : base(name) { }
    48     public FixedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4948    public FixedValueParameter(string name, T value) : base(name, value) { }
    50     public FixedValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    5149    public FixedValueParameter(string name, string description) : base(name, description) { }
    52     public FixedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    5350    public FixedValueParameter(string name, string description, T value) : base(name, description, value) { }
    54     public FixedValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }
    5551
    5652    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OperatorParameter.cs

    r16565 r16911  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
    2525
    2626namespace HeuristicLab.Parameters {
     
    3636    public OperatorParameter() : base("Anonymous") { }
    3737    public OperatorParameter(string name) : base(name) { }
    38     public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    3938    public OperatorParameter(string name, IOperator value) : base(name, value) { }
    40     public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { }
    4139    public OperatorParameter(string name, string description) : base(name, description) { }
    42     public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4340    public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { }
    44     public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { }
    4541
    4642    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r16565 r16911  
    2222using System;
    2323using System.Drawing;
     24using HEAL.Attic;
    2425using HeuristicLab.Collections;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
    27 using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Parameters {
     
    4040      }
    4141    }
    42      
     42
    4343    [Storable]
    4444    private ItemSet<T> validValues;
     
    5252      get { return this.value; }
    5353      set {
     54        if (ReadOnly) throw new InvalidOperationException("Cannot set the value of a readonly parameter.");
    5455        if (value != this.value) {
    5556          if ((value != null) && !validValues.Contains(value)) throw new ArgumentException("Invalid value.");
     
    7475    }
    7576
     77    [Storable(DefaultValue = false)]
     78    private bool readOnly;
     79    public bool ReadOnly {
     80      get { return readOnly; }
     81      set {
     82        if (value == readOnly) return;
     83        readOnly = value;
     84        OnReadOnlyChanged();
     85      }
     86    }
     87
    7688    [Storable(DefaultValue = true)]
    7789    private bool getsCollected;
     
    93105      validValues = cloner.Clone(original.validValues);
    94106      value = cloner.Clone(original.value);
     107      readOnly = original.readOnly;
    95108      getsCollected = original.getsCollected;
    96109      Initialize();
     
    99112      : base("Anonymous", typeof(T)) {
    100113      this.validValues = new ItemSet<T>();
     114      this.readOnly = false;
    101115      this.getsCollected = true;
    102116      Initialize();
     
    105119      : base(name, typeof(T)) {
    106120      this.validValues = new ItemSet<T>();
    107       this.getsCollected = true;
    108       Initialize();
    109     }
    110     public OptionalConstrainedValueParameter(string name, bool getsCollected)
    111       : base(name, typeof(T)) {
    112       this.validValues = new ItemSet<T>();
    113       this.getsCollected = getsCollected;
     121      this.readOnly = false;
     122      this.getsCollected = true;
    114123      Initialize();
    115124    }
     
    117126      : base(name, typeof(T)) {
    118127      this.validValues = validValues;
    119       this.getsCollected = true;
    120       Initialize();
    121     }
    122     public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected)
    123       : base(name, typeof(T)) {
    124       this.validValues = validValues;
    125       this.getsCollected = getsCollected;
     128      this.readOnly = false;
     129      this.getsCollected = true;
    126130      Initialize();
    127131    }
     
    130134      this.validValues = validValues;
    131135      this.value = value;
    132       this.getsCollected = true;
    133       Initialize();
    134     }
    135     public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected)
    136       : base(name, typeof(T)) {
    137       this.validValues = validValues;
    138       this.value = value;
    139       this.getsCollected = getsCollected;
     136      this.readOnly = false;
     137      this.getsCollected = true;
    140138      Initialize();
    141139    }
     
    143141      : base(name, description, typeof(T)) {
    144142      this.validValues = new ItemSet<T>();
    145       this.getsCollected = true;
    146       Initialize();
    147     }
    148     public OptionalConstrainedValueParameter(string name, string description, bool getsCollected)
    149       : base(name, description, typeof(T)) {
    150       this.validValues = new ItemSet<T>();
    151       this.getsCollected = getsCollected;
     143      this.readOnly = false;
     144      this.getsCollected = true;
    152145      Initialize();
    153146    }
     
    155148      : base(name, description, typeof(T)) {
    156149      this.validValues = validValues;
    157       this.getsCollected = true;
    158       Initialize();
    159     }
    160     public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected)
    161       : base(name, description, typeof(T)) {
    162       this.validValues = validValues;
    163       this.getsCollected = getsCollected;
     150      this.readOnly = false;
     151      this.getsCollected = true;
    164152      Initialize();
    165153    }
     
    168156      this.validValues = validValues;
    169157      this.value = value;
    170       this.getsCollected = true;
    171       Initialize();
    172     }
    173     public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected)
    174       : base(name, description, typeof(T)) {
    175       this.validValues = validValues;
    176       this.value = value;
    177       this.getsCollected = getsCollected;
     158      this.readOnly = false;
     159      this.getsCollected = true;
    178160      Initialize();
    179161    }
     
    212194      OnToStringChanged();
    213195    }
     196    public event EventHandler ReadOnlyChanged;
     197    protected virtual void OnReadOnlyChanged() {
     198      EventHandler handler = ReadOnlyChanged;
     199      if (handler != null) handler(this, EventArgs.Empty);
     200    }
    214201    public event EventHandler GetsCollectedChanged;
    215202    protected virtual void OnGetsCollectedChanged() {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r16565 r16911  
    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();
     
    6364          );
    6465        Value = val;
     66      }
     67    }
     68
     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();
    6577      }
    6678    }
     
    108120      : base(original, cloner) {
    109121      value = cloner.Clone(original.value);
     122      readOnly = original.readOnly;
    110123      getsCollected = original.getsCollected;
    111124      reactOnValueToStringChangedAndValueItemImageChanged = original.reactOnValueToStringChangedAndValueItemImageChanged;
     
    114127    public OptionalValueParameter()
    115128      : base("Anonymous", typeof(T)) {
     129      this.readOnly = false;
    116130      this.getsCollected = true;
    117131      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
     
    119133    public OptionalValueParameter(string name)
    120134      : base(name, typeof(T)) {
    121       this.getsCollected = true;
    122       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    123     }
    124     public OptionalValueParameter(string name, bool getsCollected)
    125       : base(name, typeof(T)) {
    126       this.getsCollected = getsCollected;
     135      this.readOnly = false;
     136      this.getsCollected = true;
    127137      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    128138    }
     
    130140      : base(name, typeof(T)) {
    131141      this.value = value;
    132       this.getsCollected = true;
    133       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    134       RegisterValueEvents();
    135     }
    136     public OptionalValueParameter(string name, T value, bool getsCollected)
    137       : base(name, typeof(T)) {
    138       this.value = value;
    139       this.getsCollected = getsCollected;
     142      this.readOnly = false;
     143      this.getsCollected = true;
    140144      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    141145      RegisterValueEvents();
     
    143147    public OptionalValueParameter(string name, string description)
    144148      : base(name, description, typeof(T)) {
    145       this.getsCollected = true;
    146       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    147     }
    148     public OptionalValueParameter(string name, string description, bool getsCollected)
    149       : base(name, description, typeof(T)) {
    150       this.getsCollected = getsCollected;
    151       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    152     }
     149      this.readOnly = false;
     150      this.getsCollected = true;
     151      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
     152    }
     153
    153154    public OptionalValueParameter(string name, string description, T value)
    154155      : base(name, description, typeof(T)) {
    155156      this.value = value;
    156       this.getsCollected = true;
    157       this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    158       RegisterValueEvents();
    159     }
    160     public OptionalValueParameter(string name, string description, T value, bool getsCollected)
    161       : base(name, description, typeof(T)) {
    162       this.value = value;
    163       this.getsCollected = getsCollected;
     157      this.readOnly = false;
     158      this.getsCollected = true;
    164159      this.reactOnValueToStringChangedAndValueItemImageChanged = true;
    165160      RegisterValueEvents();
     
    197192      OnToStringChanged();
    198193    }
     194
     195    public event EventHandler ReadOnlyChanged;
     196    protected virtual void OnReadOnlyChanged() {
     197      EventHandler handler = ReadOnlyChanged;
     198      if (handler != null) handler(this, EventArgs.Empty);
     199    }
    199200    public event EventHandler GetsCollectedChanged;
    200201    protected virtual void OnGetsCollectedChanged() {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r16565 r16911  
    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() {
  • branches/2994-AutoDiffForIntervals/HeuristicLab.Parameters/3.3/ValueParameter.cs

    r16565 r16911  
    2222using System;
    2323using System.Reflection;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    26 using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Parameters {
     
    4747    public ValueParameter() : base() { }
    4848    public ValueParameter(string name) : base(name) { base.Value = CreateDefaultValue(); }
    49     public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { base.Value = CreateDefaultValue(); }
    5049    public ValueParameter(string name, T value) : base(name, value) { }
    51     public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    5250    public ValueParameter(string name, string description) : base(name, description) { base.Value = CreateDefaultValue(); }
    53     public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { base.Value = CreateDefaultValue(); }
    5451    public ValueParameter(string name, string description, T value) : base(name, description, value) { }
    55     public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }
    56                                                                                  
     52
    5753    protected T CreateDefaultValue() {
    5854      Type type = typeof(T);
Note: See TracChangeset for help on using the changeset viewer.