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

vector/FrequentPairInserterNoprune.hpp

Go to the documentation of this file.
00001 #ifndef FrequentPairInserterNoprune_HPP
00002 #define FrequentPairInserterNoprune_HPP
00003 
00004 #include "common.hpp"
00005 #include "apriori/bodon-vector/vector_typedef.hpp"
00006 #include <vector>
00007 //#include <cstdio>
00008 //#include <iterator>   //for test
00009 
00010 
00011 namespace Bodon
00012 {
00013 namespace vector_based
00014 {
00015 template <class D, class DUMMY>
00016 class FrequentPairInserterNoprune
00017 {
00018    protected:
00019       cand_vector_t& candidates; 
00020       D& decoder;
00021 
00022    public:
00023       FrequentPairInserterNoprune( cand_vector_t& candidates, 
00024                                    D& decoder, DUMMY& dummy ) : 
00025          candidates(candidates), decoder(decoder){}
00026 
00027 
00029       void insertFrequentPairs(
00030          const std::vector< std::pair< counter_t, 
00031          std::pair<item_t, item_t> > >& freq_pairs_with_counters )
00032       {
00033          itemvector itemset;
00034          for( std::vector< std::pair< counter_t, std::pair<item_t, item_t> > >::const_iterator 
00035                  it = freq_pairs_with_counters.begin(); it != freq_pairs_with_counters.end(); ++it)
00036          {
00037             itemset.push_back((*it).second.first);
00038             itemset.push_back((*it).second.second);
00039             candidates.push_back(itemvecCounterPair(itemset, (*it).first ) );
00040             itemset.clear();
00041          }
00042          
00043          for(cand_vector_t::iterator it = candidates.begin(); 
00044              it != candidates.end(); ++it)
00045             decoder.writeItemsetAndCounter(
00046                (*it).first.begin(), (*it).first.end(), (*it).second);
00047       }
00048 };
00049 
00050 }
00051 }
00052 
00053 #endif

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