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

prefixarray/SupportCounter.hpp

Go to the documentation of this file.
00001 #ifndef SupportCounter_prefix_HPP
00002 #define SupportCounter_prefix_HPP
00003 
00004 
00005 #include "apriori/bodon-vector/SupportCounter.hpp"
00006 #include "apriori/bodon-vector/vector_typedef.hpp"
00007 //#include <cstdio>
00008 //#include <iterator>   //for test
00009 
00010 
00011 
00012 
00013 namespace Bodon
00014 {
00015 namespace prefix_array
00016 {
00017    template<class DATA_STRUCTURE>
00018    class SupportCounter
00019    {
00020       protected:
00021          Bodon::vector_based::SupportCounter<cand_vector_t> supp_count;
00022       public:
00023          SupportCounter<DATA_STRUCTURE>(){}
00024 
00025       public:
00028          void updateCounters( 
00029             DATA_STRUCTURE& candidates, const std::vector<item_t>& transaction, 
00030             const unsigned int candidate_size, const counter_t counter_incr );
00031          void updateCounters( 
00032             DATA_STRUCTURE& candidates, std::vector<item_t>::iterator transaction_beg, 
00033             std::vector<item_t>::iterator transaction_end,
00034             const unsigned int candidate_size, const counter_t counter_incr );
00035    };
00036 
00037    template<class DATA_STRUCTURE>
00038    void inline SupportCounter<DATA_STRUCTURE>::updateCounters( 
00039       DATA_STRUCTURE& candidates, const std::vector<item_t>& transaction, 
00040       const unsigned int candidate_size, const counter_t counter_incr )
00041    {
00042 //      copy(transaction.begin(), transaction.end(), ostream_iterator<item_t>(std::cout, " "));
00043 //      std::cout<<std::endl;
00044       for(std::vector<item_t>::const_iterator it1 = transaction.begin();
00045          it1 != transaction.end()- candidate_size +1; ++it1)
00046          for(std::vector<item_t>::const_iterator it2 = it1 + 1;
00047              it2 != transaction.end() - candidate_size + 2; ++it2)
00048          {
00049             supp_count.updateCounters(
00050                candidates[*it1][*it2 - *it1 - 1], 
00051                it2+1, transaction.end(), candidate_size, counter_incr);
00052          }
00053    }
00054 }
00055 }
00056 #endif

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