public boolean skipTo(int target) throws IOException { doc = target; for (; idx < maxDoc; idx++) { if (idx >= doc && docBuffer.getBit(idx) > 0){ doc = idx; return true; } } return false; }
public int read(int[] docs, int[] freqs) throws IOException { final int length = docs.length; int i = 0; while (i < length && doc < maxDoc && fillSize > 0) { docs[i] = doc; freqs[i] = docBuffer.getBit(doc); ++i; next(); } return i; }
public int get(OpenBitSet compressedSet, int index) { int retVal = 0; // This is an exception if (compressedSet.getBit((index + 1) * _b + HEADER_MASK - 1) == 1) { // Get the exception index for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } int exOffset = _exceptionOffset + retVal * BASE_MASK; retVal = 0; // Get the actual value for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(exOffset + j) << j); } return retVal; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } return retVal; } }
public int[] decompress(OpenBitSet compressedSet) { // reuse o/p op[0] = _base; // Offset of the exception list int exceptionOffset = HEADER_MASK + _b * _batchSize; // explode and patch for (int i = 1; i < _batchSize; i++) { // This is an exception if (compressedSet.getBit((i + 1) * _b + HEADER_MASK - 1) == 1) { for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(exceptionOffset + j) << j); } exceptionOffset += BASE_MASK; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(i * _b + j + HEADER_MASK) << j); } } op[i] += op[i - 1]; } return op; }
public int[] decompress(OpenBitSet compressedSet) { // reuse o/p op[0] = _base; // Offset of the exception list int exceptionOffset = HEADER_MASK + _b * _batchSize; // explode and patch for (int i = 1; i < _batchSize; i++) { // This is an exception if (compressedSet.getBit((i + 1) * _b + HEADER_MASK - 1) == 1) { for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(exceptionOffset + j) << j); } exceptionOffset += BASE_MASK; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(i * _b + j + HEADER_MASK) << j); } } op[i] += op[i - 1]; } return op; }
public int[] decompress(OpenBitSet compressedSet) { // reuse o/p op[0] = _base; // Offset of the exception list int exceptionOffset = HEADER_MASK + _b * _batchSize; // explode and patch for (int i = 1; i < _batchSize; i++) { // This is an exception if (compressedSet.getBit((i + 1) * _b + HEADER_MASK - 1) == 1) { for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(exceptionOffset + j) << j); } exceptionOffset += BASE_MASK; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) op[i] |= (compressedSet.getBit(i * _b + j + HEADER_MASK) << j); } } op[i] += op[i - 1]; } return op; }
public int get(OpenBitSet compressedSet, int index) { int retVal = 0; // This is an exception if (compressedSet.getBit((index + 1) * _b + HEADER_MASK - 1) == 1) { // Get the exception index for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } int exOffset = _exceptionOffset + retVal * BASE_MASK; retVal = 0; // Get the actual value for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(exOffset + j) << j); } return retVal; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } return retVal; } }
public int get(OpenBitSet compressedSet, int index) { int retVal = 0; // This is an exception if (compressedSet.getBit((index + 1) * _b + HEADER_MASK - 1) == 1) { // Get the exception index for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } int exOffset = _exceptionOffset + retVal * BASE_MASK; retVal = 0; // Get the actual value for (int j = 0; j < BASE_MASK; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(exOffset + j) << j); } return retVal; } else { for (int j = 0; j < _b - 1; j++) { // if(compressedSet.fastGet(i*_b+j+header)) retVal |= (compressedSet.getBit(index * _b + j + HEADER_MASK) << j); } return retVal; } }