Beispiel #1
0
        bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
        {
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }

            var list = other as ListTuple;

            if (!object.ReferenceEquals(list, null))
            {
                if (list.m_count != m_count)
                {
                    return(false);
                }

                if (list.m_offset == 0 && list.m_count == list.m_items.Length)
                {
                    return(CompareItems(list.m_items, comparer));
                }
                else
                {
                    return(CompareItems(list, comparer));
                }
            }

            return(TupleHelpers.Equals(this, other, comparer));
        }
        bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
        {
            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }

            var linked = other as LinkedTuple <T>;

            if (!object.ReferenceEquals(linked, null))
            {
                // must have same length
                if (linked.Count != this.Count)
                {
                    return(false);
                }
                // compare the tail before
                if (!comparer.Equals(this.Tail, linked.Tail))
                {
                    return(false);
                }
                // compare the rest
                return(this.Head.Equals(linked.Tail, comparer));
            }

            return(TupleHelpers.Equals(this, other, comparer));
        }
        public bool Equals(IVarTuple?other)
        {
            if (other == null)
            {
                return(false);
            }

            if (other is MemoizedTuple mt)
            {
                return(m_packed.Equals(mt.m_packed));
            }

            return(TupleHelpers.Equals(this, other, SimilarValueComparer.Default));
        }
        public bool Equals(IVarTuple other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(false);
            }

            var memoized = other as MemoizedTuple;

            if (!object.ReferenceEquals(memoized, null))
            {
                return(m_packed.Equals(memoized.m_packed));
            }

            return(TupleHelpers.Equals(this, other, SimilarValueComparer.Default));
        }
Beispiel #5
0
 bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
 {
     if (other == null)
     {
         return(false);
     }
     if (other is STuple <T1> stuple)
     {
         return(comparer.Equals(this.Item1, stuple.Item1));
     }
     if (other is ValueTuple <T1> vtuple)
     {
         return(comparer.Equals(this.Item1, vtuple.Item1));
     }
     return(TupleHelpers.Equals(this, other, comparer));
 }
 bool IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer)
 {
     return(TupleHelpers.Equals(this, other, comparer));
 }