Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

BasicTermInfoList.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2001 Carnegie Mellon University.  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.cs.cmu.edu/~lemur/license.html
00008  *
00009  *==========================================================================
00010 */
00011 
00012 
00013 #include "TermInfoList.hpp"
00014 
00016 
00017 class BasicTermInfo : public TermInfo {
00018 public:
00019   BasicTermInfo() {}
00020   BasicTermInfo( int termID, int termCount) : 
00021     tid(termID), tcount(termCount) {}
00022   virtual int count() { return tcount;}
00023 
00024   virtual int id() { return tid;}
00025   
00027   int position() { return tid;}
00028   friend class BasicTermInfoList;
00029 private:
00030   int tid, tcount;
00031 };
00032 
00033 
00034 
00036 
00037 class BasicTermInfoList : public TermInfoList {
00038 public:
00039   BasicTermInfoList(int *tmpWordArray, int size);
00040   
00041   virtual ~BasicTermInfoList() {}
00042   virtual void startIteration() {
00043     it = 0;
00044   }
00045 
00046   virtual bool hasMore() { return (it<sz); }
00047 
00048   virtual TermInfo *nextEntry();
00049 
00050 private:
00051   int sz, it;
00052   int *tmpwarr;
00053 };
00054 
00055 
00056 inline BasicTermInfoList::BasicTermInfoList(int *tmpWordArray, int size):
00057   tmpwarr(tmpWordArray), sz(size), it(0) 
00058 {
00059 }
00060 
00062 inline TermInfo * BasicTermInfoList::nextEntry() {
00063   // assert (hasMore());
00064   static BasicTermInfo info;
00065   info.tid =  tmpwarr[it];
00066   info.tcount = tmpwarr[sz+it];
00067   it++;
00068   return (&info);
00069 }
00070 
00071 
00072 

Generated at Fri Jul 26 18:22:26 2002 for LEMUR by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000