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.Optimization/3.3
Files:
4 edited

Legend:

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

    r3274 r3317  
    3333    public OptimizerList(int capacity) : base(capacity) { }
    3434    public OptimizerList(IEnumerable<IOptimizer> collection) : base(collection) { }
    35 
    36     public override IDeepCloneable Clone(Cloner cloner) {
    37       OptimizerList clone = new OptimizerList(this.Select(x => (IOptimizer)cloner.Clone(x)));
    38       cloner.RegisterClonedObject(this, clone);
    39       return clone;
    40     }
    4135  }
    4236}
  • 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    }
  • trunk/sources/HeuristicLab.Optimization/3.3/ResultCollection.cs

    r3274 r3317  
    3232    public ResultCollection(int capacity) : base(capacity) { }
    3333    public ResultCollection(IEnumerable<IResult> collection) : base(collection) { }
    34 
    35     public override IDeepCloneable Clone(Cloner cloner) {
    36       ResultCollection clone = new ResultCollection(this.Select(x => (IResult)cloner.Clone(x)));
    37       cloner.RegisterClonedObject(this, clone);
    38       return clone;
    39     }
    4034  }
    4135}
  • trunk/sources/HeuristicLab.Optimization/3.3/RunCollection.cs

    r3280 r3317  
    3232    public RunCollection(int capacity) : base(capacity) { }
    3333    public RunCollection(IEnumerable<IRun> collection) : base(collection) { }
    34 
    35     public override IDeepCloneable Clone(Cloner cloner) {
    36       RunCollection clone = new RunCollection(this.Select(x => (IRun)cloner.Clone(x)));
    37       cloner.RegisterClonedObject(this, clone);
    38       return clone;
    39     }
    4034  }
    4135}
Note: See TracChangeset for help on using the changeset viewer.