00001 // bbq - Copyright (C) 2005, Axel Mosig, University of Leipzig. See 00002 // main.cpp for details. 00003 00004 #ifndef BITMULTISETS_H 00005 #define BITMULTISETS_H 00006 00007 #include <iostream> 00008 00009 namespace bbq { 00010 00017 class bit_multi_set 00018 { 00019 public: 00020 00021 typedef unsigned char c_uint; 00022 00023 c_uint* counts; 00024 00027 static int k; 00028 00030 static bool weighted; 00031 static int k_; 00032 float* weights; 00033 00035 bit_multi_set(const bit_multi_set&); 00036 00038 bit_multi_set& operator=(const bit_multi_set& vb); 00039 00041 bit_multi_set(); 00042 00044 ~bit_multi_set() 00045 { 00046 delete[] counts; 00047 } 00048 00050 bool subseteq(const bit_multi_set&) const; 00051 00052 // this version of subseteq checks only up to the J-th bit whether 00053 // *this is a subset of the set passed as an argument. 00054 bool subseteq(const bit_multi_set&, const unsigned int& J) const; 00055 00063 bool operator<(const bit_multi_set&) const; 00064 00072 bool operator==(const bit_multi_set&) const; 00073 00075 int cardinality(); 00076 00079 float weight(); 00080 00081 friend std::ostream& operator<<(std::ostream& o,const bit_multi_set&); 00082 00084 void intersect(const bit_multi_set& b); 00085 00088 void set(const int& j, const float& w); 00089 00091 void reset(const int& j, const float& w); 00092 00094 void decrease(const int& j, const float& w); 00095 00099 void remove(const int& j, const float& w); 00100 00103 bool contains(const int&); 00104 00105 }; 00106 00107 } // end namespace bbq 00108 00109 #endif 00110