예제 #1
0
        /// <inheritdoc />
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName,
                                             new XAttribute("inputFieldName", InputFieldName),
                                             new XAttribute("poolName", PoolName)
                                             );

            if (!suppressDefaults || !IsDefaultSpikingTargetDensity)
            {
                rootElem.Add(new XAttribute("spikingTargetDensity", SpikingTargetDensity.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultAnalogTargetDensity)
            {
                rootElem.Add(new XAttribute("analogTargetDensity", AnalogTargetDensity.ToString(CultureInfo.InvariantCulture)));
            }
            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }
예제 #2
0
 //Methods
 /// <inheritdoc />
 protected override void Check()
 {
     if (InputFieldName.Length == 0)
     {
         throw new ArgumentException($"Input field name can not be empty.", "InputFieldName");
     }
     if (PoolName.Length == 0)
     {
         throw new ArgumentException($"Pool name can not be empty.", "PoolName");
     }
     if (SpikingTargetDensity < 0 || SpikingTargetDensity > 1)
     {
         throw new ArgumentException($"Invalid SpikingTargetDensity ({SpikingTargetDensity.ToString(CultureInfo.InvariantCulture)}). SpikingTargetDensity must be GE to 0 and LE to 1.", "SpikingTargetDensity");
     }
     if (AnalogTargetDensity < 0 || AnalogTargetDensity > 1)
     {
         throw new ArgumentException($"Invalid AnalogTargetDensity ({AnalogTargetDensity.ToString(CultureInfo.InvariantCulture)}). AnalogTargetDensity must be GE to 0 and LE to 1.", "AnalogTargetDensity");
     }
     return;
 }