Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/02/08 21:10:17 (16 years ago)
Author:
gkronber
Message:

Refactored cloning in all plugins except: HL.Communication, HL.Hive, HL.GP, HL.Routing, HL.Scheduling, HL.SimOpt, HL.Visualization

#285 (Cloning could be improved by creating objects at the bottom of the cloning chain with 'new' instead of the top with Activator.CreateInstance())

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactorBranch/HeuristicLab.Permutation/Permutation.cs

    r2 r887  
    3535    }
    3636
     37    public Permutation(Permutation original) : this(original, new Dictionary<Guid, object>()) { }
     38    protected Permutation(Permutation original, IDictionary<Guid, object> clonedObjects)
     39      : base(original, clonedObjects) {
     40      this.Data = (int[])original.Data.Clone();
     41    }
     42
    3743    public override object Clone(IDictionary<Guid, object> clonedObjects) {
    38       Permutation clone = new Permutation((int[])Data.Clone());
    39       clonedObjects.Add(Guid, clone);
    40       return clone;
     44      return new Permutation(this, clonedObjects);
    4145    }
    4246  }
Note: See TracChangeset for help on using the changeset viewer.