00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef FLOATINDEX_H
00025 #define FLOATINDEX_H
00026
00027 #include "FileBlockQueue.h"
00028 #include "WriteQueueAccessFile.h"
00029 #include "EncodeDouble.tcc"
00030 #include "Triplef_tfd.h"
00031 #include "TopicWordList.h"
00032 #include "FileName.h"
00033
00054 class FloatIndex {
00055 public:
00056
00058 FloatIndex(int indexLength, int listLength, BlockStats *stats,
00059 FileName *filename);
00060 virtual ~FloatIndex(void);
00061
00063 virtual bool calculateRow(int currentRealWord) = 0;
00064
00066 virtual int listRealPosition(int position) = 0;
00067
00069 virtual int indexRealPosition(int position) = 0;
00070
00072 virtual const char *elementName(int elementNumber);
00073
00074
00075
00077 void createFloatIndex(int processedWords, int storedWords);
00078
00080 void printTripleList(void);
00081
00082 protected:
00083
00085 void checkRowBounds(int element);
00086
00088 void pnCheckRowBounds(int element);
00089
00091 virtual Quantise *createQuantiser(float lower, float upper) = 0;
00092
00094 float *_rowBuffer;
00095
00097 const int _listLength;
00098
00099 private:
00100 void fillEmptyRange(int lastElementNo, int elementNo);
00101 void buildTripleList(int currentRealWord);
00102 void encodeTripleList(int currentRealWord);
00103 void pruneTripleList(int storedWords);
00104
00105 FileBlockQueue *_indexQueue;
00106 WriteQueueAccessFile *_wfile;
00107 EncodeDouble<Triplef_tfd> *_outFileBuffer;
00108 TopicWordList *_twlist;
00109
00110 Quantise *_quantiser;
00111 Triplef_tfd *_lastTriple;
00112 TripleList<Triplef_tfd> *_tripleList;
00113
00114 int _prunnedListLength;
00115 const int _indexLength;
00116
00117 float _maxRowValue;
00118 float _minRowValue;
00119
00120 FileName *_fileName;
00121 };
00122
00123 #endif