00001 /*========================================================================== 00002 * Copyright (c) 2004 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 // 00013 // DocListFrequencyIterator 00014 // 00015 // 24 August 2004 -- tds 00016 // 00017 00018 #ifndef INDRI_DOCLISTFREQUENCYITERATOR_HPP 00019 #define INDRI_DOCLISTFREQUENCYITERATOR_HPP 00020 00021 #include "indri/DocListDiskBlockReader.hpp" 00022 #include "indri/greedy_vector" 00023 #include "ReadBuffer.hpp" 00024 #include "indri/DocListIterator.hpp" 00025 #include "indri/DocumentCount.hpp" 00026 00027 namespace indri { 00028 namespace index { 00029 class DocListFrequencyIterator { 00030 private: 00031 int _termID; 00032 ReadBuffer* _buffer; 00033 indri::index::DocListDiskBlockReader _reader; 00034 greedy_vector<DocumentCount> _entries; 00035 greedy_vector<DocumentCount>::iterator _end; 00036 greedy_vector<DocumentCount>::iterator _iterator; 00037 File::offset_type _seekLocation; 00038 bool _finished; 00039 00040 void _fetchNextBlock( int documentID ); 00041 void _fillVector( int documentID ); 00042 00043 public: 00044 DocListFrequencyIterator( File& segment, 00045 int termID, 00046 File::offset_type seekLocation, 00047 INT64 estimatedDataLength = KEYFILE_DOCLISTITERATOR_DEFAULT_BUFFERSIZE ); 00048 ~DocListFrequencyIterator(); 00049 00050 void startIteration(); 00051 bool hasMore(); 00052 void nextEntry(); 00053 void nextEntry( int documentID ); 00054 const DocumentCount* currentEntry(); 00055 }; 00056 } 00057 } 00058 00059 #endif // INDRI_DOCLISTFREQUENCYITERATOR_HPP 00060