Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

bodon-vector/InfrequentRemover.hpp

Go to the documentation of this file.
00001 #ifndef InfrequentRemover_HPP
00002 #define InfrequentRemover_HPP
00003 
00004 #include "apriori/bodon-vector/vector_typedef.hpp"
00005 #include "common/log.h"
00006 //#include <cstdio>
00007 //#include <iterator>   //for test
00008 
00009 
00010 
00011 
00012 namespace Bodon
00013 {
00014 namespace vector_based
00015 {
00016    template <class D, class DUMMY>
00017    class InfrequentRemover 
00018    {
00019       protected:
00020          cand_vector_t& candidates; 
00021          D& decoder;
00022       public:
00023          InfrequentRemover<D, DUMMY> 
00024          (cand_vector_t& candidates, D& decoder, DUMMY& dummy) :
00025             candidates(candidates), decoder(decoder){}
00026 
00027 
00028          void deleteInfrequent( const counter_t min_supp, 
00029                                 const unsigned int candidate_size );
00030          void afterWorkDel(){}
00031       protected:
00032 
00033 
00034    };
00039    template <class D, class DUMMY> inline
00040    void InfrequentRemover<D, DUMMY>::
00041    deleteInfrequent( const counter_t min_supp, 
00042                      const unsigned int candidate_size )
00043    {
00044       cand_vector_t::iterator it = candidates.begin(); 
00045       while(it != candidates.end())
00046          if((*it).second < min_supp)
00047             it = candidates.erase(it);
00048          else
00049          {
00050             decoder.writeItemsetAndCounter(
00051                (*it).first.begin(), (*it).first.end(), (*it).second);
00052             ++it;
00053          }
00054    }
00055 }
00056 }
00057 #endif

Generated on Sun Sep 17 17:50:39 2006 for FIM environment by  doxygen 1.4.4