00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00031 #ifndef ITEMSETCOMPARE_H
00032 #define ITEMSETCOMPARE_H
00033 
00034 
00035 
00036 #include "Itemset.h"
00037 
00038 int compare(const Itemset* is1, const Itemset* is2);
00039 
00040 
00041 template<typename T> struct hash
00042 {
00043 
00044 };
00045 
00046 
00047 template<typename T> struct ltis
00048 {
00049 
00050 };
00051 
00052 
00053 template<> struct ltis<const Itemset*>
00054 {
00055     bool operator()(const Itemset* is1, const Itemset* is2) const
00056     {
00057         if (is1 && is2)
00058         {
00059             return compare(is1, is2) < 0;
00060         }
00061         return false;
00062     }
00063 };
00064 
00065 
00066 template<> struct hash<const Itemset*>
00067 {
00068    size_t operator()(const Itemset* is) const
00069    {
00070       unsigned long ret = 0;
00071       for (unsigned int i = 0; i < (*is).getSize(); i++)
00072       {
00073           ret = (113 * ret) + (*is)[i];
00074       }
00075       return (size_t)ret;
00076    }
00077 };
00078 
00079 
00080 struct eqis
00081 {
00082     bool operator()(const Itemset* is1, const Itemset* is2) const
00083     {
00084         if (is1 && is2)
00085         {
00086             return !compare(is1, is2);
00087         }
00088         return false;
00089     }
00090 };
00091 
00092 #endif
00093