public void Set(Obj value, int idx1, int idx2, int idx3) { Miscellanea.Assert(deleteList.Count == 0 || deleteList.Count == table.count); Miscellanea.Assert(insertList.Count == 0); Clear(); TernRelIter it = value.GetTernRelIter(); while (!it.Done()) { Obj val1 = idx1 == 0 ? it.Get1() : (idx1 == 1 ? it.Get2() : it.Get3()); Obj val2 = idx2 == 0 ? it.Get1() : (idx2 == 1 ? it.Get2() : it.Get3()); Obj val3 = idx3 == 0 ? it.Get1() : (idx3 == 1 ? it.Get2() : it.Get3()); int surr1 = store1.LookupValueEx(val1); if (surr1 == -1) { surr1 = store1.Insert(val1); } int surr2 = store2.LookupValueEx(val2); if (surr2 == -1) { surr2 = store2.Insert(val2); } int surr3 = store3.LookupValueEx(val3); if (surr3 == -1) { surr3 = store3.Insert(val3); } insertList.Add(new TernaryTable.Tuple((uint)surr1, (uint)surr2, (uint)surr3)); it.Next(); } }
public void Set(Obj value) { Clear(); Miscellanea.Assert(insertList.Count == 0); SeqOrSetIter it = value.GetSeqOrSetIter(); while (!it.Done()) { Obj val = it.Get(); int surr = store.LookupValueEx(val); if (surr == -1) { surr = store.Insert(val); } insertList.Add((uint)surr); it.Next(); } }
public void Set(Obj value, bool flipped) { Clear(); Miscellanea.Assert(insertList.Count == 0); BinRelIter it = value.GetBinRelIter(); while (!it.Done()) { Obj val1 = flipped ? it.Get2() : it.Get1(); Obj val2 = flipped ? it.Get1() : it.Get2(); int surr1 = store1.LookupValueEx(val1); if (surr1 == -1) { surr1 = store1.Insert(val1); } int surr2 = store2.LookupValueEx(val2); if (surr2 == -1) { surr2 = store2.Insert(val2); } insertList.Add(new Tuple((uint)surr1, (uint)surr2)); it.Next(); } }