Пример #1
0
        /// <summary>
        /// Creates initialized instance using xml element
        /// </summary>
        /// <param name="elem">Xml element containing settings</param>
        public PredictorsParamsSettings(XElement elem)
            : this()
        {
            //Validation
            XElement settingsElem = Validate(elem, XsdTypeName);

            //Parsing
            foreach (PredictorsProvider.PredictorID predictorID in typeof(PredictorsProvider.PredictorID).GetEnumValues())
            {
                XElement predictorElem = settingsElem.Elements(PredictorsSettings.GetXmlName(predictorID)).FirstOrDefault();
                if (predictorElem != null)
                {
                    switch (predictorID)
                    {
                    case PredictorsProvider.PredictorID.ActivationFadingSum:
                        ActivationFadingSumCfg = new ActivationFadingSumSettings(predictorElem);
                        break;

                    case PredictorsProvider.PredictorID.ActivationMWAvg:
                        ActivationMWAvgCfg = new ActivationMWAvgSettings(predictorElem);
                        break;

                    case PredictorsProvider.PredictorID.FiringFadingSum:
                        FiringFadingSumCfg = new FiringFadingSumSettings(predictorElem);
                        break;

                    case PredictorsProvider.PredictorID.FiringMWAvg:
                        FiringMWAvgCfg = new FiringMWAvgSettings(predictorElem);
                        break;

                    case PredictorsProvider.PredictorID.FiringCount:
                        FiringCountCfg = new FiringCountSettings(predictorElem);
                        break;

                    case PredictorsProvider.PredictorID.FiringBinPattern:
                        FiringBinPatternCfg = new FiringBinPatternSettings(predictorElem);
                        break;

                    default:
                        break;
                    }
                }
            }
            return;
        }
Пример #2
0
 /// <summary>
 /// Generates default named xml element containing the settings.
 /// </summary>
 /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param>
 /// <returns>XElement containing the settings</returns>
 public override XElement GetXml(bool suppressDefaults)
 {
     return(GetXml(PredictorsSettings.GetXmlName(ID), suppressDefaults));
 }