00001
00010 #ifndef OneByOneSupportCounter_HPP
00011 #define OneByOneSupportCounter_HPP
00012
00013 #include "common.hpp"
00014 #include <vector>
00015
00016
00017
00018
00019
00030 template <class DATA_STRUCTURE, class TR, class SC = Dummy>
00031 class OneByOneSupportCounter
00032 {
00033 private:
00034
00035 DATA_STRUCTURE& data_structure;
00036 TR& transaction_reader;
00037 SC support_counter;
00038
00039 public:
00040 OneByOneSupportCounter( DATA_STRUCTURE& data_structure,
00041 TR& transaction_reader) :
00042 data_structure(data_structure),
00043 transaction_reader(transaction_reader){}
00044 void countSupport(const unsigned int candidate_size);
00045 };
00046
00047 template <class DATA_STRUCTURE, class TR, class SC> inline void
00048 OneByOneSupportCounter<DATA_STRUCTURE, TR, SC>::
00049 countSupport(const unsigned int candidate_size )
00050 {
00051 assert( candidate_size > 2 );
00052 transaction_reader.rewind();
00053 std::vector<item_t> transaction;
00054 counter_t multiplicity;
00055 while( (multiplicity = transaction_reader.nextTransactionBIS(
00056 transaction)) !=0 )
00057 if( candidate_size <= transaction.size() )
00058 support_counter.updateCounters(
00059 data_structure, transaction,
00060 candidate_size, multiplicity);
00061
00062 }
00063 #endif