//Methods /// <inheritdoc /> protected override void Check() { if (RestingEfficacy < 0 || RestingEfficacy > 1) { throw new ArgumentException($"Invalid RestingEfficacy {RestingEfficacy.ToString(CultureInfo.InvariantCulture)}. RestingEfficacy must be GE to 0 and LE to 1.", "RestingEfficacy"); } if (TauDepression < 0) { throw new ArgumentException($"Invalid TauDepression {TauDepression.ToString(CultureInfo.InvariantCulture)}. TauDepression must be GE to 0.", "TauDepression"); } if (TauFacilitation < 0) { throw new ArgumentException($"Invalid TauFacilitation {TauFacilitation.ToString(CultureInfo.InvariantCulture)}. TauFacilitation must be GE to 0.", "TauFacilitation"); } return; }
/// <summary> /// Generates xml element containing the settings. /// </summary> /// <param name="rootElemName">Name to be used as a name of the root element.</param> /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param> /// <returns>XElement containing the settings</returns> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName); if (!suppressDefaults || !IsDefaultRestingEfficacy) { rootElem.Add(new XAttribute("restingEfficacy", RestingEfficacy.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultTauDepression) { rootElem.Add(new XAttribute("tauDepression", TauDepression.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultTauFacilitation) { rootElem.Add(new XAttribute("tauFacilitation", TauFacilitation.ToString(CultureInfo.InvariantCulture))); } Validate(rootElem, XsdTypeName); return(rootElem); }