Exemple #1
0
 /// <summary>
 /// The deep copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public PoolSettings(PoolSettings source)
 {
     Name = source.Name;
     Dim  = null;
     if (source.Dim != null)
     {
         Dim = new PoolDimensions(source.Dim.X, source.Dim.Y, source.Dim.Z, source.Dim.DimX, source.Dim.DimY, source.Dim.DimZ);
     }
     ReadoutNeuronsDensity = source.ReadoutNeuronsDensity;
     NeuronGroups          = new List <NeuronGroupSettings>(source.NeuronGroups.Count);
     foreach (NeuronGroupSettings item in source.NeuronGroups)
     {
         NeuronGroups.Add(item.DeepClone());
     }
     InterconnectionCfg       = source.InterconnectionCfg.DeepClone();
     RetainmentNeuronsFeature = source.RetainmentNeuronsFeature;
     RetainmentNeuronsDensity = source.RetainmentNeuronsDensity;
     if (RetainmentNeuronsFeature)
     {
         RetainmentRate = source.RetainmentRate.DeepClone();
     }
     else
     {
         RetainmentRate = null;
     }
     return;
 }
Exemple #2
0
        //Methods
        /// <summary>
        /// See the base.
        /// </summary>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PoolSettings cmpSettings = obj as PoolSettings;

            if (Name != cmpSettings.Name ||
                !Equals(Dim, cmpSettings.Dim) ||
                ReadoutNeuronsDensity != cmpSettings.ReadoutNeuronsDensity ||
                !Equals(NeuronGroups.Count, cmpSettings.NeuronGroups.Count) ||
                !Equals(InterconnectionCfg, cmpSettings.InterconnectionCfg) ||
                RetainmentNeuronsFeature != cmpSettings.RetainmentNeuronsFeature ||
                RetainmentNeuronsDensity != cmpSettings.RetainmentNeuronsDensity ||
                !Equals(RetainmentRate, cmpSettings.RetainmentRate)
                )
            {
                return(false);
            }
            for (int i = 0; i < NeuronGroups.Count; i++)
            {
                if (!Equals(NeuronGroups[i], cmpSettings.NeuronGroups[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Creates the deep copy instance of this instance
        /// </summary>
        public PoolSettings DeepClone()
        {
            PoolSettings clone = new PoolSettings(this);

            return(clone);
        }