Esempio n. 1
0
        public bool Contains(int surr)
        {
            prepareInsert_1_2();

            if (Array.SortedArrayContains(insertList_1_2, insertCount, surr))
            {
                return(true);
            }

            if (!table.Contains(surr))
            {
                return(false);
            }

            Prepare();

            //## BAD: THIS IS VERY INEFFICIENT IF THERE'S A LOT OF ENTRIES WHOSE FIRST ARGUMENT IS surr
            int[] surrs = table.Restrict(surr);
            for (int i = 0; i < surrs.Length; i++)
            {
                int surr1 = surr;
                int surr2 = surrs[i];
                if (surr1 > surr2)
                {
                    surr1 = surr2;
                    surr2 = surr;
                }
                if (!Ints12.Contains(deleteList, deleteCount, surr1, surr2))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        //////////////////////////////////////////////////////////////////////////////

        public bool Contains(int surr1, int surr2)
        {
            Prepare();

            if (surr1 > surr2)
            {
                int tmp = surr1;
                surr1 = surr2;
                surr2 = tmp;
            }

            if (Ints12.Contains(insertList, insertCount, surr1, surr2))
            {
                return(true);
            }

            if (Ints12.Contains(deleteList, deleteCount, surr1, surr2))
            {
                return(false);
            }

            return(table.Contains(surr1, surr2));
        }