예제 #1
0
        /**
         * @brief See if the given object is an XMRArrayListKey and every value is equal to our own.
         */
        public override bool Equals(object o)
        {
            if (!(o is XMRArrayListKey))
            {
                return(false);
            }
            XMRArrayListKey a   = (XMRArrayListKey)o;
            int             len = a.length;

            if (len != length)
            {
                return(false);
            }
            if (a.hashCode != hashCode)
            {
                return(false);
            }
            for (int i = 0; i < len; i++)
            {
                if (!cleaned[i].Equals(a.cleaned[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #2
0
        private static int MyListKeyComparer(object a, object b)
        {
            XMRArrayListKey alk = (XMRArrayListKey)a;
            XMRArrayListKey blk = (XMRArrayListKey)b;

            return(XMRArrayListKey.Compare(alk, blk));
        }
예제 #3
0
        /**
         * @brief Compare for key sorting.
         */
        public static int Compare(XMRArrayListKey x, XMRArrayListKey y)
        {
            int j = x.length - y.length;

            if (j == 0)
            {
                for (int i = 0; i < x.length; i++)
                {
                    object xo = x.cleaned[i];
                    object yo = y.cleaned[i];
                    j = XMRArrayKeyComparer.singleton.Compare(xo, yo);
                    if (j != 0)
                    {
                        break;
                    }
                }
            }
            return(j);
        }