示例#1
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        /// <returns></returns>
        public bool Equals(SegmentActivity obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }

            if (ActiveSynapses.SequenceEqual(obj.ActiveSynapses) && PotentialSynapses.SequenceEqual(obj.PotentialSynapses))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public static SegmentActivity Deserialize(StreamReader sr)
        {
            SegmentActivity segment = new SegmentActivity();

            HtmSerializer2 ser = new HtmSerializer2();

            while (sr.Peek() >= 0)
            {
                string data = sr.ReadLine();
                if (data == ser.LineDelimiter || data == ser.ReadBegin(nameof(SegmentActivity)) || data == ser.ReadEnd(nameof(SegmentActivity)))
                {
                }
                else
                {
                    string[] str = data.Split(HtmSerializer2.ParameterDelimiter);
                    for (int i = 0; i < str.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                        {
                            segment.ActiveSynapses = ser.ReadDictionaryIIValue(str[i]);
                            break;
                        }

                        case 1:
                        {
                            segment.PotentialSynapses = ser.ReadDictionaryIIValue(str[i]);
                            break;
                        }

                        default:
                        { break; }
                        }
                    }
                }
            }

            return(segment);
        }