Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 18:58:23 (13 years ago)
Author:
swagner
Message:

Finished cloning refactoring of HeuristicLab.SequentialEngine and HeuristicLab.Random (#922)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Random/3.3/FastRandom.cs

    r4258 r4675  
    5454
    5555    #region Constructors
     56    /// <summary>
     57    /// Used by HeuristicLab.Persistence to initialize new instances during deserialization.
     58    /// </summary>
     59    /// <param name="deserializing">true, if the constructor is called during deserialization.</param>
     60    [StorableConstructor]
     61    private FastRandom(bool deserializing) : base(deserializing) { }
     62
     63    /// <summary>
     64    /// Initializes a new instance from an existing one (copy constructor).
     65    /// </summary>
     66    /// <param name="original">The original <see cref="FastRandom"/> instance which is used to initialize the new instance.</param>
     67    /// <param name="cloner">A <see cref="Cloner"/> which is used to track all already cloned objects in order to avoid cycles.</param>
     68    private FastRandom(FastRandom original, Cloner cloner)
     69      : base(original, cloner) {
     70      x = original.x;
     71      y = original.y;
     72      z = original.z;
     73      w = original.w;
     74      bitBuffer = original.bitBuffer;
     75      bitMask = original.bitMask;
     76    }
    5677
    5778    /// <summary>
     
    7192      Reinitialise(seed);
    7293    }
    73 
    74     /// <summary>
    75     /// Used by HeuristicLab.Persistence to initialize new instances during deserialization.
    76     /// </summary>
    77     /// <param name="deserializing">true, if the constructor is called during deserialization.</param>
    78     [StorableConstructor]
    79     private FastRandom(bool deserializing) : base(deserializing) { }
    80 
    8194    #endregion
    8295
     
    351364
    352365    public override IDeepCloneable Clone(Cloner cloner) {
    353       FastRandom clone = (FastRandom)base.Clone(cloner);
    354       clone.x = x;
    355       clone.y = y;
    356       clone.z = z;
    357       clone.w = w;
    358       clone.bitBuffer = bitBuffer;
    359       clone.bitMask = bitMask;
    360       return clone;
     366      return new FastRandom(this, cloner);
    361367    }
    362368  }
Note: See TracChangeset for help on using the changeset viewer.