/// <inheritdoc/> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName, new XAttribute("attempts", NumOfAttempts.ToString(CultureInfo.InvariantCulture)), new XAttribute("attemptEpochs", NumOfAttemptEpochs.ToString(CultureInfo.InvariantCulture))); if (!suppressDefaults || !IsDefaultNoiseZeroMargin) { rootElem.Add(new XAttribute("noiseZeroMargin", NoiseZeroMargin.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultNoiseSeeker) { rootElem.Add(NoiseFinderCfg.GetXml("noise", suppressDefaults)); } Validate(rootElem, XsdTypeName); return(rootElem); }
//Methods /// <inheritdoc/> protected override void Check() { if (NumOfAttempts < 1) { throw new ArgumentException($"Invalid NumOfAttempts {NumOfAttempts.ToString(CultureInfo.InvariantCulture)}. NumOfAttempts must be GE to 1.", "NumOfAttempts"); } if (NumOfAttemptEpochs < 1) { throw new ArgumentException($"Invalid NumOfAttemptEpochs {NumOfAttemptEpochs.ToString(CultureInfo.InvariantCulture)}. NumOfAttemptEpochs must be GE to 1.", "NumOfAttemptEpochs"); } if (NoiseZeroMargin < 0 || NoiseZeroMargin >= 1) { throw new ArgumentException($"Invalid NoiseZeroMargin {NoiseZeroMargin.ToString(CultureInfo.InvariantCulture)}. NoiseZeroMargin must be GE to 0 and LT 1.", "NoiseZeroMargin"); } return; }