Exemple #1
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public PlasticitySTInhibitorySettings(XElement elem)
        {
            //Validation
            XElement settingsElem = Validate(elem, XsdTypeName);
            //Parsing
            XElement dynamicsCfgElem = settingsElem.Elements().FirstOrDefault();

            if (dynamicsCfgElem == null)
            {
                DynamicsCfg = new NonlinearDynamicsSTInhibitorySettings();
            }
            else
            {
                switch (dynamicsCfgElem.Name.LocalName)
                {
                case "constantDynamics":
                    DynamicsCfg = new ConstantDynamicsSTInhibitorySettings(dynamicsCfgElem);
                    break;

                case "linearDynamics":
                    DynamicsCfg = new LinearDynamicsSTInhibitorySettings(dynamicsCfgElem);
                    break;

                case "nonlinearDynamics":
                    DynamicsCfg = new NonlinearDynamicsSTInhibitorySettings(dynamicsCfgElem);
                    break;

                default:
                    throw new InvalidOperationException($"Unexpected element name {dynamicsCfgElem.Name.LocalName}.");
                }
            }
            return;
        }
Exemple #2
0
        }//DynApplication

        /// <summary>
        /// Creates appropriate instance of the efficacy computer
        /// </summary>
        /// <param name="sourceNeuron">Source neuron</param>
        /// <param name="dynamicsCfg">Dynamics configuration</param>
        public static IEfficacy GetEfficacyComputer(INeuron sourceNeuron, IDynamicsSettings dynamicsCfg)
        {
            switch (dynamicsCfg.Type)
            {
            case DynType.Constant: return(new ConstantEfficacy((ConstantDynamicsSettings)dynamicsCfg));

            case DynType.Linear: return(new LinearEfficacy(sourceNeuron, (LinearDynamicsSettings)dynamicsCfg));

            case DynType.Nonlinear: return(new NonlinearEfficacy(sourceNeuron, (NonlinearDynamicsSettings)dynamicsCfg));

            default:
                throw new InvalidOperationException($"Unsupported dynamics configuration {dynamicsCfg.GetType().Name}.");
            }
        }
Exemple #3
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 public PlasticitySTInhibitorySettings(IDynamicsSettings dynamicsCfg = null)
 {
     if (dynamicsCfg == null)
     {
         DynamicsCfg = new NonlinearDynamicsSTInhibitorySettings();
     }
     else if (dynamicsCfg.Application != PlasticityCommon.DynApplication.STInhibitory)
     {
         throw new InvalidOperationException($"Dynamics application must be STInhibitory.");
     }
     else
     {
         DynamicsCfg = (IDynamicsSettings)(((RCNetBaseSettings)dynamicsCfg).DeepClone());
     }
     return;
 }
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 public PlasticityATIndifferentSettings(IDynamicsSettings dynamicsCfg = null)
 {
     if (dynamicsCfg == null)
     {
         DynamicsCfg = new ConstantDynamicsATIndifferentSettings();
     }
     else if (dynamicsCfg.Application != PlasticityCommon.DynApplication.ATIndifferent)
     {
         throw new InvalidOperationException($"Dynamics application must be ATIndifferent.");
     }
     else
     {
         DynamicsCfg = (IDynamicsSettings)(((RCNetBaseSettings)dynamicsCfg).DeepClone());
     }
     return;
 }