if (keyIndex >= (HashTable.BATCH_SIZE * startIndices.size())) {
// allocate a new batch
addStartIndexBatch();
}
SelectionVector4 startIndex = startIndices.get(batchIdx);
int linkIndex;
// If head of the list is empty, insert current index at this position
if ((linkIndex = (startIndex.get(offsetIdx))) == INDEX_EMPTY) {
startIndex.set(offsetIdx, batchIndex, recordIndex);
} else {
/* Head of this list is not empty, if the first link
* is empty insert there
*/
batchIdx = linkIndex >>> SHIFT_SIZE;
offsetIdx = linkIndex & Character.MAX_VALUE;
SelectionVector4 link = buildInfoList.get(batchIdx).getLinks();
int firstLink = link.get(offsetIdx);
if (firstLink == INDEX_EMPTY) {
link.set(offsetIdx, batchIndex, recordIndex);
} else {
/* Insert the current value as the first link and
* make the current first link as its next
*/
int firstLinkBatchIdx = firstLink >>> SHIFT_SIZE;
int firstLinkOffsetIDx = firstLink & Character.MAX_VALUE;
SelectionVector4 nextLink = buildInfoList.get(batchIndex).getLinks();
nextLink.set(recordIndex, firstLinkBatchIdx, firstLinkOffsetIDx);
link.set(offsetIdx, batchIndex, recordIndex);
}
}
}