#ifndef TREE_H
#define TREE_H

#include "tnode.h"

//Tree is a class used for storing integers in 'binary tree'. In the implementation
//left childs have smaller and right childs bigger value than the value on the 'parent', and
//one number can be only once in the tree.

//--------
class Tree
//--------
{
	private:
		Tnode* root;
		unsigned int count;

		Tnode* Add(Tnode* p, const int i); 
		//Private method for adding elements to the tree - corresponds to 
		//tnode *tree( tnode *p, const char *w )-function in the example in lecture material.

		void TreePrint(const Tnode* p) const;
		//Private method for printing the elements.

		void OnEqual(const int);
		//Method which is called when figure that was tried to be added already existed.

	public:
		Tree() : root(0), count(0) {}
		//constructor

		~Tree();
		//Destructor, clears tree.

		void Add(const int i);
		//Add element to the tree.

		void Print() const;
		//Print the tree.
};

#endif