Free cookie consent management tool by TermsFeed Policy Generator

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

Implemented ReadOnlyView property for items (#969).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization/3.3/Result.cs

    r3226 r3317  
    4545    }
    4646
     47    [Storable]
    4748    private IItem value;
    48     [Storable]
    4949    public IItem Value {
    5050      get { return value; }
     
    8484      this.dataType = value == null ? typeof(IItem) : value.GetType();
    8585      this.value = value;
    86       if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged);
     86      Initialize();
    8787    }
    8888    public Result(string name, string description, IItem value)
     
    9090      this.dataType = value == null ? typeof(IItem) : value.GetType();
    9191      this.value = value;
    92       if (this.value != null) this.value.ToStringChanged += new EventHandler(Value_ToStringChanged);
     92      Initialize();
     93    }
     94    [StorableConstructor]
     95    private Result(bool deserializing) : base(deserializing) { }
     96
     97    [StorableHook(HookType.AfterDeserialization)]
     98    private void Initialize() {
     99      if (value != null) value.ToStringChanged += new EventHandler(Value_ToStringChanged);
    93100    }
    94101
    95102    public override IDeepCloneable Clone(Cloner cloner) {
    96       Result clone = new Result(Name, Description, (IItem)cloner.Clone(value));
     103      Result clone = new Result(Name, Description, DataType);
    97104      cloner.RegisterClonedObject(this, clone);
    98       clone.dataType = dataType;
     105      clone.ReadOnlyView = ReadOnlyView;
     106      clone.value = (IItem)cloner.Clone(value);
     107      clone.Initialize();
    99108      return clone;
    100109    }
Note: See TracChangeset for help on using the changeset viewer.