Example #1
0
        //////////////////////////////////////////////////////////////////////////////

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

            Prepare();

            if (Ints123.Contains12(insertList, insertCount, surr1, surr2))
            {
                int idxFirst = Ints123.IndexFirst12(insertList, insertCount, surr1, surr2);
                return(insertList[3 * idxFirst + 2]);
            }

            if (table.Contains12(surr1, surr2))
            {
                Sym12TernaryTable.Iter12 it = table.GetIter12(surr1, surr2);
                Debug.Assert(!it.Done());
                do
                {
                    if (!Ints123.Contains(deleteList, deleteCount, surr1, surr2, it.Get1()))
                    {
                        return(it.Get1());
                    }
                    it.Next();
                } while (!it.Done());
            }

            throw ErrorHandler.InternalFail();
        }
Example #2
0
        //////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////

        public bool Contains12(int surr1, int surr2)
        {
            if (surr1 > surr2)
            {
                int tmp = surr1;
                surr1 = surr2;
                surr2 = tmp;
            }

            Prepare();
            if (Ints123.Contains12(insertList, insertCount, surr1, surr2))
            {
                return(true);
            }

            if (table.Contains12(surr1, surr2))
            {
                Sym12TernaryTable.Iter12 it = table.GetIter12(surr1, surr2);
                Debug.Assert(!it.Done());
                do
                {
                    if (!Ints123.Contains(deleteList, deleteCount, surr1, surr2, it.Get1()))
                    {
                        return(true);
                    }
                    it.Next();
                } while (!it.Done());
            }

            return(false);
        }
Example #3
0
 public void Delete12(int value1, int value2)
 {
     if (value1 > value2)
     {
         int tmp = value1;
         value1 = value2;
         value2 = tmp;
     }
     Sym12TernaryTable.Iter12 it = table.GetIter12(value1, value2);
     while (!it.Done())
     {
         deleteList = Array.Append3(deleteList, deleteCount++, value1, value2, it.Get1());
         it.Next();
     }
 }