Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/10 02:15:10 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on operators and SGA
  • improved performance
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/ItemSet.cs

    r2790 r2830  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Collections;
    2425using System.Collections.Generic;
     
    5556
    5657    public ItemSet() : base() { }
    57     public ItemSet(IEnumerable<T> collection) : base(collection) { }
     58    public ItemSet(IEnumerable<T> collection) : base(collection) {
     59      foreach (T item in this)
     60        item.Changed += new ChangedEventHandler(Item_Changed);
     61    }
    5862
    5963    public object Clone() {
     
    6165    }
    6266
    63     public IDeepCloneable Clone(Cloner cloner) {
    64       List<T> items = new List<T>();
    65       foreach (T item in this)
    66         items.Add((T)cloner.Clone(item));
    67       ItemSet<T> clone = (ItemSet<T>)Activator.CreateInstance(this.GetType(), items);
     67    public virtual IDeepCloneable Clone(Cloner cloner) {
     68      ItemSet<T> clone = (ItemSet<T>)Activator.CreateInstance(this.GetType(), this.Select(x => (T)cloner.Clone(x)));
    6869      cloner.RegisterClonedObject(this, clone);
    6970      return clone;
Note: See TracChangeset for help on using the changeset viewer.