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 WORD_H
00025 #define WORD_H
00026 
00027 #include "FileIO.h"
00028 #include "Element.h"
00029 #include "ElementList.tcc"
00030 
00049 class Word : public Element {
00050 public:
00051 
00053   Word(char *word, int wordNumber, int totalCount = 0, 
00054        int documentCount = 0, FILE_POS_TYPE filePosition = 0, float weight = 0);
00055 
00057   Word(FileIO *file);
00058 
00059   ~Word(void);
00060 
00062   void incrementTotalCount(void);
00063 
00065   void incrementDocumentCount(void);
00066 
00068   int documentCount(void);
00069 
00071   int totalCount(void);
00072 
00074   int length(void);
00075   
00077   void weight(float);
00078 
00080   float weight(void);
00081 
00083   void purge(FileIO *file);
00084 
00086   void salvage(FileIO *file);
00087 
00089   bool operator< (const Word &word) const;
00090 
00092   bool operator== (const Word &word) const;
00093 
00095   void operator= (const Word &word);
00096 
00098   friend class ElementList<Word>;
00099 
00100 private:
00101   int _documentCount; 
00102   int _totalCount; 
00103 
00104   float _weight; 
00105 };
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 #endif