Example #1
0
        static int TernRelOrder(NeTernRelObj obj1, NeTernRelObj obj2)
        {
            int size1 = obj1.GetSize();
            int size2 = obj2.GetSize();

            if (size1 != size2)
            {
                return(size1 < size2 ? -1 : 1);
            }

            int ord = Order(obj1.Col1(), obj2.Col1());

            if (ord != 0)
            {
                return(ord);
            }

            ord = Order(obj1.Col2(), obj2.Col2());
            if (ord != 0)
            {
                return(ord);
            }

            return(Order(obj1.Col3(), obj2.Col3()));
        }
Example #2
0
        //////////////////////////////////////////////////////////////////////////////

        public override int InternalOrder(Obj other)
        {
            Debug.Assert(GetSize() == other.GetSize());

            NeTernRelObj otherRel = (NeTernRelObj)other;
            int          size     = GetSize();

            Obj[] col      = col1;
            Obj[] otherCol = otherRel.col1;
            for (int i = 0; i < size; i++)
            {
                int ord = col[i].QuickOrder(otherCol[i]);
                if (ord != 0)
                {
                    return(ord);
                }
            }

            col      = col2;
            otherCol = otherRel.col2;
            for (int i = 0; i < size; i++)
            {
                int ord = col[i].QuickOrder(otherCol[i]);
                if (ord != 0)
                {
                    return(ord);
                }
            }

            col      = col3;
            otherCol = otherRel.col3;
            for (int i = 0; i < size; i++)
            {
                int ord = col[i].QuickOrder(otherCol[i]);
                if (ord != 0)
                {
                    return(ord);
                }
            }

            return(0);
        }