private static List <int> ArrayQueueAsList(IntQueue queue)
        {
            var l = new List <int>(queue.Size());

            for (var i = 0; i < queue.Size(); i++)
            {
                l.Add(queue.Get(i));
            }
            return(l);
        }
        public override sealed int NextDoc()
        {
            if (_queue.Size() == 0)
            {
                return(NO_MORE_DOCS);
            }

            // TODO: move this init into positions(): if the search
            // doesn't need the positions for this doc then don't
            // waste CPU merging them:
            _posList.Clear();
            _doc = _queue.Top().DocID();

            // merge sort all positions together
            DocsAndPositionsEnum postings;

            do
            {
                postings = _queue.Top();

                int freq = postings.Freq();
                for (int i = 0; i < freq; i++)
                {
                    _posList.Add(postings.NextPosition());
                }

                if (postings.NextDoc() != NO_MORE_DOCS)
                {
                    _queue.UpdateTop();
                }
                else
                {
                    _queue.Pop();
                }
            } while (_queue.Size() > 0 && _queue.Top().DocID() == _doc);

            _posList.Sort();
            _freq = _posList.Size();

            return(_doc);
        }
        public bool Next()
        {
            if (_termPositionsQueue.Size() == 0)
            {
                return(false);
            }

            _posList.Clear();
            _doc = _termPositionsQueue.Peek().Doc();

            TermPositions tp;

            do
            {
                tp = _termPositionsQueue.Peek();

                for (int i = 0; i < tp.Freq(); i++)
                {
                    _posList.Add(tp.NextPosition());
                }

                if (tp.Next())
                {
                    _termPositionsQueue.AdjustTop();
                }
                else
                {
                    _termPositionsQueue.Pop();
                    tp.Close();
                }
            }while (_termPositionsQueue.Size() > 0 && _termPositionsQueue.Peek().Doc() == _doc);

            _posList.Sort();
            _freq = _posList.Size();

            return(true);
        }
 public int GetLength() => _pixels.Size();