Exemplo n.º 1
0
        private bool TryGetPreviousBlockSlower(DataBlock currentBlock, out DataBlock?previousBlock)
        {
            if (currentBlock == DataBlock.Empty && LastValueOrDefault != null)
            {
                previousBlock = LastValueOrDefault;
            }
            else if (!_blockSeries.TryFindBlockAtFromSource(out previousBlock, this,
                                                            currentBlock.DangerousRowKey <TKey>(index: 0), Lookup.LT))
            {
                if (AdditionalCorrectnessChecks.Enabled)
                {
                    ThrowHelper.Assert(previousBlock == null);
                }
                previousBlock = null;
            }

            if (previousBlock != null)
            {
                if (AdditionalCorrectnessChecks.Enabled)
                {
                    ThrowHelper.DebugAssert(previousBlock.RowCount > 0);
                }
                return(previousBlock.RowCount > 0);
            }

            return(false);
        }
Exemplo n.º 2
0
        private bool TryGetNextBlockSlower(DataBlock currentBlock, out DataBlock?nextBlock)
        {
            if (currentBlock == DataBlock.Empty && First.IsPresent)
            {
                nextBlock = First.Present.Value;
            }
            else if (!_blockSeries.TryFindBlockAtFromSource(out nextBlock, this,
                                                            currentBlock.DangerousRowKey <TKey>(index: 0), Lookup.GT))
            {
                if (AdditionalCorrectnessChecks.Enabled)
                {
                    ThrowHelper.Assert(nextBlock == null, "nextBlock == null");
                }
                nextBlock = null;
            }

            if (nextBlock != null)
            {
                if (AdditionalCorrectnessChecks.Enabled)
                {
                    ThrowHelper.DebugAssert(nextBlock.RowCount > 0, "nextBlock.RowCount > 0 2");
                }
                return(nextBlock.RowCount > 0);
            }

            return(false);
        }