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); }