#ifndef H_cTree
#define H_cTree

#include "TOOLType.h"

template<class T> class cTreeNode{
protected:
	T Data;
	cTreeNode *Parent, *Left, *Right;
public:
	cTreeNode();
	~cTreeNode();

	void Clear();

	void Set(T &nData);
	bool Add(T &nData);
	bool Get(T &Key);
	bool LinearGet(T &Key);
	bool IsIn(T &Key);

	void Print();
};

template<class T> class cTree{
protected:
	cTreeNode<T> *Root;

public:
	cTree();
	~cTree();

	void Clear();
	bool Add(T &nData);
	bool Get(T &Key);
	bool LinearGet(T &Key);
	bool IsIn(T &Key);

	void Print();
};


#endif