public bool Contains23(int surr2, int surr3) { Prepare231(); if (Ints231.Contains23(insertList, insertCount, surr2, surr3)) { return(true); } if (!table.Contains23(surr2, surr3)) { return(false); } int idx = Ints231.IndexFirst23(deleteList, deleteCount, surr2, surr3); if (idx == -1) { return(true); } int count = Ints231.Count23(deleteList, deleteCount, surr2, surr3, idx); TernaryTable.Iter it = table.GetIter23(surr2, surr3); while (!it.Done()) { // Tuples in the [idx, idx+count) range are sorted in any order, since two arguments are the same if (!Ints123.Contains1(deleteList, idx, count, it.Get1())) { return(true); } it.Next(); } return(false); }
////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// public bool Contains1(int surr1) { Prepare123(); if (Ints123.Contains1(insertList, insertCount, surr1)) { return(true); } if (!table.Contains1(surr1)) { return(false); } int idx = Ints123.IndexFirst1(deleteList, deleteCount, surr1); if (idx == -1) { return(true); } int count = Ints123.Count1(deleteList, deleteCount, surr1, idx); TernaryTable.Iter it = table.GetIter1(surr1); while (!it.Done()) { // Tuples in the [idx, idx+count) range are sorted in both 1/2/3 // and 2/3/1 order, since the first argument is always the same if (!Ints231.Contains23(deleteList, idx, count, it.Get1(), it.Get2())) { return(true); } it.Next(); } return(false); }