//Constructors /// <summary> /// The deep copy constructor /// </summary> /// <param name="source">Source instance</param> public ReservoirSettings(ReservoirSettings source) { SettingsName = source.SettingsName; InputEntryPoint = null; if (source.InputEntryPoint != null) { InputEntryPoint = (int[])source.InputEntryPoint.Clone(); } PoolSettingsCollection = null; if (source.PoolSettingsCollection != null) { PoolSettingsCollection = new List <PoolSettings>(source.PoolSettingsCollection.Count); foreach (PoolSettings srcPoolSettings in source.PoolSettingsCollection) { PoolSettingsCollection.Add(srcPoolSettings.DeepClone()); } } PoolsInterconnectionCollection = null; if (source.PoolsInterconnectionCollection != null) { PoolsInterconnectionCollection = new List <PoolsInterconnection>(source.PoolsInterconnectionCollection.Count); foreach (PoolsInterconnection poolsInterConn in source.PoolsInterconnectionCollection) { PoolsInterconnectionCollection.Add(poolsInterConn.DeepClone()); } } AnalogScopeSpectralRadius = source.AnalogScopeSpectralRadius; SpikingScopeSpectralRadius = source.SpikingScopeSpectralRadius; return; }
/// <summary> /// The deep copy constructor /// </summary> /// <param name="source">Source instance</param> public ReservoirSettings(ReservoirSettings source) { SettingsName = source.SettingsName; SynapticDelayMethod = source.SynapticDelayMethod; MaxInputDelay = source.MaxInputDelay; MaxInternalDelay = source.MaxInternalDelay; SpectralRadius = source.SpectralRadius; InputEntryPoint = null; if (source.InputEntryPoint != null) { InputEntryPoint = (int[])source.InputEntryPoint.Clone(); } PoolSettingsCollection = null; if (source.PoolSettingsCollection != null) { PoolSettingsCollection = new List <PoolSettings>(source.PoolSettingsCollection.Count); foreach (PoolSettings srcPoolSettings in source.PoolSettingsCollection) { PoolSettingsCollection.Add(srcPoolSettings.DeepClone()); } } PoolsInterconnectionCollection = null; if (source.PoolsInterconnectionCollection != null) { PoolsInterconnectionCollection = new List <PoolsInterconnection>(source.PoolsInterconnectionCollection.Count); foreach (PoolsInterconnection poolsInterConn in source.PoolsInterconnectionCollection) { PoolsInterconnectionCollection.Add(poolsInterConn.DeepClone()); } } return; }
//Methods /// <summary> /// See the base. /// </summary> public override bool Equals(object obj) { if (obj == null) { return(false); } ReservoirSettings cmpSettings = obj as ReservoirSettings; if (SettingsName != cmpSettings.SettingsName || SynapticDelayMethod != cmpSettings.SynapticDelayMethod || MaxInputDelay != cmpSettings.MaxInputDelay || MaxInternalDelay != cmpSettings.MaxInternalDelay || SpectralRadius != cmpSettings.SpectralRadius || (PoolSettingsCollection == null && cmpSettings.PoolSettingsCollection != null) || (PoolSettingsCollection != null && cmpSettings.PoolSettingsCollection == null) || (PoolSettingsCollection != null && PoolSettingsCollection.Count != cmpSettings.PoolSettingsCollection.Count) || (PoolsInterconnectionCollection == null && cmpSettings.PoolsInterconnectionCollection != null) || (PoolsInterconnectionCollection != null && cmpSettings.PoolsInterconnectionCollection == null) || (PoolsInterconnectionCollection != null && PoolsInterconnectionCollection.Count != cmpSettings.PoolsInterconnectionCollection.Count) ) { return(false); } if (PoolSettingsCollection != null) { for (int i = 0; i < PoolSettingsCollection.Count; i++) { if (!Equals(PoolSettingsCollection[i], cmpSettings.PoolSettingsCollection[i])) { return(false); } } } if (PoolsInterconnectionCollection != null) { for (int i = 0; i < PoolsInterconnectionCollection.Count; i++) { if (!Equals(PoolsInterconnectionCollection[i], cmpSettings.PoolsInterconnectionCollection[i])) { return(false); } } } return(true); }
//Methods /// <summary> /// See the base. /// </summary> public override bool Equals(object obj) { if (obj == null) { return(false); } ReservoirSettings cmpSettings = obj as ReservoirSettings; if (SettingsName != cmpSettings.SettingsName || (PoolSettingsCollection == null && cmpSettings.PoolSettingsCollection != null) || (PoolSettingsCollection != null && cmpSettings.PoolSettingsCollection == null) || (PoolSettingsCollection != null && PoolSettingsCollection.Count != cmpSettings.PoolSettingsCollection.Count) || (PoolsInterconnectionCollection == null && cmpSettings.PoolsInterconnectionCollection != null) || (PoolsInterconnectionCollection != null && cmpSettings.PoolsInterconnectionCollection == null) || (PoolsInterconnectionCollection != null && PoolsInterconnectionCollection.Count != cmpSettings.PoolsInterconnectionCollection.Count) || AnalogScopeSpectralRadius != cmpSettings.AnalogScopeSpectralRadius || SpikingScopeSpectralRadius != cmpSettings.SpikingScopeSpectralRadius ) { return(false); } if (PoolSettingsCollection != null) { for (int i = 0; i < PoolSettingsCollection.Count; i++) { if (!Equals(PoolSettingsCollection[i], cmpSettings.PoolSettingsCollection[i])) { return(false); } } } if (PoolsInterconnectionCollection != null) { for (int i = 0; i < PoolsInterconnectionCollection.Count; i++) { if (!Equals(PoolsInterconnectionCollection[i], cmpSettings.PoolsInterconnectionCollection[i])) { return(false); } } } return(true); }
/// <summary> /// Creates the deep copy instance of this instance /// </summary> public ReservoirSettings DeepClone() { ReservoirSettings clone = new ReservoirSettings(this); return(clone); }