⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itemset.h

📁 数据挖掘中Aprior算法的C++实现
💻 H
字号:
//
// Class for itemset.
//
//
#ifndef _ITEMSET_H_
#define _ITEMSET_H_

#include "tzObject.h"
#include <stdio.h>

//##ModelId=42E494EF00DB
typedef int Item;


/* to find the minimum and maximum integer from two parameters */
#define imax(a, b) (((a) > (b))?(a):(b))
#define imin(a, b) (((a) < (b))?(a):(b))


// Relationship between two ItemSet s
#define TOTALEQUAL 0
#define MAKEUP     1
#define TOTALDIFF  2
#define CROSS      3



//##ModelId=42E494EF00FA
class itemSet : public tzObject
{

public:

	//##ModelId=42E494EF00FC
    itemSet()
    {
        m_items = (Item *)NULL;
        count = 0;
        m_support = 0;
        m_weight = 0.0;
        m_keeporder = true;
    };

	//##ModelId=42E494EF00FD
    ~itemSet()
    {
        delete m_items;
    };


	//##ModelId=42E494EF0109
    void add(Item theitem);
	//##ModelId=42E494EF010B
    void add(int index, Item theitem);
    
	//##ModelId=42E494EF0119
    void concat(itemSet *src);
	//##ModelId=42E494EF011B
    void clear();
	//##ModelId=42E494EF011C
    tzObject *clone();
	//##ModelId=42E494EF011D
    int compare(tzObject *obj);
	//##ModelId=42E494EF0129
    Item get(int index);
	//##ModelId=42E494EF012B
    int indexOf(Item theitem, bool ascend = true);
	//##ModelId=42E494EF0138
    Item remove(int index);

	//##ModelId=42E494EF013A
    itemSet *left(int nCount);

	//##ModelId=42E494EF013C
    itemSet *sub(int bgn, int end);
	//##ModelId=42E494EF0149
    itemSet *substract(itemSet *aset);

  
	//##ModelId=42E494EF014B
    void dump();
    
	//##ModelId=42E494EF014C
    bool keeporder()            { return m_keeporder; };
	//##ModelId=42E494EF014D
    void keeporder(bool value)  { m_keeporder = value; };
    
	//##ModelId=42E494EF0158
    int size()                  { return count; };
    
	//##ModelId=42E494EF0159
    long support()              { return m_support; };
	//##ModelId=42E494EF015A
    void support(long value)    { m_support = value; };
    
	//##ModelId=42E494EF0167
    double weight()             { return m_weight; };
	//##ModelId=42E494EF0168
    void weight(double value)   { m_weight = value; }
	
private:

	//##ModelId=42E494EF016B
    Item *m_items;
	//##ModelId=42E494EF0177
    int count;

	//##ModelId=42E494EF0178
    bool m_keeporder;
    
	//##ModelId=42E494EF0186
    long m_support;
	//##ModelId=42E494EF0187
    double m_weight;
	
};



#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -