本文整理汇总了C#中Iterator.SkipBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Iterator.SkipBlock方法的具体用法?C# Iterator.SkipBlock怎么用?C# Iterator.SkipBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Iterator
的用法示例。
在下文中一共展示了Iterator.SkipBlock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
/// <summary>
/// Build the <seealso cref="PForDeltaDocIdSet"/> instance. </summary>
public virtual PForDeltaDocIdSet Build()
{
Debug.Assert(BufferSize < BLOCK_SIZE);
if (Cardinality == 0)
{
Debug.Assert(PreviousDoc == -1);
return EMPTY;
}
EncodeBlock();
sbyte[] dataArr = Arrays.CopyOf(Data.Bytes, Data.Length + MAX_BYTE_BLOCK_COUNT);
int indexSize = (NumBlocks - 1) / IndexInterval_Renamed + 1;
MonotonicAppendingLongBuffer docIDs, offsets;
if (indexSize <= 1)
{
docIDs = offsets = SINGLE_ZERO_BUFFER;
}
else
{
const int pageSize = 128;
int initialPageCount = (indexSize + pageSize - 1) / pageSize;
docIDs = new MonotonicAppendingLongBuffer(initialPageCount, pageSize, PackedInts.COMPACT);
offsets = new MonotonicAppendingLongBuffer(initialPageCount, pageSize, PackedInts.COMPACT);
// Now build the index
Iterator it = new Iterator(dataArr, Cardinality, int.MaxValue, SINGLE_ZERO_BUFFER, SINGLE_ZERO_BUFFER);
for (int k = 0; k < indexSize; ++k)
{
docIDs.Add(it.DocID() + 1);
offsets.Add(it.Offset);
for (int i = 0; i < IndexInterval_Renamed; ++i)
{
it.SkipBlock();
if (it.DocID() == DocIdSetIterator.NO_MORE_DOCS)
{
goto indexBreak;
}
}
indexContinue: ;
}
indexBreak:
docIDs.Freeze();
offsets.Freeze();
}
return new PForDeltaDocIdSet(dataArr, Cardinality, IndexInterval_Renamed, docIDs, offsets);
}