/// <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; }
/// <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; }
/// <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; }
/// <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()); } }
/// <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()); } }
/// <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; }
//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); }
/// <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)); }
/// <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)); }
/// <summary> /// Creates the deep copy instance of this instance /// </summary> public RandomValueSettings DeepClone() { RandomValueSettings clone = new RandomValueSettings(this); return(clone); }