Ejemplo n.º 1
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        /// <param name="obj"><inheritdoc/></param>
        /// <returns><inheritdoc/></returns>
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (!base.Equals(obj))
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            SparseObjectMatrix <T> other = obj as SparseObjectMatrix <T>;

            if (other == null)
            {
                return(false);
            }

            if (m_SparseMap == null)
            {
                if (other.m_SparseMap != null)
                {
                    return(false);
                }
            }
            else if (!m_SparseMap.Equals(other.m_SparseMap))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        /// <param name="obj"><inheritdoc/></param>
        /// <returns><inheritdoc/></returns>
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (!base.Equals(obj))
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            SparseObjectMatrix <T> other = obj as SparseObjectMatrix <T>;

            if (other == null)
            {
                return(false);
            }

            if (m_SparseMap == null)
            {
                if (other.m_SparseMap != null)
                {
                    return(false);
                }
            }
            else if (!m_SparseMap.Equals(other.m_SparseMap))
            {
                return(false);
            }
            if (ModuleTopology == null)
            {
                if (other.ModuleTopology != null)
                {
                    return(false);
                }
            }
            else if (!ModuleTopology.Equals(other.ModuleTopology))
            {
                return(false);
            }
            if (IsRemotelyDistributed != other.IsRemotelyDistributed)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static SparseObjectMatrix <T> Deserialize(StreamReader sr)
        {
            SparseObjectMatrix <T> sparse = new SparseObjectMatrix <T>();

            HtmSerializer2 ser = new HtmSerializer2();

            while (sr.Peek() >= 0)
            {
                string data = sr.ReadLine();
                if (data == String.Empty || data == ser.ReadBegin(nameof(SparseObjectMatrix <T>)))
                {
                    continue;
                }
                else if (data == ser.ReadBegin(nameof(HtmModuleTopology)))
                {
                    sparse.ModuleTopology = HtmModuleTopology.Deserialize(sr);
                }
                //else if (data == ser.ReadBegin(nameof(InMemoryDistributedDictionary<TKey, TValue>) <{ nameof(TKey}>))
                //{
                //    sparse.m_SparseMap = InMemoryDistributedDictionary<TKey, TValue>.Deserialize(sr);
                //}
                else if (data == ser.ReadEnd(nameof(SparseObjectMatrix <T>)))
                {
                    break;
                }
                else
                {
                    string[] str = data.Split(HtmSerializer2.ParameterDelimiter);
                    for (int i = 0; i < str.Length; i++)
                    {
                        switch (i)
                        {
                        case 0:
                        {
                            //sparse.IsRemotelyDistributed = ser.ReadBoolValue(str[i]);
                            break;
                        }

                        default:
                        { break; }
                        }
                    }
                }
            }
            return(sparse);
        }