Free cookie consent management tool by TermsFeed Policy Generator

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

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/TwoIndexMove.cs

    r3376 r4722  
    3535    public Permutation Permutation { get; protected set; }
    3636
    37     public TwoIndexMove()
    38       : base() {
    39       Index1 = -1;
    40       Index2 = -1;
    41       Permutation = null;
     37    [StorableConstructor]
     38    protected TwoIndexMove(bool deserializing) : base(deserializing) { }
     39    protected TwoIndexMove(TwoIndexMove original, Cloner cloner)
     40      : base(original, cloner) {
     41      this.Index1 = original.Index1;
     42      this.Index2 = original.Index2;
     43      if (original.Permutation != null)
     44        this.Permutation = cloner.Clone(original.Permutation);
    4245    }
    43 
     46    public TwoIndexMove() : this(-1, -1, null) { }
    4447    public TwoIndexMove(int index1, int index2, Permutation permutation)
    4548      : base() {
     
    5053
    5154    public override IDeepCloneable Clone(Cloner cloner) {
    52       TwoIndexMove clone = (TwoIndexMove)base.Clone(cloner);
    53       clone.Index1 = Index1;
    54       clone.Index2 = Index2;
    55       if (Permutation != null)
    56         clone.Permutation = (Permutation)Permutation.Clone(cloner);
    57       return clone;
     55      return new TwoIndexMove(this, cloner);
    5856    }
    5957  }
Note: See TracChangeset for help on using the changeset viewer.