Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/10 06:41:56 (15 years ago)
Author:
swagner
Message:

Implemented ReadOnlyView property for items (#969).

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

Legend:

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

    r3136 r3317  
    7171      this.actualName = actualName == null ? string.Empty : actualName;
    7272    }
     73    [StorableConstructor]
     74    protected LookupParameter(bool deserializing) : base(deserializing) { }
    7375
    7476    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r3136 r3317  
    3333  [StorableClass]
    3434  public class OptionalConstrainedValueParameter<T> : Parameter, IValueParameter<T> where T : class, IItem {
     35    [Storable]
    3536    private ItemSet<T> validValues;
    36     [Storable]
    3737    public ItemSet<T> ValidValues {
    3838      get { return validValues; }
    39       private set {
    40         DeregisterValidValuesEvents();
    41         validValues = value;
    42         RegisterValidValuesEvents();
    43       }
    4439    }
    4540
     41    [Storable]
    4642    private T value;
    47     [Storable]
    4843    public virtual T Value {
    4944      get { return this.value; }
     
    7469    public OptionalConstrainedValueParameter()
    7570      : base("Anonymous", typeof(T)) {
    76       ValidValues = new ItemSet<T>();
     71      this.validValues = new ItemSet<T>();
     72      Initialize();
    7773    }
    7874    public OptionalConstrainedValueParameter(string name)
    7975      : base(name, typeof(T)) {
    80       ValidValues = new ItemSet<T>();
     76      this.validValues = new ItemSet<T>();
     77      Initialize();
    8178    }
    8279    public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues)
    8380      : base(name, typeof(T)) {
    84       ValidValues = validValues;
     81      this.validValues = validValues;
     82      Initialize();
    8583    }
    8684    public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value)
    8785      : base(name, typeof(T)) {
    88       ValidValues = validValues;
    89       Value = value;
     86      this.validValues = validValues;
     87      this.value = value;
     88      Initialize();
    9089    }
    9190    public OptionalConstrainedValueParameter(string name, string description)
    9291      : base(name, description, typeof(T)) {
    93       ValidValues = new ItemSet<T>();
     92      this.validValues = new ItemSet<T>();
     93      Initialize();
    9494    }
    9595    public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues)
    9696      : base(name, description, typeof(T)) {
    97       ValidValues = validValues;
     97      this.validValues = validValues;
     98      Initialize();
    9899    }
    99100    public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value)
    100101      : base(name, description, typeof(T)) {
    101       ValidValues = validValues;
    102       Value = value;
     102      this.validValues = validValues;
     103      this.value = value;
     104      Initialize();
     105    }
     106    [StorableConstructor]
     107    protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { }
     108
     109    [StorableHook(HookType.AfterDeserialization)]
     110    private void Initialize() {
     111      RegisterValidValuesEvents();
     112      if (value != null) value.ToStringChanged += new EventHandler(Value_ToStringChanged);
    103113    }
    104114
    105115    public override IDeepCloneable Clone(Cloner cloner) {
    106116      OptionalConstrainedValueParameter<T> clone = (OptionalConstrainedValueParameter<T>)base.Clone(cloner);
    107       clone.ValidValues = (ItemSet<T>)cloner.Clone(validValues);
    108       clone.Value = (T)cloner.Clone(value);
     117      clone.validValues = (ItemSet<T>)cloner.Clone(validValues);
     118      clone.value = (T)cloner.Clone(value);
     119      clone.Initialize();
    109120      return clone;
    110121    }
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r3136 r3317  
    3232  [StorableClass]
    3333  public class OptionalValueParameter<T> : Parameter, IValueParameter<T> where T : class, IItem {
     34    [Storable]
    3435    private T value;
    35     [Storable]
    3636    public virtual T Value {
    3737      get { return this.value; }
     
    6666    public OptionalValueParameter(string name, T value)
    6767      : base(name, typeof(T)) {
    68       Value = value;
     68      this.value = value;
     69      Initialize();
    6970    }
    7071    public OptionalValueParameter(string name, string description)
     
    7374    public OptionalValueParameter(string name, string description, T value)
    7475      : base(name, description, typeof(T)) {
    75       Value = value;
     76      this.value = value;
     77      Initialize();
     78    }
     79    [StorableConstructor]
     80    protected OptionalValueParameter(bool deserializing) : base(deserializing) { }
     81
     82    [StorableHook(HookType.AfterDeserialization)]
     83    private void Initialize() {
     84      if (value != null) value.ToStringChanged += new EventHandler(Value_ToStringChanged);
    7685    }
    7786
    7887    public override IDeepCloneable Clone(Cloner cloner) {
    7988      OptionalValueParameter<T> clone = (OptionalValueParameter<T>)base.Clone(cloner);
    80       clone.Value = (T)cloner.Clone(value);
     89      clone.value = (T)cloner.Clone(value);
     90      clone.Initialize();
    8191      return clone;
    8292    }
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r3136 r3317  
    9191      this.dataType = dataType;
    9292    }
     93    [StorableConstructor]
     94    protected Parameter(bool deserializing) : base(deserializing) { }
    9395
    9496    public override IDeepCloneable Clone(Cloner cloner) {
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r3080 r3317  
    3232  [StorableClass]
    3333  public class ValueLookupParameter<T> : LookupParameter<T>, IValueLookupParameter<T> where T : class, IItem {
     34    [Storable]
    3435    private T value;
    35     [Storable]
    3636    public T Value {
    3737      get { return this.value; }
     
    6666    public ValueLookupParameter(string name, T value)
    6767      : base(name) {
    68       Value = value;
     68      this.value = value;
     69      Initialize();
    6970    }
    7071    public ValueLookupParameter(string name, string description)
     
    7374    public ValueLookupParameter(string name, string description, T value)
    7475      : base(name, description) {
    75       Value = value;
     76      this.value = value;
     77      Initialize();
    7678    }
    7779    public ValueLookupParameter(string name, string description, string actualName)
    7880      : base(name, description, actualName) {
    7981    }
     82    [StorableConstructor]
     83    protected ValueLookupParameter(bool deserializing) : base(deserializing) { }
     84
     85    [StorableHook(HookType.AfterDeserialization)]
     86    private void Initialize() {
     87      if (value != null) value.ToStringChanged += new EventHandler(Value_ToStringChanged);
     88    }
    8089
    8190    public override IDeepCloneable Clone(Cloner cloner) {
    8291      ValueLookupParameter<T> clone = (ValueLookupParameter<T>)base.Clone(cloner);
    83       clone.Value = (T)cloner.Clone(value);
     92      clone.value = (T)cloner.Clone(value);
     93      clone.Initialize();
    8494      return clone;
    8595    }
Note: See TracChangeset for help on using the changeset viewer.