equals() private méthode

private equals ( object k1, object k2 ) : bool
k1 object
k2 object
Résultat bool
Exemple #1
0
        static public bool doEquals(IPersistentVector v, object obj)
        {
            if (v == obj)
            {
                return(true);
            }

            IList ilist = obj as IList;

            if (ilist != null)
            {
                if (ilist.Count != v.count())   // THis test in the JVM code can't be right:  || ma.GetHashCode() != v.GetHashCode())
                {
                    return(false);
                }

                for (int i = 0; i < v.count(); i++)
                {
                    if (!Util.equals(v.nth(i), ilist[i]))
                    {
                        return(false);
                    }
                }
                return(true);
            }

            IPersistentVector ipv = obj as IPersistentVector;

            if (ipv != null)
            {
                if (ipv.count() != v.count())   // THis test in the JVM code can't be right:  || ma.GetHashCode() != v.GetHashCode())
                {
                    return(false);
                }

                for (int i = 0; i < v.count(); i++)
                {
                    if (!Util.equals(v.nth(i), ipv.nth(i)))
                    {
                        return(false);
                    }
                }
                return(true);
            }

            if (!(obj is Sequential))
            {
                return(false);
            }

            ISeq ms = RT.seq(obj);

            for (int i = 0; i < v.count(); i++, ms = ms.next())
            {
                if (ms == null || !Util.equals(v.nth(i), ms.first()))
                {
                    return(false);
                }
            }
            if (ms != null)
            {
                return(false);
            }

            return(true);
        }