Example #1
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public RandomValueSettings(RandomValueSettings source)
 {
     Min        = source.Min;
     Max        = source.Max;
     RandomSign = source.RandomSign;
     DistrType  = source.DistrType;
     return;
 }
Example #2
0
 /// <summary>
 /// The copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public RandomValueSettings(RandomValueSettings source)
 {
     Min        = source.Min;
     Max        = source.Max;
     RandomSign = source.RandomSign;
     DistrCfg   = (IDistrSettings)((RCNetBaseSettings)source.DistrCfg).DeepClone();
     return;
 }
Example #3
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public RandomValueSettings(RandomValueSettings source)
 {
     Min        = source.Min;
     Max        = source.Max;
     RandomSign = source.RandomSign;
     DistrType  = source.DistrType;
     DistrCfg   = source.DistrCfg?.DeepClone();
     return;
 }
Example #4
0
 /// <summary>
 /// If source is not null then function creates it's clone. If not, function creates instance of the RandomValueSettings using specified default parameters.
 /// </summary>
 public static RandomValueSettings CloneOrDefault(RandomValueSettings source, double defaultMin, double defaultMax, bool randomSign = false)
 {
     if (source == null)
     {
         return(new RandomValueSettings(defaultMin, defaultMax, randomSign));
     }
     else
     {
         return(source.DeepClone());
     }
 }
Example #5
0
 /// <summary>
 /// Clones the existing configuration or creates the new configuration of the random value.
 /// </summary>
 /// <remarks>
 /// Checks whether the specified source configuration instance is not null and if so, creates its clone.
 /// If the source configuration instance is null, creates the configuration according to specified parameters.
 /// </remarks>
 /// <param name="source">The source configuration instance.</param>
 /// <param name="min">The min value.</param>
 /// <param name="max">The max value.</param>
 /// <param name="randomSign">Specifies whether to randomize the value sign.</param>
 public static RandomValueSettings CloneOrCreate(RandomValueSettings source, double min, double max, bool randomSign = false)
 {
     if (source == null)
     {
         return(new RandomValueSettings(min, max, randomSign));
     }
     else
     {
         return((RandomValueSettings)source.DeepClone());
     }
 }
Example #6
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public RandomValueSettings(RandomValueSettings source)
 {
     Min              = source.Min;
     Max              = source.Max;
     RandomSign       = source.RandomSign;
     DistrType        = source.DistrType;
     GaussianDistrCfg = null;
     if (source.GaussianDistrCfg != null)
     {
         GaussianDistrCfg = source.GaussianDistrCfg.DeepClone();
     }
     return;
 }
Example #7
0
        //Methods
        /// <summary>
        /// See the base.
        /// </summary>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            RandomValueSettings cmpSettings = obj as RandomValueSettings;

            if (Min != cmpSettings.Min ||
                Max != cmpSettings.Max ||
                RandomSign != cmpSettings.RandomSign ||
                DistrType != cmpSettings.DistrType
                )
            {
                return(false);
            }
            return(true);
        }
Example #8
0
 /// <summary>
 /// If source is not null then function creates it's clone. If not, function creates instance of the RandomValueSettings using specified default parameters.
 /// </summary>
 public static RandomValueSettings CloneOrDefault(RandomValueSettings source, double defaultConst, bool randomSign = false)
 {
     return(CloneOrDefault(source, defaultConst, defaultConst, randomSign));
 }
Example #9
0
 /// <summary>
 /// Clones the existing configuration or creates the new configuration of the random value.
 /// </summary>
 /// <remarks>
 /// Checks whether the specified source configuration instance is not null and if so, creates its clone.
 /// If the source configuration instance is null, creates the configuration according to specified parameters.
 /// </remarks>
 /// <param name="source">The source configuration instance.</param>
 /// <param name="constValue">The constant value (the same min and max values).</param>
 /// <param name="randomSign">Specifies whether to randomize the value sign.</param>
 public static RandomValueSettings CloneOrCreate(RandomValueSettings source, double constValue, bool randomSign = false)
 {
     return(CloneOrCreate(source, constValue, constValue, randomSign));
 }
Example #10
0
        /// <summary>
        /// Creates the deep copy instance of this instance
        /// </summary>
        public RandomValueSettings DeepClone()
        {
            RandomValueSettings clone = new RandomValueSettings(this);

            return(clone);
        }