/// <exception cref="IOException"/> private void DoChain(FixedBitSet result, int logic, DocIdSet dis) { if (dis is FixedBitSet) { // optimized case for FixedBitSets switch (logic) { case OR: result.Or((FixedBitSet)dis); break; case AND: result.And((FixedBitSet)dis); break; case ANDNOT: result.AndNot((FixedBitSet)dis); break; case XOR: result.Xor((FixedBitSet)dis); break; default: DoChain(result, DEFAULT, dis); break; } } else { DocIdSetIterator disi; if (dis == null) { disi = DocIdSetIterator.GetEmpty(); } else { disi = dis.GetIterator() ?? DocIdSetIterator.GetEmpty(); } switch (logic) { case OR: result.Or(disi); break; case AND: result.And(disi); break; case ANDNOT: result.AndNot(disi); break; case XOR: result.Xor(disi); break; default: DoChain(result, DEFAULT, dis); break; } } }