Example #1
0
        /// <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 || !IsDefaultIniLR)
            {
                rootElem.Add(new XAttribute("iniLR", IniLR.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultIncLR)
            {
                rootElem.Add(new XAttribute("incLR", IncLR.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultDecLR)
            {
                rootElem.Add(new XAttribute("decLR", DecLR.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultMinLR)
            {
                rootElem.Add(new XAttribute("minLR", MinLR.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultMaxLR)
            {
                rootElem.Add(new XAttribute("maxLR", MaxLR.ToString(CultureInfo.InvariantCulture)));
            }
            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
Example #2
0
 //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 (IniLR < 0 || IniLR >= 1)
     {
         throw new ArgumentException($"Invalid IniLR {IniLR.ToString(CultureInfo.InvariantCulture)}. IniLR must be GE to 0 and LT 1.", "IniLR");
     }
     if (IncLR <= 1)
     {
         throw new ArgumentException($"Invalid IncLR {IncLR.ToString(CultureInfo.InvariantCulture)}. IncLR must be GT 1.", "IncLR");
     }
     if (DecLR < 0 || DecLR >= 1)
     {
         throw new ArgumentException($"Invalid DecLR {DecLR.ToString(CultureInfo.InvariantCulture)}. DecLR must be GE to 0 and LT 1.", "DecLR");
     }
     if (MinLR < 0 || MinLR >= 1)
     {
         throw new ArgumentException($"Invalid MinLR {MinLR.ToString(CultureInfo.InvariantCulture)}. MinLR must be GE to 0 and LT 1.", "MinLR");
     }
     if (MaxLR < 0 || MaxLR >= 1)
     {
         throw new ArgumentException($"Invalid MaxLR {MaxLR.ToString(CultureInfo.InvariantCulture)}. MaxLR must be GE to 0 and LT 1.", "MaxLR");
     }
     if (MaxLR <= MinLR)
     {
         throw new ArgumentException($"Invalid MinLR or MaxLR. MaxLR must be GT MinLR.", "MaxLR/MinLR");
     }
     return;
 }