text: public int nextDoc() {while (true) {if (queue.size() == 0) {doc = NO_MORE_DOCS;break;}int newDoc = queue.top().docID();if (newDoc != doc) {assert newDoc > doc: "doc=" + doc + " newDoc=" + newDoc;doc = newDoc;break;}if (queue.top().nextDoc() == NO_MORE_DOCS) {queue.pop();} else {queue.updateTop();}}return doc;}