//////////////////////////////////////////////////////////////////////
// node.h: definitons of the k_node and GK_node classes (nodes for 
// k_tree and GK_tree data structure.)
//////////////////////////////////////////////////////////////////////

#ifndef _NODE_CLASS
#define _NODE_CLASS
#endif

class K_tree;
class C_tree;
class GloK_tree;
//struct neg_gen;

class K_node{
public:
	int itemName;

	K_node* par; //parent
	K_node* leftchild;
	K_node* rightsibling;
	K_node* next;  //node link, link up all the leaves

public:
	K_node(K_node* parent, int itemname); //construct and initialize a node
	~K_node();

	void init(K_node* parent, int itemname); //initialize a node
    K_node* append(K_tree* ktree, K_node* sib, int itemno);  //append a node as the child, return the new child
	//K_node* append(GloK_tree* ktree, K_node* sib, int itemno);  //append a node as the child, return the new child
};

class GK_node
{
public:
	int itemName;

	GK_node* par; //parent
	GK_node* leftchild;
	GK_node* rightsibling;
	GK_node* next;  //node link, link up all the leaves

	bool blborder;
	int index; //key pattern index
	int support;
	GK_node* negNext; //neg border link list

	GK_node(GK_node* parent, int itemname); //construct and initialize a node
	~GK_node();

	void init(GK_node* parent, int itemname); //initialize a node
	GK_node* append(GloK_tree* ktree, GK_node* sib, int itemno);  //append a node as the child, return the new child
};

class C_node{
public:
	int itemName;
	int index; //correspoinding hashtable index
	int level; //depth in the tree, for fast subset superset check

	C_node* par; //parent
	C_node* leftchild;
	C_node* rightsibling;
	C_node* next;  //node link, link up all the leaves

public:
	C_node(C_node* parent, int itemname); //construct and initialize a node
	~C_node();

	void init(C_node* parent, int itemname); //initialize a node
    C_node* append(C_tree* ctree, C_node* sib, int itemno, int lvl);  //append a node as the child, return the new child
};
