/// <summary> /// Creates an instance and initializes it from given xml element. /// </summary> /// <param name="elem">Xml data containing RandomValueSettings settings.</param> public URandomValueSettings(XElement elem) { //Validation XElement settingsElem = Validate(elem, XsdTypeName); //Parsing Min = double.Parse(settingsElem.Attribute("min").Value, CultureInfo.InvariantCulture); Max = double.Parse(settingsElem.Attribute("max").Value, CultureInfo.InvariantCulture); XElement distrParamsElem = settingsElem.Elements().FirstOrDefault(); if (distrParamsElem == null) { DistrCfg = new UniformDistrSettings(); } else { DistrCfg = RandomCommon.CreateUDistrSettings(distrParamsElem); } Check(); return; }
/// <inheritdoc /> public override XElement GetXml(bool suppressDefaults) { return(GetXml(RandomCommon.GetDistrElemName(Type), suppressDefaults)); }